fix(Employee Advance): Return/Deduction from Salary button visibility (#31011)

This commit is contained in:
Rucha Mahabal 2022-05-13 20:01:14 +05:30 committed by GitHub
parent 86df7f835a
commit 3016ed958e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,9 +65,10 @@ frappe.ui.form.on('Employee Advance', {
); );
} }
if (frm.doc.docstatus === 1 && if (
(flt(frm.doc.claimed_amount) < flt(frm.doc.paid_amount) && flt(frm.doc.paid_amount) != flt(frm.doc.return_amount))) { frm.doc.docstatus === 1
&& (flt(frm.doc.claimed_amount) < flt(frm.doc.paid_amount) - flt(frm.doc.return_amount))
) {
if (frm.doc.repay_unclaimed_amount_from_salary == 0 && frappe.model.can_create("Journal Entry")) { if (frm.doc.repay_unclaimed_amount_from_salary == 0 && frappe.model.can_create("Journal Entry")) {
frm.add_custom_button(__("Return"), function() { frm.add_custom_button(__("Return"), function() {
frm.trigger('make_return_entry'); frm.trigger('make_return_entry');