Before this commit, each module override _get_translation_frontend_modules_domain from ir.http to add its own translation in website if needed and that module is not starting by website_. Updating the domain from the super() call. Since we know in most of the case the name, it is useless to do a: select name from module where name = 'name1' or name = 'name2'... Now we support a new override of _get_translation_frontend_modules_name that will allow to add the known module name directly in the list instead to make a search. In case nobody override _get_translation_frontend_modules_domain, we don't need to make an extra rpc to find the module. Related to #47257 task-2211013 X-original-commit: 0dc54814161ab55c34dd2242f65dea23d19fdfca
27 lines
951 B
Python
27 lines
951 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
from odoo.http import request
|
|
|
|
|
|
class IrHttp(models.AbstractModel):
|
|
_inherit = 'ir.http'
|
|
|
|
@classmethod
|
|
def _dispatch(cls):
|
|
context = dict(request.context)
|
|
if 'editable' in request.httprequest.args and 'editable' not in context:
|
|
context['editable'] = True
|
|
if 'edit_translations' in request.httprequest.args and 'edit_translations' not in context:
|
|
context['edit_translations'] = True
|
|
if context.get('edit_translations') and 'translatable' not in context:
|
|
context['translatable'] = True
|
|
request.context = context
|
|
return super(IrHttp, cls)._dispatch()
|
|
|
|
@classmethod
|
|
def _get_translation_frontend_modules_name(cls):
|
|
mods = super(IrHttp, cls)._get_translation_frontend_modules_name()
|
|
return mods + ['web_editor']
|