[FIX] website: avoid 'NoneType' has no attribute 'context' at install

When loading a registry from the route with auth="none" and where module
'website' is set as 'to install', request.env will be None, and install will
crash as follows:

Error:-
AttributeError: 'NoneType' object has no attribute 'context'

reference of previous commit-
https://github.com/odoo/odoo/commit/0ebf849b8e0de33d3b6e7e06c66189591dc7a72c

sentry-42474563

closes odoo/odoo#136096

X-original-commit: ca43e03e6f510520e874b2a8bba092ac9a7f2453
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit is contained in:
Sanket Brahmbhatt
2023-09-21 12:25:13 +00:00
parent 62d3e1a1a3
commit 192c970da7
+1 -1
View File
@@ -76,7 +76,7 @@ class IrModuleModule(models.Model):
-> We want to upgrade every website using this theme.
"""
if request and request.db and request.context.get('apply_new_theme'):
if request and request.db and request.env and request.context.get('apply_new_theme'):
self = self.with_context(apply_new_theme=True)
for module in self: