Skip to content

Commit

Permalink
fix: resolved issue Getting an error while creating a purchase invoice
Browse files Browse the repository at this point in the history
  • Loading branch information
ksagar8848 committed Jan 16, 2025
1 parent 4ef7678 commit 6f5d403
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions erpnext/accounts/doctype/gl_closing/gl_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def validate_account_link_or_child_table(doc, method):
if account_value:
if is_account_closed(merged_data, account_value):
frappe.throw(f"The account {account_value} is closed and cannot be used in this {doc.doctype}")
else:
frappe.throw(f"{field.label} is required")

elif field.fieldtype == "Table":
table_data = doc.get(field.fieldname)
if table_data:
Expand All @@ -79,8 +78,7 @@ def validate_child_table(child_doc, merged_data):
if account_value:
if is_account_closed(merged_data, account_value):
frappe.throw(f"The account {account_value} is closed and cannot be used in this {child_doc.doctype}")
else:
frappe.throw(f"{field.label} in child table is required")

def is_account_closed(merged_data, account_value):
for record in merged_data:
if record.get("account") == account_value and record.get("closed") == 1:
Expand Down

0 comments on commit 6f5d403

Please sign in to comment.