Skip to content

Commit

Permalink
[FIX] stock: prevent crash if key does not exit in dict
Browse files Browse the repository at this point in the history
Closes #31049
  • Loading branch information
jao-odoo authored and nim-odoo committed Feb 21, 2019
1 parent 84143a3 commit d1a1353
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/stock/models/stock_warehouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ def _create_or_update_sequences_and_picking_types(self):
warehouse_data[picking_type] = PickingType.create(values).id

if 'out_type_id' in warehouse_data:
PickingType.browse(warehouse_data['out_type_id']).write({'return_picking_type_id': warehouse_data['in_type_id']})
PickingType.browse(warehouse_data['out_type_id']).write({'return_picking_type_id': warehouse_data.get('in_type_id', False)})
if 'in_type_id' in warehouse_data:
PickingType.browse(warehouse_data['in_type_id']).write({'return_picking_type_id': warehouse_data['out_type_id']})
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):
Expand Down

0 comments on commit d1a1353

Please sign in to comment.