fix: asset validation misfire on debit notes

(cherry picked from commit 097b9892dc)
This commit is contained in:
ruthra kumar
2023-09-15 17:54:20 +05:30
committed by Mergify
parent f2395a9297
commit b33db6c79a

View File

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