From 1af093f6b03a84b6271159e6aeaa6c31e98dbd0f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Sat, 2 Feb 2013 22:33:26 +0530 Subject: [PATCH] fixes in purchase invoice gl entry --- accounts/doctype/purchase_invoice/purchase_invoice.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py index 9ce939c79f..5f7e848a53 100644 --- a/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -436,13 +436,15 @@ class DocType(BuyingController): # tax table gl entries for tax in getlist(self.doclist, "purchase_tax_details"): if tax.category in ("Total", "Valuation and Total") and flt(tax.tax_amount): - valuation_tax += flt(tax.tax_amount) + valuation_tax += tax.add_deduct_tax == "Add" \ + and flt(tax.tax_amount) or -1 * flt(tax.tax_amount) gl_entries.append( self.get_gl_dict({ "account": tax.account_head, "against": self.doc.credit_to, - "debit": tax.tax_amount, + "debit": tax.add_deduct_tax == "Add" and tax.tax_amount or 0, + "credit": tax.add_deduct_tax == "Deduct" and tax.tax_amount or 0, "remarks": self.doc.remarks, "cost_center": tax.cost_center }, is_cancel)