From 2bc27849fb1b704a94f7ef966ca8ca25564e6e82 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 30 Jun 2023 12:35:13 +0530 Subject: [PATCH] fix: Expense Account filter in Sales Invoice --- .../accounts/doctype/sales_invoice/sales_invoice.js | 13 ------------- erpnext/public/js/controllers/transaction.js | 4 +++- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 68407e02210f..8753ebc3baf0 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -674,19 +674,6 @@ frappe.ui.form.on('Sales Invoice', { } } - // expense account - frm.fields_dict['items'].grid.get_field('expense_account').get_query = function(doc) { - if (erpnext.is_perpetual_inventory_enabled(doc.company)) { - return { - filters: { - 'report_type': 'Profit and Loss', - 'company': doc.company, - "is_group": 0 - } - } - } - } - // discount account frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) { return { diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 0d92683f2173..543d0e979081 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -193,7 +193,9 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe this.frm.set_query("expense_account", "items", function(doc) { return { filters: { - "company": doc.company + "company": doc.company, + "report_type": "Profit and Loss", + "is_group": 0 } }; });