From d820757359ff21fb342867d67ce3f3623a2a5a30 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 9 Aug 2022 18:15:41 +0530 Subject: [PATCH 1/2] fix: Payment Entry button is visible even when claim is fully paid --- erpnext/hr/doctype/expense_claim/expense_claim.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js index af80b63845e..f44611368ad 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.js +++ b/erpnext/hr/doctype/expense_claim/expense_claim.js @@ -254,9 +254,11 @@ frappe.ui.form.on("Expense Claim", { }, __("View")); } - if (frm.doc.docstatus===1 && !cint(frm.doc.is_paid) && cint(frm.doc.grand_total) > 0 - && (cint(frm.doc.total_amount_reimbursed) < cint(frm.doc.total_sanctioned_amount)) - && frappe.model.can_create("Payment Entry")) { + if ( + frm.doc.docstatus === 1 + && frm.doc.status !== "Paid" + && frappe.model.can_create("Payment Entry") + ) { frm.add_custom_button(__('Payment'), function() { frm.events.make_payment_entry(frm); }, __('Create')); } From 63cd4349a6efeb42eab2afcc4a897d9a202bd8b6 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Tue, 9 Aug 2022 18:28:19 +0530 Subject: [PATCH 2/2] fix: consider precision while validating advance amount against sanctioned amount --- erpnext/hr/doctype/expense_claim/expense_claim.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.py b/erpnext/hr/doctype/expense_claim/expense_claim.py index 0645bd1f937..43bbede6804 100644 --- a/erpnext/hr/doctype/expense_claim/expense_claim.py +++ b/erpnext/hr/doctype/expense_claim/expense_claim.py @@ -305,8 +305,9 @@ class ExpenseClaim(AccountsController): if self.total_advance_amount: precision = self.precision("total_advance_amount") - amount_with_taxes = flt(self.total_sanctioned_amount, precision) + flt( - self.total_taxes_and_charges, precision + amount_with_taxes = flt( + (flt(self.total_sanctioned_amount, precision) + flt(self.total_taxes_and_charges, precision)), + precision, ) if flt(self.total_advance_amount, precision) > amount_with_taxes: