Skip to content

Commit

Permalink
[FIX] sale_margin_analysis: Avoid ZeroDivisionError
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed Jun 20, 2024
1 parent 241e127 commit 40f3658
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sale_margin_delivered/models/sale_margin.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ def _compute_margin_delivered(self):
for line in self.filtered("qty_delivered"):
# we need to compute the price reduce to avoid rounding issues
# the one stored in the line is rounded to the product price precision
price_reduce_taxexcl = line.price_subtotal / line.product_uom_qty
price_reduce_taxexcl = (
line.price_subtotal / line.product_uom_qty
if line.product_uom_qty
else 0.0
)

if line.product_id.type != "product":
currency = line.order_id.pricelist_id.currency_id
Expand Down

0 comments on commit 40f3658

Please sign in to comment.