Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion addons/stock/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,15 @@ def _create_or_update_sequences_and_picking_types(self):
sequence.name = _("%(name)s (copy)(%(id)s)", name=sequence.name, id=str(sequence.id))
values.update(warehouse_id=self.id, color=color, sequence_id=sequence.id)
warehouse_data[picking_type] = PickingType.create(values).id
self._post_process_create_or_update_sequences_and_picking_types(warehouse_data)
return warehouse_data

def _post_process_create_or_update_sequences_and_picking_types(self, warehouse_data):
PickingType = self.env['stock.picking.type']
if 'out_type_id' in warehouse_data:
PickingType.browse(warehouse_data['out_type_id']).write({'return_picking_type_id': warehouse_data.get('return_type_id', False)})
if 'in_type_id' in warehouse_data:
PickingType.browse(warehouse_data['in_type_id']).write({'return_picking_type_id': warehouse_data.get('out_type_id', False)})
return warehouse_data

def _create_or_update_global_routes_rules(self):
""" Some rules are not specific to a warehouse(e.g MTO, Buy, ...)
Expand Down