From 28442f34148adcc2cf0b9a301c490a071ec791e5 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2024 14:00:08 +0530 Subject: [PATCH] fix: limit discount value to 100 in pos cart (backport #44916) (#44932) fix: limit discount value to 100 in pos cart (#44916) * fix: limit discount value to 100 in pos cart * fix: error message on invalid discount (cherry picked from commit ac26622d6e403b956a11f449488b444ef3e65554) Co-authored-by: Diptanil Saha <50792171+diptanilsaha@users.noreply.github.com> --- erpnext/selling/page/point_of_sale/pos_item_cart.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/selling/page/point_of_sale/pos_item_cart.js b/erpnext/selling/page/point_of_sale/pos_item_cart.js index 6342b237f6e..325f7b258a9 100644 --- a/erpnext/selling/page/point_of_sale/pos_item_cart.js +++ b/erpnext/selling/page/point_of_sale/pos_item_cart.js @@ -390,6 +390,14 @@ erpnext.PointOfSale.ItemCart = class { input_class: "input-xs", onchange: function () { this.value = flt(this.value); + if (this.value > 100) { + frappe.msgprint({ + title: __("Invalid Discount"), + indicator: "red", + message: __("Discount cannot be greater than 100%."), + }); + this.value = 0; + } frappe.model.set_value( frm.doc.doctype, frm.doc.name,