Skip to content

Commit

Permalink
[IMP] account_financial_report: general ledger account range
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyOliveira98 committed May 7, 2024
1 parent 7389d16 commit 18cfd33
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions account_financial_report/wizard/general_ledger_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,18 @@ def _get_account_move_lines_domain(self):

@api.onchange("account_code_from", "account_code_to")
def on_change_account_range(self):
if (
self.account_code_from
and self.account_code_from.code.isdigit()
and self.account_code_to
and self.account_code_to.code.isdigit()
):
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)]
)
if self.account_code_from and self.account_code_to:
start_range = self.account_code_from.code
end_range = self.account_code_to.code

Check warning on line 109 in account_financial_report/wizard/general_ledger_wizard.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/wizard/general_ledger_wizard.py#L108-L109

Added lines #L108 - L109 were not covered by tests

accounts = self.env["account.account"].search([])

Check warning on line 111 in account_financial_report/wizard/general_ledger_wizard.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/wizard/general_ledger_wizard.py#L111

Added line #L111 was not covered by tests
account_codes = [account.code for account in accounts]

start_index = account_codes.index(start_range)
end_index = account_codes.index(end_range)

Check warning on line 115 in account_financial_report/wizard/general_ledger_wizard.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/wizard/general_ledger_wizard.py#L114-L115

Added lines #L114 - L115 were not covered by tests

self.account_ids = accounts[start_index : end_index + 1]

Check warning on line 117 in account_financial_report/wizard/general_ledger_wizard.py

View check run for this annotation

Codecov / codecov/patch

account_financial_report/wizard/general_ledger_wizard.py#L117

Added line #L117 was not covered by tests

if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_id == self.company_id
Expand Down

0 comments on commit 18cfd33

Please sign in to comment.