[FIX] base: add sudo on reading ir.ui.view

STEPS:

1/ Fresh copy of base runbot 14.0
2/ Change country on the company to 'Mexico'
3/ Install apps Sales and Contacts
4/ Login as 'Demo' and try to access Contacts

BEFORE: Access Error

AFTER: No errors

WHY:
* since Odoo 14 only admin can read ir.ui.view: https://github.com/odoo/odoo/commit/ccc98e01691b88c2da9c484c0e6de235b9d18548
* https://github.com/odoo/odoo/pull/60329

---

opw-2378336

closes odoo/odoo#62110

X-original-commit: 7ae0e00738a0bcedb4b36049ce4364f46c7d899e
Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
This commit is contained in:
Ivan Yelizariev
2020-11-20 16:07:42 +00:00
parent 326ae2a725
commit 6851e20027
+1 -1
View File
@@ -47,7 +47,7 @@ class FormatAddressMixin(models.AbstractModel):
def _fields_view_get_address(self, arch):
# consider the country of the user, not the country of the partner we want to display
address_view_id = self.env.company.country_id.address_view_id
address_view_id = self.env.company.country_id.address_view_id.sudo()
if address_view_id and not self._context.get('no_address_format') and (not address_view_id.model or address_view_id.model == self._name):
#render the partner address accordingly to address_view_id
doc = etree.fromstring(arch)