fix: asset validation misfire on debit notes

This commit is contained in:
ruthra kumar 2023-09-15 17:54:20 +05:30
parent 85ebaa3aed
commit 097b9892dc

View File

@ -190,10 +190,13 @@ class BuyingController(SubcontractingController):
purchase_doc_field = (
"purchase_receipt" if self.doctype == "Purchase Receipt" else "purchase_invoice"
)
not_cancelled_asset = [
d.name
for d in frappe.db.get_all("Asset", {purchase_doc_field: self.return_against, "docstatus": 1})
]
not_cancelled_asset = []
if self.return_against:
not_cancelled_asset = [
d.name
for d in frappe.db.get_all("Asset", {purchase_doc_field: self.return_against, "docstatus": 1})
]
if self.is_return and len(not_cancelled_asset):
frappe.throw(
_(