From 7a039c730dd3a654b74ca51d5bb322bca5395b64 Mon Sep 17 00:00:00 2001 From: Pierre Masereel Date: Mon, 27 Mar 2017 17:03:10 +0200 Subject: [PATCH] [FIX] stock: multiple global push rules with same origin When you have multiplle global push rules with the same source location, a traceback is raised because the '_apply' method of "stock.location.path" is called with more than one record, and doesn't handle multiple record. To fix this, we limit the number of records returned when a global rule is searched to 1 (as for other 'search' of push rules in this file). This bug has been introduced during migration in rev: https://github.com/odoo/odoo/commit/cb486d7eb6353a66eea2cb3610141b4f3a778791 opw-725874 --- addons/stock/models/stock_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index c2cfd811f3b..38f97fcb784 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -376,7 +376,7 @@ class StockMove(models.Model): rules = Push.search(domain + [('route_id', 'in', move.picking_id.picking_type_id.warehouse_id.route_ids.ids)], order='route_sequence, sequence', limit=1) if not rules: # if no specialized push rule has been found yet, we try to find a general one (without route) - rules = Push.search(domain + [('route_id', '=', False)], order='sequence') + rules = Push.search(domain + [('route_id', '=', False)], order='sequence', limit=1) # Make sure it is not returning the return if rules and (not move.origin_returned_move_id or move.origin_returned_move_id.location_dest_id.id != rules.location_dest_id.id): rules._apply(move)