summaryrefslogtreecommitdiff
path: root/addons/web/models
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-06-20 07:55:28 +0000
committerMartin Trigaux <mat@odoo.com>2019-06-20 08:38:47 +0000
commitab7ab7ebbb094c3fcce416a6ee26da6451280084 (patch)
treec56935b231ecba284287eb5f885d46c84156c176 /addons/web/models
parent09a9c48180216b70233af16e5b1a6d375ceec69a (diff)
[FIX] web,http_routing: correctly invalidate cache translation
cache_hashes was introduced at 8a28cc22fd242f to reduce the number of reload The cache is correctly reseted when the translations content changed but did not contain all the translation-related parameters that are, however, stored in the session_info This commit fixes two bugs: Language parameters invalidation: 1. Access the webclient in a specific language 2. Modify the language parameters (e.g. thousands separator) 3. Refresh the page --> webclient is still using old language parameters (from cache) No translation flag after installing a language: 1. Load a database in English in mono-language 2. Load a second language 3. Access a record with a translated field --> translation button not present on translated field (multi_lang is still false in cache value) To fix it, this commit adds all the information that are returns by the /web/webclient/translations call to make sure the hash represent the reality closes odoo/odoo#34266 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/web/models')
-rw-r--r--addons/web/models/ir_http.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py
index f2bfc70f9b4..df316c582fd 100644
--- a/addons/web/models/ir_http.py
+++ b/addons/web/models/ir_http.py
@@ -32,10 +32,15 @@ class Http(models.AbstractModel):
_, qweb_checksum = concat_xml(files)
lang = user_context.get("lang")
- translations_per_module, _ = request.env['ir.translation'].get_translations_for_webclient(mods, lang)
+ translations_per_module, lang_params = request.env['ir.translation'].get_translations_for_webclient(mods, lang)
+ translation_cache = {
+ 'lang_parameters': lang_params,
+ 'modules': translations_per_module,
+ 'multi_lang': len(request.env['res.lang'].sudo().get_installed()) > 1,
+ }
menu_json_utf8 = json.dumps(request.env['ir.ui.menu'].load_menus(request.session.debug), default=ustr, sort_keys=True).encode()
- translations_json_utf8 = json.dumps(translations_per_module, sort_keys=True).encode()
+ translations_json_utf8 = json.dumps(translation_cache, sort_keys=True).encode()
return {
"uid": request.session.uid,