[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 3520220268

closes odoo/odoo#36519

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
Simon Lejeune
2019-09-06 11:09:06 +00:00
parent 30f2ad8c43
commit 860d5d8f7c
2 changed files with 6 additions and 7 deletions
+5 -3
View File
@@ -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')
+1 -4
View File
@@ -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>