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 5219f4e commit daf9319
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

else:
elif line.general_budget_id.account_ids:
self.env.cr.execute(
"""
SELECT SUM(credit) - SUM(debit)
Expand All @@ -53,6 +53,8 @@ def _compute_practical_amount(self):
),
)
result = self.env.cr.fetchone()[0]
else:
result = 0.0
line.practical_amount = result

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

0 comments on commit daf9319

Please sign in to comment.