[FIX] sale_mrp: COGS in case of kit
When a kit is sold, the unit price of the COGS recorded is the sum of the unit prices of each component multiplies by the quantity sold. Obviously, this is not correct since the unit price should not take into account the quantity sold. opw-681403
This commit is contained in:
@@ -141,7 +141,7 @@ class AccountInvoiceLine(models.Model):
|
||||
prod_moves = [m for m in moves if m.product_id.id == product_id]
|
||||
prod_qty_done = factor * qty_done
|
||||
prod_quantity = factor * quantity
|
||||
average_price_unit += factor * self._compute_average_price(prod_qty_done, prod_quantity, prod_moves)
|
||||
average_price_unit += self._compute_average_price(prod_qty_done, prod_quantity, prod_moves)
|
||||
price_unit = average_price_unit or price_unit
|
||||
price_unit = uom_obj._compute_qty_obj(self.uom_id, price_unit, self.product_id.uom_id, round=False)
|
||||
return price_unit
|
||||
|
||||
Reference in New Issue
Block a user