From 38cb5a98bfb7cd85f09f9363c6fbfe823c253a28 Mon Sep 17 00:00:00 2001 From: DHINESH00 <18csa09@karpagamtech.ac.in> Date: Thu, 19 Dec 2024 17:15:11 +0530 Subject: [PATCH] fix: update discounting on mixed conditions (cherry picked from commit d541259da9ddd0c32ec6307c879b129d3df304e3) --- erpnext/public/js/controllers/transaction.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 79ed7d0a836..e1714dae308 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1825,18 +1825,16 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe apply_rule_on_other_items(args) { const me = this; - const fields = ["discount_percentage", "pricing_rules", "discount_amount", "rate"]; + const fields = ["pricing_rules"]; for(var k in args) { let data = args[k]; if (data && data.apply_rule_on_other_items && JSON.parse(data.apply_rule_on_other_items)) { + fields.push(frappe.scrub(data.pricing_rule_for)) me.frm.doc.items.forEach(d => { - if (in_list(JSON.parse(data.apply_rule_on_other_items), d[data.apply_rule_on]) && d.item_code === data.item_code) { + 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]);