From 660a78b877e12803277f59fc2ac8c8a4e07c2b5d Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Thu, 2 Jan 2020 17:29:50 +0530 Subject: [PATCH] fix: ignore pricing rule for other item group --- erpnext/accounts/doctype/pricing_rule/utils.py | 2 +- erpnext/public/js/controllers/transaction.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pricing_rule/utils.py b/erpnext/accounts/doctype/pricing_rule/utils.py index 87f68225fe..fe68fdb6c0 100644 --- a/erpnext/accounts/doctype/pricing_rule/utils.py +++ b/erpnext/accounts/doctype/pricing_rule/utils.py @@ -495,7 +495,7 @@ def get_pricing_rule_items(pr_doc): if pr_doc.apply_rule_on_other: apply_on = frappe.scrub(pr_doc.apply_rule_on_other) - apply_on_data.append(pr_doc.get(apply_on)) + apply_on_data.append(pr_doc.get("other_" + apply_on)) return list(set(apply_on_data)) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 3b907daa1b..748e623730 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1398,7 +1398,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ remove_pricing_rule: function(item) { let me = this; - const fields = ["discount_percentage", "discount_amount", "pricing_rules"]; + const fields = ["discount_percentage", + "discount_amount", "margin_rate_or_amount", "rate_with_margin"]; if(item.remove_free_item) { var items = []; @@ -1418,6 +1419,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ fields.forEach(f => { row[f] = 0; }); + + ["pricing_rules", "margin_type"].forEach(field => { + if (row[field]) { + row[field] = ''; + } + }) } });