[FIX] mrp_byproduct: Put Away Strategy

- Create 3 products:
  C1, no tracking
  P1, tracked by lot
  P2, tracked by lot
- Create a BOM: to product 1 unit of P1, use 1 unit of C1. It also
  produces 1 unit of P2 as byproduct.
- On the Stock location, create a Put Away Strategy to send:
  P1 to Shelf 1
  P2 to Shelf 2
- Create a MO, validate until then end

P1 is correctly sent to Shelf 1, but P2 is sent to Stock instead of
Shelf 2.

No call is performed to `get_putaway_strategy` at move line creation.

opw-1972130

closes odoo/odoo#33109

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2019-05-02 12:05:56 +00:00
parent 033a7fab4d
commit da342a549f
@@ -61,13 +61,14 @@ class MrpProductProduce(models.TransientModel):
for by_product_move in by_product_moves:
rounding = by_product_move.product_uom.rounding
quantity = float_round(self.product_qty * by_product_move.unit_factor, precision_rounding=rounding)
location_dest_id = by_product_move.location_dest_id.get_putaway_strategy(by_product_move.product_id).id or by_product_move.location_dest_id.id
values = {
'move_id': by_product_move.id,
'product_id': by_product_move.product_id.id,
'production_id': self.production_id.id,
'product_uom_id': by_product_move.product_uom.id,
'location_id': by_product_move.location_id.id,
'location_dest_id': by_product_move.location_dest_id.id,
'location_dest_id': location_dest_id,
}
if by_product_move.product_id.tracking == 'lot':
values.update({