From cc54194e130d4a93d9afdd7aedc7d35be2e03fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rahir?= Date: Thu, 7 Mar 2019 15:33:01 +0000 Subject: [PATCH] [FIX] website_sale: filter fiscal positions on company MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When creating a cart on the website, the website company was not considered which could end up with the selection of a fiscal position linked to a wrong company since the method is called in sudo. closes odoo/odoo#31673 Signed-off-by: Rémi Rahir (rar) --- addons/website_sale/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_sale/models/sale_order.py b/addons/website_sale/models/sale_order.py index 111f208f60b..c98fb72deea 100644 --- a/addons/website_sale/models/sale_order.py +++ b/addons/website_sale/models/sale_order.py @@ -399,7 +399,7 @@ class Website(models.Model): country_code = request.session['geoip'].get('country_code') if country_code: country_id = request.env['res.country'].search([('code', '=', country_code)], limit=1).id - fp_id = request.env['account.fiscal.position'].sudo()._get_fpos_by_region(country_id) + fp_id = request.env['account.fiscal.position'].sudo().with_context(force_company=request.website.company_id.id)._get_fpos_by_region(country_id) sale_order.fiscal_position_id = fp_id else: # if no geolocation, use the public user fp