Files
odoo_source/addons/http_routing/__init__.py
T
Julien Castiaux 814a34c3c9 [FIX] http_routing,website: missing request attribute during install
Steps to reproduce:

1) start from a clean database (http_routing should not be installed).
2) go to the app menu and install project (don't install via `-i`!!).
3) traceback: `request` has not attribute `is_frontend` while rendering
   a template.

The `is_frontend` attribute on request is set by the http_routing
module. At the moment the "install now" button is clicked, http_routing
was not installed so the `is_frontend` attribute was not set.

FF to the end of the installation: the registry is reloaded to include
the modules that have been installed, http_routing among them.

We are in a tricky situation: (1) there is a request, (2) http_routing
is installed and (3) the `is_frontend` attribute is missing from the
request.

This situation is illegal, when http_routing is installed, the
`is_frontend` attribut should always be set. In this work we reset the
missing attributes using sensitive default values via post-init hooks.

closes odoo/odoo#87684

Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-04-01 17:56:45 +02:00

13 lines
289 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from odoo.http import request
def _post_init_hook(cr, registry):
if request:
request.is_frontend = False
request.is_frontend_multilang = False