chore: Simplify query
This commit is contained in:
parent
7f11373b58
commit
00fe3042b2
@ -233,19 +233,15 @@ class PeriodClosingVoucher(AccountsController):
|
|||||||
if group_by_account:
|
if group_by_account:
|
||||||
qb_dimension_fields.append("account")
|
qb_dimension_fields.append("account")
|
||||||
|
|
||||||
account = frappe.qb.DocType("Account")
|
account_filters = {
|
||||||
accounts_query = (
|
"company": self.company,
|
||||||
frappe.qb.from_(account)
|
"is_group": 0,
|
||||||
.select(account.name)
|
}
|
||||||
.where((account.company == self.company) & (account.is_group == 0) & (account.docstatus < 2))
|
|
||||||
)
|
|
||||||
|
|
||||||
if report_type:
|
if report_type:
|
||||||
accounts_query = accounts_query.where(account.report_type == report_type)
|
account_filters.update({"report_type": report_type})
|
||||||
|
|
||||||
accounts = accounts_query.run(as_dict=True)
|
accounts = frappe.get_all("Account", filters=account_filters, pluck="name")
|
||||||
|
|
||||||
accounts = [d.name for d in accounts]
|
|
||||||
|
|
||||||
gl_entry = frappe.qb.DocType("GL Entry")
|
gl_entry = frappe.qb.DocType("GL Entry")
|
||||||
query = frappe.qb.from_(gl_entry).select(gl_entry.account, gl_entry.account_currency)
|
query = frappe.qb.from_(gl_entry).select(gl_entry.account, gl_entry.account_currency)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user