From f7731b0715a4b7ba07cc216998e9984f84c9f0ff Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 8 Sep 2020 13:41:04 +0530 Subject: [PATCH] fix: TDS applicable on creating PI from get items button --- .../accounts/doctype/purchase_invoice/purchase_invoice.js | 2 ++ .../accounts/doctype/purchase_invoice/purchase_invoice.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index b5c1cd7e1e..2bfa4a572e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -141,6 +141,8 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({ } }); } + + this.frm.set_df_property("tax_withholding_category", "hidden", doc.apply_tds ? 0 : 1); }, unblock_invoice: function() { diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 7b1062f654..b4ee7c999e 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -132,6 +132,11 @@ class PurchaseInvoice(BuyingController): if not self.due_date: self.due_date = get_due_date(self.posting_date, "Supplier", self.supplier, self.company, self.bill_date) + tds_category = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category") + if tds_category and not for_validate: + self.apply_tds = 1 + self.tax_withholding_category = tds_category + super(PurchaseInvoice, self).set_missing_values(for_validate) def check_conversion_rate(self):