Skip to content

Commit

Permalink
Merge PR #1558 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by dreispt
  • Loading branch information
OCA-git-bot committed May 2, 2024
2 parents b0214c5 + 252c7c9 commit 61b3515
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions account_invoice_fixed_discount/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ def _get_price_total_and_subtotal_model(
move_type,
):
if self.discount_fixed != 0:
discount = ((self.discount_fixed) / price_unit) * 100 or 0.00
discount = (
(price_unit != 0) and ((self.discount_fixed) / price_unit) * 100 or 0.00
)
return super(AccountMoveLine, self)._get_price_total_and_subtotal_model(
price_unit, quantity, discount, currency, product, partner, taxes, move_type
)
Expand Down Expand Up @@ -110,8 +112,10 @@ def create(self, vals_list):
{"discount_fixed": vals.get("discount_fixed"), "discount": 0.00}
)
fixed_discount = (
vals.get("discount_fixed") / vals.get("price_unit")
) * 100
vals.get("price_unit")
and ((vals.get("discount_fixed") / vals.get("price_unit")) * 100)
or 0.0
)
vals.update({"discount": fixed_discount, "discount_fixed": 0.00})
elif vals.get("discount"):
prev_discount.append({"discount": vals.get("discount")})
Expand Down

0 comments on commit 61b3515

Please sign in to comment.