[FIX] website_sale: fix AccessError when checking fiscal position

An AccessError can be raised when checking Fiscal Position of user's last order
if connected user belongs to a different company than the company of the order.

opw-2370903

closes odoo/odoo#61022

X-original-commit: 1b602c1fef0f2d05c94a9547e203ae8ecd24e87b
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
This commit is contained in:
Anh Thao Pham (pta)
2020-10-30 08:08:03 +00:00
committed by Toufik Ben Jaa
parent 0cbf2addfd
commit ae095de366
+1 -1
View File
@@ -261,7 +261,7 @@ class Website(models.Model):
# Do not reload the cart of this user last visit if the Fiscal Position has changed.
if check_fpos and sale_order:
fpos_id = (
self.env['account.fiscal.position']
self.env['account.fiscal.position'].sudo()
.with_company(sale_order.company_id.id)
.get_fiscal_position(sale_order.partner_id.id, delivery_id=sale_order.partner_shipping_id.id)
)