From ab09dc545e77e93a918cea6fd93ab3c730739d9b Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Mon, 20 Dec 2021 12:16:14 +0530 Subject: [PATCH 1/5] fix(UX): Optimize rate updation of changing price list (cherry picked from commit 6087d5a6038d6e636ce1ba006ebd59e820b3cd8e) --- erpnext/public/js/controllers/transaction.js | 7 +++++-- erpnext/stock/get_item_details.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 773d53c552..2019bc0ae6 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1586,17 +1586,19 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe var items_rule_dict = {}; for(var i=0, l=children.length; i Date: Mon, 20 Dec 2021 13:26:16 +0530 Subject: [PATCH 2/5] fix: Linting issues (cherry picked from commit 0980c2f9816b3e4a11b5410b5997a72b1cad28fd) --- erpnext/public/js/controllers/transaction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 2019bc0ae6..92a6113e0f 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1587,7 +1587,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe for(var i=0, l=children.length; i Date: Wed, 22 Dec 2021 11:26:19 +0530 Subject: [PATCH 3/5] fix: Recalculate taxes irrespective of price list rate changed or not (cherry picked from commit 233f79bf960381b1c2bd753d783afd3020b377e0) # Conflicts: # erpnext/public/js/controllers/transaction.js --- erpnext/public/js/controllers/transaction.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 92a6113e0f..d04802b2fb 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1582,7 +1582,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe _set_values_for_item_list(children) { var me = this; - var price_list_rate_changed = false; var items_rule_dict = {}; for(var i=0, l=children.length; i>>>>>> 233f79bf96 (fix: Recalculate taxes irrespective of price list rate changed or not) apply_rule_on_other_items(args) { const me = this; From 2d0208ba1fc6808cad18de509ebb2e2cfa5cd152 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 22 Dec 2021 12:01:39 +0530 Subject: [PATCH 4/5] fix: Add round floats for price list rate (cherry picked from commit b60fbf5ba95350e79463f922b0e8dce518780383) --- erpnext/public/js/controllers/transaction.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index d04802b2fb..794e912eda 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -680,7 +680,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe var item = frappe.get_doc(cdt, cdn); frappe.model.round_floats_in(item, ["price_list_rate", "discount_percentage"]); - // check if child doctype is Sales Order Item/Qutation Item and calculate the rate + // check if child doctype is Sales Order Item/Quotation Item and calculate the rate if (in_list(["Quotation Item", "Sales Order Item", "Delivery Note Item", "Sales Invoice Item", "POS Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Purchase Receipt Item"]), cdt) this.apply_pricing_rule_on_item(item); else @@ -1601,6 +1601,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe } } + frappe.model.round_floats_in(item_row, ["price_list_rate", "discount_percentage"]); + // if pricing rule set as blank from an existing value, apply price_list if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rules) { me.apply_price_list(frappe.get_doc(d.doctype, d.name)); From 6eb3d6a814a1a86a6d606946779278488c0a8b68 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Sat, 25 Dec 2021 09:04:34 +0530 Subject: [PATCH 5/5] fix: Conflicts --- erpnext/public/js/controllers/transaction.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 794e912eda..3791741663 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1622,13 +1622,8 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe me.frm.refresh_field('items'); me.apply_rule_on_other_items(items_rule_dict); -<<<<<<< HEAD - if(!price_list_rate_changed) me.calculate_taxes_and_totals(); - } -======= me.calculate_taxes_and_totals(); - }, ->>>>>>> 233f79bf96 (fix: Recalculate taxes irrespective of price list rate changed or not) + } apply_rule_on_other_items(args) { const me = this;