Skip to content
Snippets Groups Projects
Commit c72af086 authored by Loan (lse)'s avatar Loan (lse) Committed by Nicolas Martinelli
Browse files

[FIX] sale_mrp: BOM selection for COGS

- Create the FIFO & Automated products:
  Kit ABC: 2 variants, e.g. Black and White, invoice on delivered qty
  Kit A
  Kit B
  Kit C
- Create the BOM for the variants of Kit ABC, in this order:
  Black: 1 unit of Kit A and 1 unit of Kit B
  White: 1 unit of Kit A and 1 unit of Kit C
- Receive the components
  Kit A: 10 USD
  Kit B: 12 USD
  Kit C: 13 USD
- Create a SO for Kit ABC (Black)
- Validate the picking, create and validate invoice

The COGS is incorrect: the amount is 23 instead of 22.

This happens because the BOM selected is always the first BOM of the
product template instead of the product-specific BOM.

We select the BOM the same way it is done when it is exploded in:

https://github.com/odoo/odoo/blob/95348a5e1dc4e69ce0edaf89de1124fe55ce4ec8/addons/mrp/models/stock_move.py#L161



Note that if the BOM changed between picking creation and invoice
validation, it will fail.

opw-2153629

closes odoo/odoo#43266

X-original-commit: 7714f7ca
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
Co-authored-by: default avatarNicolas Martinelli <nim@odoo.com>
parent fc85fd03
No related branches found
No related tags found
Loading
Loading
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