From 257e13c2997a0d2fc7682ae9b7b5feca837a63dc Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 5 Sep 2024 16:12:52 +0530 Subject: [PATCH] refactor: filter to toggle employee advance scenario in AP --- .../accounts/report/accounts_payable/accounts_payable.js | 5 +++++ .../report/accounts_receivable/accounts_receivable.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.js b/erpnext/accounts/report/accounts_payable/accounts_payable.js index f5402240aa4..d4ad43b78e7 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.js +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.js @@ -162,6 +162,11 @@ frappe.query_reports["Accounts Payable"] = { label: __("Group by Voucher"), fieldtype: "Check", }, + { + fieldname: "handle_employee_advances", + label: __("Handle Employee Advances"), + fieldtype: "Check", + }, ], formatter: function (value, row, column, data, default_formatter) { diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 1c4c8659792..19c6df3e702 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -214,7 +214,11 @@ class ReceivablePayableReport: # Build and use a separate row for Employee Advances. # This allows Payments or Journals made against Emp Advance to be processed. - if not row and ple.against_voucher_type == "Employee Advance": + if ( + not row + and ple.against_voucher_type == "Employee Advance" + and self.filters.handle_employee_advances + ): _d = self.build_voucher_dict(ple) _d.voucher_type = ple.against_voucher_type _d.voucher_no = ple.against_voucher_no