Skip to content

Commit

Permalink
fix: asset validation misfire on debit notes
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Sep 15, 2023
1 parent 85ebaa3 commit 097b989
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 @@ -190,10 +190,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 097b989

Please sign in to comment.