diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index c3935029670..5bf15ac325b 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -35,7 +35,10 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying. this.frm.set_query("expense_account", "items", function () { return { query: "erpnext.controllers.queries.get_expense_account", - filters: { company: doc.company }, + filters: { + company: doc.company, + disabled: 0, + }, }; }); } diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py index b4610337ceb..17141751ca1 100644 --- a/erpnext/controllers/queries.py +++ b/erpnext/controllers/queries.py @@ -701,7 +701,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters): where (tabAccount.report_type = "Profit and Loss" or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary", "Asset Received But Not Billed", "Capital Work in Progress")) and tabAccount.is_group=0 - and tabAccount.docstatus!=2 + and tabAccount.disabled = 0 and tabAccount.{searchfield} LIKE %(txt)s {condition} {get_match_cond(doctype)}""", {"company": filters.get("company", ""), "txt": "%" + txt + "%"},