Skip to content
Snippets Groups Projects
Commit 15d2778f authored by Damien Bouvy's avatar Damien Bouvy
Browse files

[FIX] sale: sometimes an invoiced quantity could be 0, need to avoid divide by 0 error

parent 144b4f80
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,8 @@ class AccountAnalyticLine(models.Model):
so_line = fields.Many2one('sale.order.line', string='Sale Order Line')
def _get_invoice_price(self, order):
if self.unit_amount == 0.0:
return 0.0
price_unit = abs(self.amount / self.unit_amount)
if self.currency_id and self.currency_id != order.currency_id:
price_unit = self.currency_id.compute(price_unit, order.currency_id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment