Skip to content

Commit

Permalink
Merge PR #3967 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by TheMule71
  • Loading branch information
OCA-git-bot committed Feb 16, 2024
2 parents 0301628 + c520476 commit 5c4c168
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions l10n_it_declaration_of_intent/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def check_declarations_amounts(self, declarations):
declarations_residual = sum(
[declarations_amounts[da] for da in declarations_amounts]
)
if declarations_residual < 0:
if self.currency_id.compare_amounts(declarations_residual, 0) == -1:
raise UserError(
_("Available plafond insufficent.\n" "Excess value: %s")
% (abs(declarations_residual))
Expand All @@ -242,7 +242,12 @@ def check_declarations_amounts(self, declarations):
declaration = declaration_model.browse(declaration_id)
# declarations_amounts contains residual, so, if > limit_amount,
# used_amount went < 0
if declarations_amounts[declaration_id] > declaration.limit_amount:
if (
self.currency_id.compare_amounts(
declarations_amounts[declaration_id], declaration.limit_amount
)
== 1
):
excess = abs(
declarations_amounts[declaration_id] - declaration.limit_amount
)
Expand Down

0 comments on commit 5c4c168

Please sign in to comment.