Skip to content
Snippets Groups Projects
Commit 85f227b1 authored by nni-odoo's avatar nni-odoo Committed by Arnold Moyaux
Browse files

[FIX] sale_mrp: unit price calculation BoM in different UoM

Fix for task 2620026.

_get_bom_component_qty function is only referred to once in the whole odoo app,
which is on addons/sale_mrp/models/account_move.py#22.

The result returned from this function is used as a multiplier to quantity
to convert into the expected UoM. However, the quantity being referred to on
_stock_account_get_anglo_saxon_price_unit (qty_invoiced, qty_to_invoice), are
already converted into the SO Line's product's default UoM. In this function,
it however tries to convert 1 from SO Line's UoM to BoM's UOM.

With this, if Product UoM=x, SO Line UoM=y, BOM UoM=x, in the function _stock_account_get_anglo_saxon_price_unit,
the quantities will be multiplied by the same factor twice, resulting to the incorrect computation of price_unit to follow.

Part-of: odoo/odoo#81355
parent 72cd8d07
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,7 @@ class SaleOrderLine(models.Model):
order_line.qty_delivered = 0.0
def _get_bom_component_qty(self, bom):
bom_quantity = self.product_uom._compute_quantity(1, bom.product_uom_id)
bom_quantity = self.product_id.uom_id._compute_quantity(1, bom.product_uom_id)
boms, lines = bom.explode(self.product_id, bom_quantity)
components = {}
for line, line_data in lines:
......
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