fix(Employee Advance): check if return amount is set before validating (#36080)

This commit is contained in:
Rucha Mahabal
2023-07-11 14:12:21 +05:30
committed by GitHub
parent 9c3ec41803
commit beaf13e00e

View File

@@ -108,8 +108,8 @@ class EmployeeAdvance(Document):
EmployeeAdvanceOverPayment,
)
if flt(return_amount) > self.paid_amount - self.claimed_amount:
frappe.throw(_("Return amount cannot be greater unclaimed amount"))
if flt(return_amount) > 0 and flt(return_amount) > (self.paid_amount - self.claimed_amount):
frappe.throw(_("Return amount cannot be greater than unclaimed amount"))
self.db_set("paid_amount", paid_amount)
self.db_set("return_amount", return_amount)