From 1503fa9cad5e7e0a74614a2dcd63eea1797024cc Mon Sep 17 00:00:00 2001 From: Tyler Matteson Date: Sun, 11 Jun 2023 12:41:31 -0400 Subject: [PATCH] fix: add check for expense claim in pre-process validation (#112) --- check_run/check_run/doctype/check_run/check_run.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/check_run/check_run/doctype/check_run/check_run.py b/check_run/check_run/doctype/check_run/check_run.py index d1a02252..f5957138 100644 --- a/check_run/check_run/doctype/check_run/check_run.py +++ b/check_run/check_run/doctype/check_run/check_run.py @@ -150,6 +150,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