[buying] [fix] store item tax amount only if field exists
This commit is contained in:
parent
12cea9587f
commit
b392878f15
@ -309,6 +309,12 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
delete item["rate"];
|
delete item["rate"];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!wn.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) {
|
||||||
|
$.each(this.frm.item_doclist, function(i, item) {
|
||||||
|
delete item["item_tax_amount"];
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
calculate_outstanding_amount: function() {
|
calculate_outstanding_amount: function() {
|
||||||
@ -326,9 +332,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
// stored for valuation
|
// stored for valuation
|
||||||
//
|
//
|
||||||
// TODO: rename item_tax_amount to valuation_tax_amount
|
// TODO: rename item_tax_amount to valuation_tax_amount
|
||||||
if(["Valuation", "Valuation and Total"].indexOf(tax.category) != -1) {
|
if(["Valuation", "Valuation and Total"].indexOf(tax.category) != -1 &&
|
||||||
// accumulate only if tax is for Valuation / Valuation and Total
|
wn.meta.get_docfield(item.doctype, "item_tax_amount", item.parent || item.name)) {
|
||||||
item.item_tax_amount += flt(current_tax_amount, precision("item_tax_amount", item));
|
// accumulate only if tax is for Valuation / Valuation and Total
|
||||||
|
item.item_tax_amount += flt(current_tax_amount, precision("item_tax_amount", item));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class BuyingController(StockController):
|
|||||||
for item in self.item_doclist:
|
for item in self.item_doclist:
|
||||||
item.purchase_rate = item.rate
|
item.purchase_rate = item.rate
|
||||||
del item.fields["rate"]
|
del item.fields["rate"]
|
||||||
|
|
||||||
if not self.meta.get_field("item_tax_amount", parentfield=self.fname):
|
if not self.meta.get_field("item_tax_amount", parentfield=self.fname):
|
||||||
for item in self.item_doclist:
|
for item in self.item_doclist:
|
||||||
del item.fields["item_tax_amount"]
|
del item.fields["item_tax_amount"]
|
||||||
@ -179,8 +179,9 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
TODO: rename item_tax_amount to valuation_tax_amount
|
TODO: rename item_tax_amount to valuation_tax_amount
|
||||||
"""
|
"""
|
||||||
if tax.category in ["Valuation", "Valuation and Total"]:
|
if tax.category in ["Valuation", "Valuation and Total"] and \
|
||||||
item.item_tax_amount += flt(current_tax_amount, self.precision("item_tax_amount", item))
|
self.meta.get_field("item_tax_amount", parentfield=self.fname):
|
||||||
|
item.item_tax_amount += flt(current_tax_amount, self.precision("item_tax_amount", item))
|
||||||
|
|
||||||
# update valuation rate
|
# update valuation rate
|
||||||
def update_valuation_rate(self, parentfield):
|
def update_valuation_rate(self, parentfield):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user