[FIX] mrp: multiple BOM

- Create 3 products A, B1, B2
- Create a BOM for A:
  Manufacture, 1 unit of B1
- Create another BOM or A:
  Kit, 1 unit of B2
- Create a MO for A
- Click on 'Produce'

B2 appears as a 'By-product'. Upon saving, an error occurs because of a
rounding set to zero.

The issues is coming from the generation of the `move_finished_ids`.
Since the product A has a BOM kit, the latter is exploded and added as
'By-product'.

We should not try to find phantom BOM for this specific use case. A
solution is to not explote the move produced.

opw-2251423

closes odoo/odoo#53526

X-original-commit: 226ccc2f64d00a19e0ae8851c45051106aa49adc
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-06-23 15:14:37 +00:00
parent ce4fcebbbb
commit 6f8f0d4bc3
+1 -1
View File
@@ -227,7 +227,7 @@ class StockMove(models.Model):
moves_to_unlink = self.env['stock.move']
phantom_moves_vals_list = []
for move in self:
if not move.picking_type_id:
if not move.picking_type_id or (move.production_id and move.production_id.product_id == move.product_id):
moves_to_return |= move
continue
bom = self.env['mrp.bom'].sudo()._bom_find(product=move.product_id, company_id=move.company_id.id, bom_type='phantom')