summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Rahir <rar@odoo.com>2019-03-07 15:33:01 +0000
committerRémi Rahir <rar@odoo.com>2019-03-07 15:38:10 +0000
commitcc54194e130d4a93d9afdd7aedc7d35be2e03fed (patch)
tree0aa6dbaa798548eb77a710a5c6137bfddbd5194d
parenteb62cd2c2b8eba2fceee4f0491a7f9a045de73d5 (diff)
[FIX] website_sale: filter fiscal positions on company
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) <rar@odoo.com>
-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 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