[IMP] stock: not detailed operations for receipts
Before this commit, each picking type had its `show_operation` field on true if user actived multi locations, packaging or tracking. Now, it still the case except for picking type for receipt. Also, modifies onchange to reflect that when creating new picking type. Task #2031313
This commit is contained in:
@@ -86,6 +86,9 @@ class ResConfigSettings(models.TransientModel):
|
||||
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 = self.env['stock.picking.type'].with_context(active_test=False).search([
|
||||
('code', '!=', 'incoming'),
|
||||
('show_operations', '=', False)
|
||||
])
|
||||
picking_types.write({'show_operations': True})
|
||||
return res
|
||||
|
||||
@@ -136,6 +136,11 @@ class PickingType(models.Model):
|
||||
elif self.code == 'outgoing':
|
||||
self.default_location_src_id = self.env.ref('stock.stock_location_stock').id
|
||||
self.default_location_dest_id = self.env.ref('stock.stock_location_customers').id
|
||||
self.show_operations = self.code != 'incoming' and self.user_has_groups(
|
||||
'stock.group_production_lot,'
|
||||
'stock.group_stock_multi_locations,'
|
||||
'stock.group_tracking_lot'
|
||||
)
|
||||
|
||||
def _get_action(self, action_xmlid):
|
||||
# TDE TODO check to have one view + custo in methods
|
||||
|
||||
Reference in New Issue
Block a user