From 860d5d8f7cd40924ca58a799d6e750debe828102 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Fri, 6 Sep 2019 08:51:50 +0000 Subject: [PATCH] [FIX] stock: assign serial button We display the button on the move if detailed operations is enabled and if pre-fill detailed operations is disabled. There was a mix of computed field/conditions in the xml resulting in an always hidden button. We now only use the computed field. related to 35202202687f6292261ad01a3958df20bcf15264 closes odoo/odoo#36519 Signed-off-by: Simon Lejeune (sle) --- addons/stock/models/stock_move.py | 8 +++++--- addons/stock/views/stock_picking_views.xml | 5 +---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 19fd694cfc2..a359140ae85 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -181,14 +181,16 @@ class StockMove(models.Model): if self.product_id: self.description_picking = self.product_id._get_description(self.picking_type_id) - @api.depends('has_tracking', 'picking_type_id.use_create_lots', 'picking_type_id.use_existing_lots') + @api.depends('has_tracking', 'picking_type_id.use_create_lots', 'picking_type_id.use_existing_lots', 'picking_type_id.show_reserved', 'picking_type_id.show_operations') def _compute_display_assign_serial(self): for move in self: move.display_assign_serial = ( move.has_tracking == 'serial' and + move.state in ('partially_available', 'assigned') and move.picking_type_id.use_create_lots and - not move.picking_type_id.show_reserved and - not move.picking_type_id.use_existing_lots + not move.picking_type_id.use_existing_lots and + move.picking_type_id.show_operations and + not move.picking_type_id.show_reserved ) @api.depends('picking_id.is_locked') diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index b9b66d3221b..1c355d00cec 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -349,10 +349,7 @@ class="btn-sm btn-primary fa fa-plus-square-o" style="line-height: 1;" role="img" title="Assign Serial Numbers" - attrs="{'invisible': ['|', '|', - ('display_assign_serial', '=', False), - ('parent.show_reserved', '=', False), - ('parent.show_operations', '=', False)]}"/> + attrs="{'invisible': [('display_assign_serial', '=', False)]}"/>