From da342a549fc1ab5e3eb767e933ba751b0c1aceaf Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 2 May 2019 12:01:55 +0000 Subject: [PATCH] [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) --- addons/mrp_byproduct/models/mrp_production.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mrp_byproduct/models/mrp_production.py b/addons/mrp_byproduct/models/mrp_production.py index d3d8fbc369e..c52da55ef66 100644 --- a/addons/mrp_byproduct/models/mrp_production.py +++ b/addons/mrp_byproduct/models/mrp_production.py @@ -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({