mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-16 05:15:10 +00:00
fix: add condition to fetch active accounts
(cherry picked from commit 7c8dd86a35)
This commit is contained in:
@@ -31,7 +31,6 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
|
|||||||
query: "erpnext.controllers.queries.get_expense_account",
|
query: "erpnext.controllers.queries.get_expense_account",
|
||||||
filters: {
|
filters: {
|
||||||
company: doc.company,
|
company: doc.company,
|
||||||
disabled: 0,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -640,14 +640,13 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
condition = ""
|
condition = ""
|
||||||
if filters.get("company"):
|
if filters.get("company"):
|
||||||
condition += "and tabAccount.company = %(company)s"
|
condition += "and tabAccount.company = %(company)s"
|
||||||
condition += f"and tabAccount.disabled = {filters.get('disabled', 0)}"
|
|
||||||
|
|
||||||
return frappe.db.sql(
|
return frappe.db.sql(
|
||||||
f"""select tabAccount.name from `tabAccount`
|
f"""select tabAccount.name from `tabAccount`
|
||||||
where (tabAccount.report_type = "Profit and Loss"
|
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"))
|
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.is_group=0
|
||||||
and tabAccount.docstatus!=2
|
and tabAccount.disabled = 0
|
||||||
and tabAccount.{searchfield} LIKE %(txt)s
|
and tabAccount.{searchfield} LIKE %(txt)s
|
||||||
{condition} {get_match_cond(doctype)}""",
|
{condition} {get_match_cond(doctype)}""",
|
||||||
{"company": filters.get("company", ""), "txt": "%" + txt + "%"},
|
{"company": filters.get("company", ""), "txt": "%" + txt + "%"},
|
||||||
|
|||||||
Reference in New Issue
Block a user