fix: payment reconciliation against expense claim (#17729)
* fix: payment reconciliation against expense claim
* feat: Added dashboard for expense claim
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 00100ef..7c9e9b8 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -333,6 +333,9 @@
doc = frappe.get_doc(d.voucher_type, d.voucher_no)
doc.make_gl_entries(cancel = 0, adv_adj =1)
+ if d.voucher_type in ('Payment Entry', 'Journal Entry'):
+ doc.update_expense_claim()
+
def check_if_advance_entry_modified(args):
"""
check if there is already a voucher reference
diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py
index 0672b2d..314d0c8 100644
--- a/erpnext/controllers/accounts_controller.py
+++ b/erpnext/controllers/accounts_controller.py
@@ -355,7 +355,7 @@
'fiscal_year': fiscal_year,
'voucher_type': self.doctype,
'voucher_no': self.name,
- 'remarks': self.get("remarks"),
+ 'remarks': self.get("remarks") or self.get("remark"),
'debit': 0,
'credit': 0,
'debit_in_account_currency': 0,
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim.js b/erpnext/hr/doctype/expense_claim/expense_claim.js
index c466ad8..7c6abc7 100644
--- a/erpnext/hr/doctype/expense_claim/expense_claim.js
+++ b/erpnext/hr/doctype/expense_claim/expense_claim.js
@@ -219,7 +219,8 @@
frm.fields_dict["cost_center"].get_query = function() {
return {
filters: {
- "company": frm.doc.company
+ "company": frm.doc.company,
+ "is_group": 0
}
};
};
@@ -230,7 +231,9 @@
return {
filters: {
"report_type": "Balance Sheet",
- "account_type": "Payable"
+ "account_type": "Payable",
+ "company": frm.doc.company,
+ "is_group": 0
}
};
};
diff --git a/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
new file mode 100644
index 0000000..7de8f4f
--- /dev/null
+++ b/erpnext/hr/doctype/expense_claim/expense_claim_dashboard.py
@@ -0,0 +1,20 @@
+from __future__ import unicode_literals
+from frappe import _
+
+def get_data():
+ return {
+ 'fieldname': 'reference_name',
+ 'internal_links': {
+ 'Employee Advance': ['advances', 'employee_advance']
+ },
+ 'transactions': [
+ {
+ 'label': _('Payment'),
+ 'items': ['Payment Entry', 'Journal Entry']
+ },
+ {
+ 'label': _('Reference'),
+ 'items': ['Employee Advance']
+ },
+ ]
+ }
\ No newline at end of file