[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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user