diff options
| author | mreficent <miquel.raich@eficent.com> | 2020-11-30 11:41:30 +0000 |
|---|---|---|
| committer | mreficent <miquel.raich@eficent.com> | 2020-11-30 13:39:32 +0000 |
| commit | 24d52d4a8d0f475bb62b6653c08ce409e27e1d58 (patch) | |
| tree | 651268f363497ab038324b5e7d4de0fe71b73b4c /addons | |
| parent | fad10e505f8e2f0d64c97460144afe1be0ba808d (diff) | |
[FIX] stock: violating stock_warehouse_warehouse_name_uniq constraint
You may have inactive warehouses for some companies and then, when recreating missing warehouses, you try to create same warehouses for those companies, but you can't because there is an unique constraint.
closes odoo/odoo#62613
X-original-commit: 9b91f9d1bb41d05f445d745a9b8e5fa63edaf2a9
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/stock/models/res_company.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock/models/res_company.py b/addons/stock/models/res_company.py index 4ae579ebaeb..93a960edbf3 100644 --- a/addons/stock/models/res_company.py +++ b/addons/stock/models/res_company.py @@ -110,7 +110,7 @@ class Company(models.Model): when module stock is installed. """ company_ids = self.env['res.company'].search([]) - company_with_warehouse = self.env['stock.warehouse'].search([]).mapped('company_id') + company_with_warehouse = self.env['stock.warehouse'].with_context(active_test=False).search([]).mapped('company_id') company_without_warehouse = company_ids - company_with_warehouse for company in company_without_warehouse: self.env['stock.warehouse'].create({ |
