diff options
| author | Arnold Moyaux <arm@odoo.com> | 2020-03-09 13:20:51 +0000 |
|---|---|---|
| committer | Arnold Moyaux <arm@odoo.com> | 2020-03-19 10:45:25 +0000 |
| commit | da3eddbd51d40317a74e859cd546e2d1ff0c9459 (patch) | |
| tree | 63e21a5a1fa154d23ee1bd2372c66e8eaaab4439 | |
| parent | 975ba2772304c66adf8be66a353fab529ada9c35 (diff) | |
[FIX] stock: warehouse code should impact picking type
Usecase to reproduce:
- Create Warehouse with code A -> Picking type sequence start with A/
- Set the warehouse's code to B -> Picking type sequence remains A/
- Set the warehouse's code to C -> Picking type sequence become B/
It happens because _update_name_and_code is called before the write and
it updates the picking_type's sequence with warehouse current name and
code.
| -rw-r--r-- | addons/stock/models/stock_warehouse.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index 930cbe05ff3..44f6942c943 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -132,10 +132,6 @@ class Warehouse(models.Model): Route = self.env['stock.location.route'] warehouses = self.with_context(active_test=False) - - if vals.get('code') or vals.get('name'): - warehouses._update_name_and_code(vals.get('name'), vals.get('code')) - warehouses._create_missing_locations(vals) if vals.get('reception_steps'): @@ -157,6 +153,9 @@ class Warehouse(models.Model): res = super(Warehouse, self).write(vals) + if vals.get('code') or vals.get('name'): + warehouses._update_name_and_code(vals.get('name'), vals.get('code')) + for warehouse in warehouses: # check if we need to delete and recreate route depends = [depend for depends in [value.get('depends', []) for value in warehouse._get_routes_values().values()] for depend in depends] |
