fix: Expense claim paid through employee advance getting fetched as outstanding in Payment Entry (#19427)
* fix: Expense claim paid through employee advance getting fetched as outstanding in Payment Entry * fix: Codacy * fix: Minor UX fixes * fix: Also credit payable amount in case of advance payment * fix: Against voucher in GL enrty
This commit is contained in:
parent
2689acfc8e
commit
3cc3b57926
@ -554,7 +554,7 @@ frappe.ui.form.on('Payment Entry', {
|
||||
frappe.flags.allocate_payment_amount = true;
|
||||
frm.events.validate_filters_data(frm, filters);
|
||||
frm.events.get_outstanding_documents(frm, filters);
|
||||
}, __("Filters"), __("Get Outstanding Invoices"));
|
||||
}, __("Filters"), __("Get Outstanding Documents"));
|
||||
},
|
||||
|
||||
validate_filters_data: function(frm, filters) {
|
||||
|
||||
@ -21,7 +21,7 @@ def get_data():
|
||||
},
|
||||
{
|
||||
'label': _('Expense'),
|
||||
'items': ['Expense Claim', 'Travel Request']
|
||||
'items': ['Expense Claim', 'Travel Request', 'Employee Advance']
|
||||
},
|
||||
{
|
||||
'label': _('Benefit'),
|
||||
|
||||
@ -262,7 +262,8 @@
|
||||
"fieldname": "payable_account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Payable Account",
|
||||
"options": "Account"
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "cost_center",
|
||||
@ -365,7 +366,7 @@
|
||||
"icon": "fa fa-money",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2019-06-26 18:05:52.530462",
|
||||
"modified": "2019-11-08 14:13:08.964547",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Expense Claim",
|
||||
@ -432,4 +433,4 @@
|
||||
"sort_order": "DESC",
|
||||
"timeline_field": "employee",
|
||||
"title_field": "title"
|
||||
}
|
||||
}
|
||||
@ -144,6 +144,33 @@ class ExpenseClaim(AccountsController):
|
||||
"against_voucher": self.name
|
||||
})
|
||||
)
|
||||
|
||||
gl_entry.append(
|
||||
self.get_gl_dict({
|
||||
"account": data.advance_account,
|
||||
"debit": data.allocated_amount,
|
||||
"debit_in_account_currency": data.allocated_amount,
|
||||
"against": self.payable_account,
|
||||
"party_type": "Employee",
|
||||
"party": self.employee,
|
||||
"against_voucher_type": self.doctype,
|
||||
"against_voucher": self.name
|
||||
})
|
||||
)
|
||||
|
||||
gl_entry.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.payable_account,
|
||||
"credit": data.allocated_amount,
|
||||
"credit_in_account_currency": data.allocated_amount,
|
||||
"against": data.advance_account,
|
||||
"party_type": "Employee",
|
||||
"party": self.employee,
|
||||
"against_voucher_type": "Employee Advance",
|
||||
"against_voucher": data.employee_advance
|
||||
})
|
||||
)
|
||||
|
||||
self.add_tax_gl_entries(gl_entry)
|
||||
|
||||
if self.is_paid and self.grand_total:
|
||||
@ -192,9 +219,6 @@ class ExpenseClaim(AccountsController):
|
||||
if not self.cost_center:
|
||||
frappe.throw(_("Cost center is required to book an expense claim"))
|
||||
|
||||
if not self.payable_account:
|
||||
frappe.throw(_("Please set default payable account for the company {0}").format(getlink("Company",self.company)))
|
||||
|
||||
if self.is_paid:
|
||||
if not self.mode_of_payment:
|
||||
frappe.throw(_("Mode of payment is required to make a payment").format(self.employee))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user