From 388fe73e4d96bd30d3dc83fbdc4aa55f2ba495f5 Mon Sep 17 00:00:00 2001 From: Divyam Mistry <73271406+divyam-mistry@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:15:43 +0530 Subject: [PATCH 1/2] fix: fetch/change tax template on basis of base_net_rate instead of net_rate (#39448) fix: change tax template on basis of base_net_rate instead of net_rate Co-authored-by: Deepesh Garg --- erpnext/controllers/taxes_and_totals.py | 1 + erpnext/public/js/controllers/transaction.js | 3 ++- erpnext/stock/get_item_details.py | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index f6009f58a35..66995fdd9ee 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -97,6 +97,7 @@ class calculate_taxes_and_totals(object): item_doc = frappe.get_cached_doc("Item", item.item_code) args = { "net_rate": item.net_rate or item.rate, + "base_net_rate": item.base_net_rate or item.base_rate, "tax_category": self.doc.get("tax_category"), "posting_date": self.doc.get("posting_date"), "bill_date": self.doc.get("bill_date"), diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index d9910e25950..18ae0513063 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -519,6 +519,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe project: item.project || me.frm.doc.project, qty: item.qty || 1, net_rate: item.rate, + base_net_rate: item.base_net_rate, stock_qty: item.stock_qty, conversion_factor: item.conversion_factor, weight_per_unit: item.weight_per_unit, @@ -1972,7 +1973,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe if (item.item_code) { // Use combination of name and item code in case same item is added multiple times item_codes.push([item.item_code, item.name]); - item_rates[item.name] = item.net_rate; + item_rates[item.name] = item.base_net_rate; item_tax_templates[item.name] = item.item_tax_template; } }); diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 3ecd034e8e1..7c966554202 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -551,8 +551,7 @@ def get_item_tax_info( args = { "company": company, "tax_category": tax_category, - "net_rate": item_rates.get(item_code[1]), - "doctype": doctype, + "base_net_rate": item_rates.get(item_code[1]), } if item_tax_templates: @@ -655,7 +654,7 @@ def is_within_valid_range(args, tax): if not flt(tax.maximum_net_rate): # No range specified, just ignore return True - elif flt(tax.minimum_net_rate) <= flt(args.get("net_rate")) <= flt(tax.maximum_net_rate): + elif flt(tax.minimum_net_rate) <= flt(args.get("base_net_rate")) <= flt(tax.maximum_net_rate): return True return False -- GitLab From 71f5a7c4352cc80d3afc7fb5e3e4993e7938c1b8 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Thu, 1 Feb 2024 12:33:20 +0000 Subject: [PATCH 2/2] fix: merge conflict --- erpnext/stock/get_item_details.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 7c966554202..b6cb90765c2 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -552,6 +552,7 @@ def get_item_tax_info( "company": company, "tax_category": tax_category, "base_net_rate": item_rates.get(item_code[1]), + "doctype": doctype, } if item_tax_templates: -- GitLab