Skip to content

Commit

Permalink
fix: Issues while cancel/amending Purchase Invoice with TDS enabled
Browse files Browse the repository at this point in the history
(cherry picked from commit f7c9258)

# Conflicts:
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
  • Loading branch information
deepeshgarg007 authored and mergify[bot] committed Nov 1, 2022
1 parent a9660bf commit 8888957
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
Expand Up @@ -67,6 +67,9 @@ def onload(self):
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 = ""
Expand Down Expand Up @@ -1373,7 +1376,12 @@ def on_cancel(self):
"GL Entry",
"Stock Ledger Entry",
"Repost Item Valuation",
<<<<<<< HEAD
"Purchase Invoice",
=======
"Payment Ledger Entry",
"Tax Withheld Vouchers",
>>>>>>> f7c9258770 (fix: Issues while cancel/amending Purchase Invoice with TDS enabled)
)

self.update_advance_tax_references(cancel=1)
Expand Down

0 comments on commit 8888957

Please sign in to comment.