Skip to content

Commit

Permalink
fix: fetch/change tax template on basis of base_net_rate instead of n…
Browse files Browse the repository at this point in the history
…et_rate (#39448)

fix: change tax template on basis of base_net_rate instead of net_rate

Co-authored-by: Deepesh Garg <deepeshgarg6@gmail.com>
  • Loading branch information
divyam-mistry and deepeshgarg007 authored Feb 1, 2024
1 parent 518b06c commit e9fe10c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions erpnext/controllers/taxes_and_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def validate_item_tax_template(self):
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"),
Expand Down
3 changes: 2 additions & 1 deletion erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,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,
Expand Down Expand Up @@ -1902,7 +1903,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;
}
});
Expand Down
4 changes: 2 additions & 2 deletions erpnext/stock/get_item_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ def get_item_tax_info(company, tax_category, item_codes, item_rates=None, item_t
args = {
"company": company,
"tax_category": tax_category,
"net_rate": item_rates.get(item_code[1]),
"base_net_rate": item_rates.get(item_code[1]),
}

if item_tax_templates:
Expand Down Expand Up @@ -635,7 +635,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
Expand Down

0 comments on commit e9fe10c

Please sign in to comment.