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