From ed8fc8f52b3abe3816da2ed0d0a70d86e963e0ef Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 21 Dec 2017 16:40:41 +0100 Subject: [PATCH] [FIX] stock: planned transfer - Create a product A tracked by lot - From the Dashboard, create a 'Planned Transfer' - Add product A, any quantity - Click on "Mark as TODO" It's now possible to edit the serial numbers, but it's impossible to set any quantity in the move lines. This is due to the remaining context key `planned_picking` which makes `is_initial_demand_editable = True`. In this case, `qty_done` is read-only in the view `view_stock_move_line_operation_tree`. As a workaround, `action_confirm` returns an action and set the context accordingly. opw-785332 --- addons/stock/models/stock_picking.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index ad08a4b92e0..66197571b12 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -542,7 +542,19 @@ class Picking(models.Model): # call `_action_assign` on every confirmed move which location_id bypasses the reservation self.filtered(lambda picking: picking.location_id.usage in ('supplier', 'inventory', 'production') and picking.state == 'confirmed')\ .mapped('move_lines')._action_assign() - return True + if self.env.context.get('planned_picking') and len(self) == 1: + action = self.env.ref('stock.action_picking_form') + result = action.read()[0] + result['res_id'] = self.id + result['context'] = { + 'search_default_picking_type_id': [self.picking_type_id.id], + 'default_picking_type_id': self.picking_type_id.id, + 'contact_display': 'partner_address', + 'planned_picking': False, + } + return result + else: + return True @api.multi def action_assign(self):