[FIX] web: translations hash don't consider all loaded modules

Only server wide modules are being taken into account when calculating translations hash.
So user probably can't get translations of new installed modules unless it is forced by hard page reload (Ctrl+Shift+R).

Problem exists since https://github.com/odoo/odoo/commit/80d74e7ee0eab83dc5100e0776df09d04b882fec and the cause in that `mods = odoo.conf.server_wide_modules or []` string was unpaired with the following `if` statement during refactoring.

This commit restores computation of hash based on all loaded modules.

closes odoo/odoo#105466

X-original-commit: 859cd0463aec4533df30e4839367832fef0685fd
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Sergey Shebanin
2022-11-09 17:02:54 +01:00
committed by Xavier Morel
parent 78d2b87a78
commit bc0cd0bb56
+2 -2
View File
@@ -82,6 +82,8 @@ class Http(models.AbstractModel):
default=128 * 1024 * 1024, # 128MiB
))
mods = odoo.conf.server_wide_modules or []
if request.db:
mods = list(request.registry._init_modules) + mods
session_info = {
"uid": session_uid,
"is_system": user._is_system() if session_uid else False,
@@ -120,8 +122,6 @@ class Http(models.AbstractModel):
# but is still included in some other calls (e.g. '/web/session/authenticate')
# to avoid access errors and unnecessary information, it is only included for users
# with access to the backend ('internal'-type users)
if request.db:
mods = list(request.registry._init_modules) + mods
menus = request.env['ir.ui.menu'].load_menus(request.session.debug)
ordered_menus = {str(k): v for k, v in menus.items()}
menu_json_utf8 = json.dumps(ordered_menus, default=ustr, sort_keys=True).encode()