From 6984a423cfdea64500f6c7e38f57fc546fbc8170 Mon Sep 17 00:00:00 2001 From: Connor Enterline Date: Fri, 19 Nov 2021 15:21:09 -0500 Subject: [PATCH] [IMP] allow pages to load without passing mods through url --- addons/http_routing/controllers/main.py | 11 ++++++----- addons/web/controllers/main.py | 12 ++++++++++-- addons/web/static/src/js/core/session.js | 2 +- addons/web/static/src/js/core/translation.js | 3 ++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/addons/http_routing/controllers/main.py b/addons/http_routing/controllers/main.py index dbc22d81f34f6..1ee4bbbc95392 100644 --- a/addons/http_routing/controllers/main.py +++ b/addons/http_routing/controllers/main.py @@ -10,8 +10,9 @@ class Routing(Home): @http.route('/website/translations/', type='http', auth="public", website=True) def get_website_translations(self, unique, lang, mods=None): - IrHttp = request.env['ir.http'].sudo() - modules = IrHttp.get_translation_frontend_modules() - if mods: - modules += mods - return WebClient().translations(unique, mods=','.join(modules), lang=lang) + # IrHttp = request.env['ir.http'].sudo() + # modules = IrHttp.get_translation_frontend_modules() + # if mods: + # modules += mods + # return WebClient().translations(unique, mods=','.join(modules), lang=lang) + return WebClient().translations(unique, mods='', lang=lang) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index ab9168c8c6795..8ef9677ebb0d8 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1011,6 +1011,11 @@ def load_locale(self, lang): @http.route('/web/webclient/qweb/', type='http', auth="none", cors="*") def qweb(self, unique, mods=None, db=None): + + if not mods: + module_boot_mods = module_boot() + mods = module_boot_mods + content = HomeStaticTemplateHelpers.get_qweb_templates(mods, db, debug=request.session.debug) return request.make_response(content, [ @@ -1053,10 +1058,13 @@ def translations(self, unique, mods=None, lang=None): :param lang: the language of the user :return: """ + request.disable_db = False - if mods: - mods = mods.split(',') + if not mods: + module_boot_mods = module_boot() + mods = module_boot_mods + translations_per_module, lang_params = request.env["ir.translation"].get_translations_for_webclient(mods, lang) body = json.dumps({ diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/js/core/session.js index c8a879e217ac0..ec80ffd492481 100644 --- a/addons/web/static/src/js/core/session.js +++ b/addons/web/static/src/js/core/session.js @@ -246,7 +246,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { var self = this; var lock = this.qweb_mutex.exec(function () { var cacheId = self.cache_hashes && self.cache_hashes.qweb; - var route = '/web/webclient/qweb/' + (cacheId ? cacheId : Date.now()) + '?mods=' + mods; + var route = '/web/webclient/qweb/' + (cacheId ? cacheId : Date.now()) + '?mods='; //+ mods; // ?? return $.get(route).then(function (doc) { if (!doc) { return; } const owlTemplates = []; diff --git a/addons/web/static/src/js/core/translation.js b/addons/web/static/src/js/core/translation.js index 5335f4716a793..22eb9483a9702 100644 --- a/addons/web/static/src/js/core/translation.js +++ b/addons/web/static/src/js/core/translation.js @@ -67,7 +67,8 @@ var TranslationDataBase = Class.extend(/** @lends instance.TranslationDataBase# url = url || '/web/webclient/translations'; url += '/' + (cacheId ? cacheId : Date.now()); return $.get(url, { - mods: modules ? modules.join(',') : null, + // mods: modules ? modules.join(',') : null, + mods: null, lang: lang || null, }).then(function (trans) { self.set_bundle(trans);