[FIX] purchase_stock, purchase_mrp: adjust the qty of purchased kit correctly
Steps to reproduce the bug:
- Create a BOM kit for “product K” with:
- 2 * “product A”
- 1 * “product B”
- Create a PO for 1 unit of “product K” > confirm
- A receipt delivery with 2 units of “product A” and 1 unit of B will be created
- Modify the ordered Qty to 2 units of “Product K”
Problem:
The receipt delivery will not be updated correctly (4 units of product A and 3 of product B)
because the `"_prepare_stock_moves"` function computed the previous quantity wrong based on the moves quantities
since the moves are for products A and B, not product F.(do not take into account the products in kit)
Solution:
For kit products, do not calculate from the `"stock.move"`, calculate the difference between the quantity before and after the change
opw-2645719
closes odoo/odoo#76965
Signed-off-by:
Arnold Moyaux <amoyaux@users.noreply.github.com>
Showing
- addons/purchase_mrp/models/purchase_mrp.py 11 additions, 0 deletionsaddons/purchase_mrp/models/purchase_mrp.py
- addons/purchase_mrp/tests/test_purchase_mrp_flow.py 45 additions, 0 deletionsaddons/purchase_mrp/tests/test_purchase_mrp_flow.py
- addons/purchase_stock/models/purchase.py 12 additions, 4 deletionsaddons/purchase_stock/models/purchase.py
Loading
Please register or sign in to comment