Merge pull request #32803 from frappe/mergify/bp/version-13-hotfix/pr-32801

fix: Issues while cancel/amending Purchase Invoice with TDS enabled (backport #32801)
This commit is contained in:
Deepesh Garg
2022-11-01 22:11:26 +05:30
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -569,6 +569,10 @@ frappe.ui.form.on("Purchase Invoice", {
erpnext.queries.setup_queries(frm, "Warehouse", function() {
return erpnext.queries.warehouse(frm.doc);
});
if (frm.is_new()) {
frm.clear_table("tax_withheld_vouchers");
}
},
is_subcontracted: function(frm) {

View File

@@ -67,6 +67,9 @@ class PurchaseInvoice(BuyingController):
supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")
self.set_onload("supplier_tds", supplier_tds)
if self.is_new():
self.set("tax_withheld_vouchers", [])
def before_save(self):
if not self.on_hold:
self.release_date = ""
@@ -1373,7 +1376,7 @@ class PurchaseInvoice(BuyingController):
"GL Entry",
"Stock Ledger Entry",
"Repost Item Valuation",
"Purchase Invoice",
"Tax Withheld Vouchers",
)
self.update_advance_tax_references(cancel=1)