[fix] [minor] Taxes and charges added/deducted only if category in "Valuation and Total" or "Total"

This commit is contained in:
Nabin Hait 2013-09-02 18:07:53 +05:30
parent 1f16630360
commit 2e131e26d4

View File

@ -333,10 +333,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
// other charges added/deducted
if(tax_count) {
this.frm.doc.other_charges_added = wn.utils.sum($.map(this.frm.tax_doclist,
function(tax) { return tax.add_deduct_tax == "Add" ? tax.tax_amount : 0.0; }));
function(tax) { return (tax.add_deduct_tax == "Add" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; }));
this.frm.doc.other_charges_deducted = wn.utils.sum($.map(this.frm.tax_doclist,
function(tax) { return tax.add_deduct_tax == "Deduct" ? tax.tax_amount : 0.0; }));
function(tax) { return (tax.add_deduct_tax == "Deduct" && in_list(["Valuation and Total", "Total"], tax.category)) ? tax.tax_amount : 0.0; }));
wn.model.round_floats_in(this.frm.doc, ["other_charges_added", "other_charges_deducted"]);