Skip to content

Commit

Permalink
[FIX] Practical amount should not be computed if Budgetary position h…
Browse files Browse the repository at this point in the history
…as no account
  • Loading branch information
cvinh committed Jun 9, 2023
1 parent 11a69c8 commit 98a81a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion account_budget_oca_analytic_tag/models/account_budget.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _compute_practical_amount(self):
)
result = self.env.cr.fetchone()[0] or 0.0

Check warning on line 31 in account_budget_oca_analytic_tag/models/account_budget.py

View check run for this annotation

Codecov / codecov/patch

account_budget_oca_analytic_tag/models/account_budget.py#L31

Added line #L31 was not covered by tests

else:
elif line.general_budget_id.account_ids:
self.env.cr.execute(

Check warning on line 34 in account_budget_oca_analytic_tag/models/account_budget.py

View check run for this annotation

Codecov / codecov/patch

account_budget_oca_analytic_tag/models/account_budget.py#L33-L34

Added lines #L33 - L34 were not covered by tests
"""
SELECT SUM(credit) - SUM(debit)
Expand All @@ -53,6 +53,8 @@ def _compute_practical_amount(self):
),
)
result = self.env.cr.fetchone()[0]

Check warning on line 55 in account_budget_oca_analytic_tag/models/account_budget.py

View check run for this annotation

Codecov / codecov/patch

account_budget_oca_analytic_tag/models/account_budget.py#L55

Added line #L55 was not covered by tests
else:
result = 0.0
line.practical_amount = result

Check warning on line 58 in account_budget_oca_analytic_tag/models/account_budget.py

View check run for this annotation

Codecov / codecov/patch

account_budget_oca_analytic_tag/models/account_budget.py#L57-L58

Added lines #L57 - L58 were not covered by tests

@api.constrains("general_budget_id", "analytic_account_id", "analytic_tag_id")
Expand Down

0 comments on commit 98a81a7

Please sign in to comment.