[FIX] website_sale: public user doesn't have access to fpos

In commit d4b046e238, a sudo was lost,
leading to 403 errors shown to public users browsing the ecommerce.

closes odoo/odoo#93947

X-original-commit: 96f491dafe9b247638db04ecfb33f3dbbc36e73c
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
This commit is contained in:
Victor Feyens
2022-06-17 18:31:54 +02:00
parent 261b781d0c
commit 952d5c1076
+2 -2
View File
@@ -421,7 +421,7 @@ class Website(models.Model):
@api.model
def _get_current_fiscal_position_id(self, partner_sudo):
AccountFiscalPosition = self.env['account.fiscal.position']
AccountFiscalPosition = self.env['account.fiscal.position'].sudo()
fpos = AccountFiscalPosition
# If the current user is the website public user, the fiscal position
@@ -430,7 +430,7 @@ class Website(models.Model):
country_code = request.geoip.get('country_code')
if country_code:
country_id = self.env['res.country'].search([('code', '=', country_code)], limit=1).id
fpos = self.env['account.fiscal.position'].sudo()._get_fpos_by_region(country_id)
fpos = AccountFiscalPosition._get_fpos_by_region(country_id)
if not fpos:
fpos = AccountFiscalPosition._get_fiscal_position(partner_sudo)