[FIX] Account filter on general ledger wizard
This commit both improves perfs by doing a single search() instead of search() + filtered and also make account selection by interval really work.
This commit is contained in:
@@ -103,13 +103,10 @@ class GeneralLedgerReportWizard(models.TransientModel):
|
||||
):
|
||||
start_range = int(self.account_code_from.code)
|
||||
end_range = int(self.account_code_to.code)
|
||||
self.account_ids = self.env["account.account"].search(
|
||||
[("code", ">=", start_range), ("code", "<=", end_range)]
|
||||
)
|
||||
domain = [("code", ">=", start_range), ("code", "<=", end_range)]
|
||||
if self.company_id:
|
||||
self.account_ids = self.account_ids.filtered(
|
||||
lambda a: self.company_id in a.company_ids
|
||||
)
|
||||
domain.append(("company_ids", "in", self.company_id.ids))
|
||||
self.account_ids = self.env["account.account"].search(domain)
|
||||
|
||||
def _init_date_from(self):
|
||||
"""set start date to begin of current year if fiscal year running"""
|
||||
|
||||
Reference in New Issue
Block a user