[IMP] stock: operation types options' tweaks
In case it's appropriate (using multilocation or lots/serial numbers) the 'show detailed operations' option is active by default when a new operations type is created. Task #1944853
This commit is contained in:
@@ -92,3 +92,11 @@ class ResConfigSettings(models.TransientModel):
|
||||
('delivery_steps', '=', 'ship_only')])
|
||||
active = False
|
||||
warehouses.mapped('int_type_id').write({'active': active})
|
||||
|
||||
def execute(self):
|
||||
res = super(ResConfigSettings, self).execute()
|
||||
self.ensure_one()
|
||||
if self.group_stock_multi_locations or self.group_stock_production_lot or self.group_stock_tracking_lot:
|
||||
picking_types = self.env['stock.picking.type'].with_context(active_test=False).search([('show_operations', '=', False)])
|
||||
picking_types.write({'show_operations': True})
|
||||
return res
|
||||
|
||||
@@ -21,6 +21,11 @@ class PickingType(models.Model):
|
||||
_description = "Picking Type"
|
||||
_order = 'sequence, id'
|
||||
|
||||
def _default_show_operations(self):
|
||||
return self.user_has_groups('stock.group_production_lot,'
|
||||
'stock.group_stock_multi_locations,'
|
||||
'stock.group_tracking_lot')
|
||||
|
||||
name = fields.Char('Operation Type', required=True, translate=True)
|
||||
color = fields.Integer('Color')
|
||||
sequence = fields.Integer('Sequence', help="Used to order the 'All Operations' kanban view")
|
||||
@@ -45,7 +50,7 @@ class PickingType(models.Model):
|
||||
'Use Existing Lots/Serial Numbers', default=True,
|
||||
help="If this is checked, you will be able to choose the Lots/Serial Numbers. You can also decide to not put lots in this operation type. This means it will create stock with no lot or not put a restriction on the lot taken. ")
|
||||
show_operations = fields.Boolean(
|
||||
'Show Detailed Operations', default=False,
|
||||
'Show Detailed Operations', default=_default_show_operations,
|
||||
help="If this checkbox is ticked, the pickings lines will represent detailed stock operations. If not, the picking lines will represent an aggregate of detailed stock operations.")
|
||||
show_reserved = fields.Boolean(
|
||||
'Show Reserved', default=True, help="If this checkbox is ticked, Odoo will show which products are reserved (lot/serial number, source location, source package).")
|
||||
|
||||
Reference in New Issue
Block a user