Skip to content

Commit

Permalink
V14 pre process validation (#113)
Browse files Browse the repository at this point in the history
* feat: check payment entries for cancelled or paid invoices before submitting

* fix: add expense calim to pre-process validation
  • Loading branch information
agritheory authored Jun 11, 2023
1 parent adbca4d commit 232beb7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions check_run/check_run/doctype/check_run/check_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ def not_outstanding_or_cancelled(self, transaction):
)
if outstanding_based_on_gle and not outstanding_based_on_gle[0].outstanding_amount:
return True
elif transaction["doctype"] == "Expense Claim":
ec = frappe.get_value(
transaction["doctype"],
filters,
["grand_total", "total_amount_reimbursed"],
as_dict=True,
)
if ec.grand_total <= ec.total_amount_reimbursed:
return True
else:
if frappe.get_value(transaction["doctype"], filters, "outstanding_amount") == 0.0:
return True
Expand Down

0 comments on commit 232beb7

Please sign in to comment.