From ab9852d31ac27623ed5627ea85a30613569b1534 Mon Sep 17 00:00:00 2001 From: Zlash65 Date: Thu, 1 Nov 2018 11:39:55 +0530 Subject: [PATCH] tds not calculated appropriately --- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index b14597d3a0..83698f887c 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -61,11 +61,11 @@ class PurchaseInvoice(BuyingController): self.validate_posting_time() + super(PurchaseInvoice, self).validate() + # apply tax withholding only if checked and applicable self.set_tax_withholding() - super(PurchaseInvoice, self).validate() - if not self.is_return: self.po_required() self.pr_required() @@ -839,6 +839,9 @@ class PurchaseInvoice(BuyingController): if not accounts or tax_withholding_details.get("account_head") not in accounts: self.append("taxes", tax_withholding_details) + # calculate totals again after applying TDS + self.calculate_taxes_and_totals() + @frappe.whitelist() def make_debit_note(source_name, target_doc=None): from erpnext.controllers.sales_and_purchase_return import make_return_doc