diff --git a/stock_landed_costs_average/models/stock_landed_cost.py b/stock_landed_costs_average/models/stock_landed_cost.py index 16dd31ea..09fca953 100644 --- a/stock_landed_costs_average/models/stock_landed_cost.py +++ b/stock_landed_costs_average/models/stock_landed_cost.py @@ -88,7 +88,7 @@ class LandedCost(models.Model): ('id', 'in', quant_loc_ids)]) qty_available = line.product_id.with_context(location=locations.ids).qty_available total_cost = (qty_available * line.product_id.standard_price) + cost_to_add - line.product_id.write({'standard_price': total_cost / qty_available}) + line.product_id.write({'standard_price': total_cost / qty_available if qty_available != 0 else 0}) move = move.create(move_vals) cost.write({'state': 'done', 'account_move_id': move.id})