Skip to content

Commit

Permalink
Merge pull request #432 from ecosoft-odoo/15.0-fix-budget_control-com…
Browse files Browse the repository at this point in the history
…mit_revenue

[15.0][FIX] budget_control: commit budget revenue case
  • Loading branch information
Saran440 authored Jun 7, 2024
2 parents 72d8aa2 + 9e31e20 commit 8c5037a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ class AccountMove(models.Model):
@api.onchange("retained_move_ids")
def _onchange_retained_move_ids(self):
res = super()._onchange_retained_move_ids()
self.not_affect_budget = bool(self.retained_move_ids)
# Force not affect budget if have retained_move_ids
if self.retained_move_ids:
self.not_affect_budget = True
return res
8 changes: 8 additions & 0 deletions budget_control/models/base_budget_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,14 @@ def _update_budget_commitment(self, budget_vals, reverse=False):
amount = self._get_amount_convert_currency(
budget_vals["amount_currency"], currency, company, date_commit or today
)

# NOTE: This is to handle the case of budget revenue.
if (
self._name == "account.move.line"
and self.move_id.move_type == "out_invoice"
):
reverse = True

# By default, commit date is equal to document date
# this is correct for normal case, but may require different date
# in case of budget that carried to new period/year
Expand Down

0 comments on commit 8c5037a

Please sign in to comment.