From 7bbfbb490486343deb60159c272889a4b117c873 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 20 Jun 2024 12:00:25 +0530 Subject: [PATCH] fix: incorrect discount on other item When discount is applied on other item, don't update `discount_amount` as the amount is calculated for current item --- erpnext/public/js/controllers/transaction.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index d4f94b44ec..d9894cc9fc 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1795,6 +1795,10 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe me.frm.doc.items.forEach(d => { if (in_list(JSON.parse(data.apply_rule_on_other_items), d[data.apply_rule_on])) { for(var k in data) { + if (data.pricing_rule_for == "Discount Percentage" && data.apply_rule_on_other_items && k == "discount_amount") { + continue; + } + if (in_list(fields, k) && data[k] && (data.price_or_product_discount === 'Price' || k === 'pricing_rules')) { frappe.model.set_value(d.doctype, d.name, k, data[k]); } -- GitLab