Merge pull request #30343 from deepeshgarg007/item_tax_template_bug

fix: Taxes not getting fetched from item tax template
This commit is contained in:
Deepesh Garg
2022-03-23 22:02:17 +05:30
committed by GitHub
2 changed files with 20 additions and 20 deletions

View File

@@ -278,26 +278,6 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
}
},
add_taxes_from_item_tax_template: function(item_tax_map) {
let me = this;
if (item_tax_map && cint(frappe.defaults.get_default("add_taxes_from_item_tax_template"))) {
if (typeof (item_tax_map) == "string") {
item_tax_map = JSON.parse(item_tax_map);
}
$.each(item_tax_map, function(tax, rate) {
let found = (me.frm.doc.taxes || []).find(d => d.account_head === tax);
if (!found) {
let child = frappe.model.add_child(me.frm.doc, "taxes");
child.charge_type = "On Net Total";
child.account_head = tax;
child.rate = 0;
}
});
}
},
calculate_taxes: function() {
var me = this;
this.frm.doc.rounding_adjustment = 0;

View File

@@ -736,6 +736,26 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
});
},
add_taxes_from_item_tax_template: function(item_tax_map) {
let me = this;
if (item_tax_map && cint(frappe.defaults.get_default("add_taxes_from_item_tax_template"))) {
if (typeof (item_tax_map) == "string") {
item_tax_map = JSON.parse(item_tax_map);
}
$.each(item_tax_map, function(tax, rate) {
let found = (me.frm.doc.taxes || []).find(d => d.account_head === tax);
if (!found) {
let child = frappe.model.add_child(me.frm.doc, "taxes");
child.charge_type = "On Net Total";
child.account_head = tax;
child.rate = 0;
}
});
}
},
serial_no: function(doc, cdt, cdn) {
var me = this;
var item = frappe.get_doc(cdt, cdn);