Skip to content

Commit

Permalink
fix: asset validation misfire on debit notes
Browse files Browse the repository at this point in the history
(cherry picked from commit 097b989)
  • Loading branch information
ruthra-kumar authored and mergify[bot] committed Sep 15, 2023
1 parent f2395a9 commit b33db6c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions erpnext/controllers/buying_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ def validate_asset_return(self):
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(
_(
Expand Down

0 comments on commit b33db6c

Please sign in to comment.