From b7b38ed141be9d525c016c64b2ff932e865a63ca Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 11 Jan 2018 14:51:50 +0100 Subject: [PATCH] [FIX] stock: remove superfluous track visibility messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_run_move` creates the move, calls `_assign_picking` and then confirms it. The result is that a draft move is added to a picking and then its state is changed to confirmed. As the state of the picking is computed across its moves and a manual call to `message_track` is done when any of its move changes its state, there was a lot of tracking messages in the picking chatter, especially when you confirm a sale order (a lot of calls to _run_move). The thing is that this is unnecessary as stock.move’s `_action_confirm` will call `_assign_picking` later on AND after having changed its state to “confirmed”. Now a confirmed move is added to a confirmed picking and no message are posted. This improves considerably the validation of a massive SO. --- addons/stock/models/procurement.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index 2b51cf9f66a..1a20a7dd626 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -78,7 +78,6 @@ class ProcurementRule(models.Model): data = self._get_stock_move_values(product_id, product_qty, product_uom, location_id, name, origin, values, group_id) # Since action_confirm launch following procurement_group we should activate it. move = self.env['stock.move'].sudo().create(data) - move._assign_picking() move._action_confirm() return True