Skip to content

Commit

Permalink
Merge PR OCA#3152 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by rousseldenis
  • Loading branch information
OCA-git-bot committed Jun 17, 2024
2 parents f38924d + c3304c0 commit 8717f5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sale_fixed_discount/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ class SaleOrderLine(models.Model):
@api.constrains("discount_fixed", "discount")
def _check_discounts(self):
"""Check that the fixed discount and the discount percentage are consistent."""
precision = self.env["decimal.precision"].precision_get("Discount")
for line in self:
if line.discount_fixed and line.discount:
currency = line.currency_id
calculated_fixed_discount = float_round(
line._get_discount_from_fixed_discount(),
precision_rounding=currency.rounding,
precision_digits=precision,
)

if (
float_compare(
calculated_fixed_discount,
line.discount,
precision_rounding=currency.rounding,
precision_digits=precision,
)
!= 0
):
Expand Down

0 comments on commit 8717f5e

Please sign in to comment.