mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 05:39:12 +00:00
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:
@@ -554,7 +554,7 @@ frappe.ui.form.on('Payment Entry', {
|
|||||||
frappe.flags.allocate_payment_amount = true;
|
frappe.flags.allocate_payment_amount = true;
|
||||||
frm.events.validate_filters_data(frm, filters);
|
frm.events.validate_filters_data(frm, filters);
|
||||||
frm.events.get_outstanding_documents(frm, filters);
|
frm.events.get_outstanding_documents(frm, filters);
|
||||||
}, __("Filters"), __("Get Outstanding Invoices"));
|
}, __("Filters"), __("Get Outstanding Documents"));
|
||||||
},
|
},
|
||||||
|
|
||||||
validate_filters_data: function(frm, filters) {
|
validate_filters_data: function(frm, filters) {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def get_data():
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': _('Expense'),
|
'label': _('Expense'),
|
||||||
'items': ['Expense Claim', 'Travel Request']
|
'items': ['Expense Claim', 'Travel Request', 'Employee Advance']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': _('Benefit'),
|
'label': _('Benefit'),
|
||||||
|
|||||||
@@ -262,7 +262,8 @@
|
|||||||
"fieldname": "payable_account",
|
"fieldname": "payable_account",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Payable Account",
|
"label": "Payable Account",
|
||||||
"options": "Account"
|
"options": "Account",
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "cost_center",
|
"fieldname": "cost_center",
|
||||||
@@ -365,7 +366,7 @@
|
|||||||
"icon": "fa fa-money",
|
"icon": "fa fa-money",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"modified": "2019-06-26 18:05:52.530462",
|
"modified": "2019-11-08 14:13:08.964547",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Expense Claim",
|
"name": "Expense Claim",
|
||||||
|
|||||||
@@ -144,6 +144,33 @@ class ExpenseClaim(AccountsController):
|
|||||||
"against_voucher": self.name
|
"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)
|
self.add_tax_gl_entries(gl_entry)
|
||||||
|
|
||||||
if self.is_paid and self.grand_total:
|
if self.is_paid and self.grand_total:
|
||||||
@@ -192,9 +219,6 @@ class ExpenseClaim(AccountsController):
|
|||||||
if not self.cost_center:
|
if not self.cost_center:
|
||||||
frappe.throw(_("Cost center is required to book an expense claim"))
|
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 self.is_paid:
|
||||||
if not self.mode_of_payment:
|
if not self.mode_of_payment:
|
||||||
frappe.throw(_("Mode of payment is required to make a payment").format(self.employee))
|
frappe.throw(_("Mode of payment is required to make a payment").format(self.employee))
|
||||||
|
|||||||
Reference in New Issue
Block a user