diff options
| author | Goffin Simon <sig@odoo.com> | 2020-05-13 07:27:36 +0000 |
|---|---|---|
| committer | Goffin Simon <sig@odoo.com> | 2020-05-14 09:34:10 +0000 |
| commit | 54fe71d62df5803eabcf267e1c2913cfa37aac79 (patch) | |
| tree | 876ce99fd54187b79513779ff35987384b230a4f /addons | |
| parent | 39e93532c7b04a84b0d0f3bab95c1d21d6cf36f6 (diff) | |
[FIX] sale_stock: Unable to set default warehouse when creating a quotation
Steps to reproduce the bug:
- Go to inventory > settings > enable multiple warehouses
- Let's consider the default warehouse W
- Create a new warehouses NW
- Enable debug mode
- Go to sales > create a new quotation
- Go to the other information tab > change default warehouse W to the newly created warehouse NW
- Click on the bug > go to set defaults > warehouse=NW > save default
- Refresh the page > Go to sales > create a new quotation
- Go to other information tab > observe the warehouse
Bug:
The warehouse was W instead of NW
opw:2254084
closes odoo/odoo#51237
X-original-commit: 80c0821c0e902a68f15a839ff7d2f6beece43dc3
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/sale_stock/models/sale_order.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 8ead12b9f79..41e4e6d5bb4 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -148,7 +148,8 @@ class SaleOrder(models.Model): @api.onchange('company_id') def _onchange_company_id(self): if self.company_id: - self.warehouse_id = self.user_id.with_company(self.company_id.id)._get_default_warehouse_id().id + warehouse_id = self.env['ir.default'].get_model_defaults('sale.order').get('warehouse_id') + self.warehouse_id = warehouse_id or self.user_id.with_company(self.company_id.id)._get_default_warehouse_id().id @api.onchange('user_id') def onchange_user_id(self): |
