[tax-breakup] store itemized tax by item_name when can
This commit is contained in:
parent
b9399d8781
commit
ea7533fa75
@ -600,15 +600,18 @@ def get_itemised_tax(taxes):
|
|||||||
for item_code, tax_data in item_tax_map.items():
|
for item_code, tax_data in item_tax_map.items():
|
||||||
itemised_tax.setdefault(item_code, frappe._dict())
|
itemised_tax.setdefault(item_code, frappe._dict())
|
||||||
|
|
||||||
|
tax_rate = 0.0
|
||||||
|
tax_amount = 0.0
|
||||||
|
|
||||||
if isinstance(tax_data, list):
|
if isinstance(tax_data, list):
|
||||||
itemised_tax[item_code][tax.description] = frappe._dict(dict(
|
tax_rate = flt(tax_data[0])
|
||||||
tax_rate=flt(tax_data[0]),
|
tax_amount = flt(tax_data[1])
|
||||||
tax_amount=flt(tax_data[1])
|
|
||||||
))
|
|
||||||
else:
|
else:
|
||||||
|
tax_rate = flt(tax_data)
|
||||||
|
|
||||||
itemised_tax[item_code][tax.description] = frappe._dict(dict(
|
itemised_tax[item_code][tax.description] = frappe._dict(dict(
|
||||||
tax_rate=flt(tax_data),
|
tax_rate = tax_rate,
|
||||||
tax_amount=0.0
|
tax_amount = tax_amount
|
||||||
))
|
))
|
||||||
|
|
||||||
return itemised_tax
|
return itemised_tax
|
||||||
|
@ -338,12 +338,18 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
|||||||
|
|
||||||
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
set_item_wise_tax: function(item, tax, tax_rate, current_tax_amount) {
|
||||||
// store tax breakup for each item
|
// store tax breakup for each item
|
||||||
var key = item.item_code || item.item_name;
|
let tax_detail = tax.item_wise_tax_detail;
|
||||||
var item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate;
|
|
||||||
if (tax.item_wise_tax_detail && tax.item_wise_tax_detail[key])
|
|
||||||
item_wise_tax_amount += tax.item_wise_tax_detail[key][1];
|
|
||||||
|
|
||||||
tax.item_wise_tax_detail[key] = [tax_rate, flt(item_wise_tax_amount, precision("base_tax_amount", tax))];
|
let key = item.item_code;
|
||||||
|
if(item.item_name && !Object.keys(tax_detail).includes(item.item_name)) {
|
||||||
|
key = item.item_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
let item_wise_tax_amount = current_tax_amount * this.frm.doc.conversion_rate;
|
||||||
|
if (tax_detail && tax_detail[key])
|
||||||
|
item_wise_tax_amount += tax_detail[key][1];
|
||||||
|
|
||||||
|
tax_detail[key] = [tax_rate, flt(item_wise_tax_amount, precision("base_tax_amount", tax))];
|
||||||
},
|
},
|
||||||
|
|
||||||
round_off_totals: function(tax) {
|
round_off_totals: function(tax) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user