Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: exclude advances scheduled for deduction when adjusting them aga… #2388

Closed
wants to merge 11 commits into from
1 change: 1 addition & 0 deletions hrms/hr/doctype/employee_advance/employee_advance.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ frappe.ui.form.on("Employee Advance", {
posting_date: frm.doc.posting_date,
paid_amount: frm.doc.paid_amount,
claimed_amount: frm.doc.claimed_amount,
returned_amount: frm.doc.return_amount,
},
callback: function (r) {
const doclist = frappe.model.sync(r.message);
Expand Down
3 changes: 2 additions & 1 deletion hrms/hr/doctype/expense_claim/expense_claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ frappe.ui.form.on("Expense Claim", {
row.posting_date = d.posting_date;
row.advance_account = d.advance_account;
row.advance_paid = d.paid_amount;
row.unclaimed_amount = flt(d.paid_amount) - flt(d.claimed_amount);
row.unclaimed_amount =
flt(d.paid_amount) - flt(d.claimed_amount) - flt(d.return_amount);
row.allocated_amount = 0;
});
refresh_field("advances");
Expand Down
5 changes: 3 additions & 2 deletions hrms/hr/doctype/expense_claim/expense_claim.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ def get_advances(employee, advance_id=None):
advance.posting_date,
advance.paid_amount,
advance.claimed_amount,
advance.return_amount,
advance.advance_account,
)

Expand All @@ -515,7 +516,7 @@ def get_advances(employee, advance_id=None):

@frappe.whitelist()
def get_expense_claim(
employee_name, company, employee_advance_name, posting_date, paid_amount, claimed_amount
employee_name, company, employee_advance_name, posting_date, paid_amount, claimed_amount, returned_amount
):
default_payable_account = frappe.get_cached_value(
"Company", company, "default_expense_claim_payable_account"
Expand All @@ -534,7 +535,7 @@ def get_expense_claim(
"employee_advance": employee_advance_name,
"posting_date": posting_date,
"advance_paid": flt(paid_amount),
"unclaimed_amount": flt(paid_amount) - flt(claimed_amount),
"unclaimed_amount": flt(paid_amount) - flt(claimed_amount) - flt(returned_amount),
"allocated_amount": flt(paid_amount) - flt(claimed_amount),
},
)
Expand Down
Loading