diff options
| author | Simon Lejeune <sle@openerp.com> | 2019-09-06 08:51:50 +0000 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2019-09-06 11:09:06 +0000 |
| commit | 860d5d8f7cd40924ca58a799d6e750debe828102 (patch) | |
| tree | 6f5527d7029c9f2c38ccefb5702d0baf1257f43c | |
| parent | 30f2ad8c43e3faf2cdb329682657201508db7246 (diff) | |
[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) <sle@openerp.com>
| -rw-r--r-- | addons/stock/models/stock_move.py | 8 | ||||
| -rw-r--r-- | 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)]}"/> </tree> <form string="Stock Moves"> <header> |
