Skip to content

Commit

Permalink
[IMP] allow pages to load without passing mods through url
Browse files Browse the repository at this point in the history
  • Loading branch information
enterlineconnor committed Nov 19, 2021
1 parent 4e7d813 commit 6984a42
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
11 changes: 6 additions & 5 deletions addons/http_routing/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class Routing(Home):

@http.route('/website/translations/<string:unique>', 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)
12 changes: 10 additions & 2 deletions addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,11 @@ def load_locale(self, lang):

@http.route('/web/webclient/qweb/<string:unique>', 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, [
Expand Down Expand Up @@ -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({
Expand Down
2 changes: 1 addition & 1 deletion addons/web/static/src/js/core/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down
3 changes: 2 additions & 1 deletion addons/web/static/src/js/core/translation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6984a42

Please sign in to comment.