summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRémi Rahir <rar@odoo.com>2019-03-11 10:42:08 +0000
committerRémi Rahir <rar@odoo.com>2019-03-11 14:57:21 +0000
commit49ca43d75cb9a97642c820c2466d454f1ce604cb (patch)
tree5ac9af27a01aa82c039fb05769fd8e8e3af5b19e /addons
parent084246a54ed68e2898e9c713345192b2a33ddd81 (diff)
[FIX] website_sale: filter fiscal positions on company v2
Sequel of cc54194e130d4a93d9afdd7aedc7d35be2e03fed. The mentioned fix only worked when the user was public. The problem arises when calling the function `_get_fpos_by_region()` in `sudo` without specifying the company and this happens, for instance, in every `onchange_partner_*` function of a sale order. We propose to add the `force_company` key in the context of the sale order to ensure the right company when selecting the fiscal position. closes odoo/odoo#31751 Signed-off-by: Rémi Rahir (rar) <rar@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/website_sale/models/sale_order.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py
index c98fb72deea..97e6a09a7a5 100644
--- a/addons/website_sale/models/sale_order.py
+++ b/addons/website_sale/models/sale_order.py
@@ -390,7 +390,7 @@ class Website(models.Model):
# TODO cache partner_id session
pricelist = self.env['product.pricelist'].browse(pricelist_id).sudo()
so_data = self._prepare_sale_order_values(partner, pricelist)
- sale_order = self.env['sale.order'].sudo().create(so_data)
+ sale_order = self.env['sale.order'].with_context(force_company=request.website.company_id.id).sudo().create(so_data)
# set fiscal position
if request.website.partner_id.id != partner.id: