fix(purchase invoice): filter only enabled account

(cherry picked from commit c3111db6e2)
This commit is contained in:
mithili
2025-07-28 17:10:46 +05:30
committed by Mergify
parent 9d0034f0a4
commit e0d9a47ff7
2 changed files with 5 additions and 1 deletions

View File

@@ -29,7 +29,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,
},
};
});
}

View File

@@ -640,6 +640,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
condition = ""
if filters.get("company"):
condition += "and tabAccount.company = %(company)s"
condition += f"and tabAccount.disabled = {filters.get('disabled', 0)}"
return frappe.db.sql(
f"""select tabAccount.name from `tabAccount`