diff --git a/addons/web/i18n/web.pot b/addons/web/i18n/web.pot index 34868b04499..d1e7d728667 100644 --- a/addons/web/i18n/web.pot +++ b/addons/web/i18n/web.pot @@ -2067,8 +2067,7 @@ msgstr "" #. module: web #. openerp-web -#: code:addons/web/static/src/js/widgets/debug_manager.js:152 -#: code:addons/web/static/src/xml/base.xml:170 +#: code:addons/web/static/src/xml/base.xml:216 #, python-format msgid "Technical Translation" msgstr "" diff --git a/addons/web/static/src/js/widgets/debug_manager.js b/addons/web/static/src/js/widgets/debug_manager.js index 610dcd7819e..36a3a205632 100644 --- a/addons/web/static/src/js/widgets/debug_manager.js +++ b/addons/web/static/src/js/widgets/debug_manager.js @@ -5,6 +5,7 @@ var core = require('web.core'); var Dialog = require('web.Dialog'); var formats = require('web.formats'); var framework = require('web.framework'); +var Model = require('web.Model'); var session = require('web.session'); var SystrayMenu = require('web.SystrayMenu'); var utils = require('web.utils'); @@ -148,15 +149,9 @@ if (core.debug) { }); }, translate: function() { - this.do_action({ - name: _t("Technical Translation"), - res_model : 'ir.translation', - domain : [['type', '!=', 'object'], '|', ['name', '=', this.dataset.model], ['name', 'ilike', this.dataset.model + ',']], - views: [[false, 'list'], [false, 'form']], - type : 'ir.actions.act_window', - view_type : "list", - view_mode : "list" - }); + new Model("ir.translation") + .call('get_technical_translations', [this.dataset.model]) + .then(this.do_action); }, edit: function(params, evt) { this.do_action({ diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index 7adadc00151..6ebd2721bd9 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -712,3 +712,29 @@ class ir_translation(osv.osv): _logger.info('module %s: loading extra translation file (%s) for language %s', module_name, lang_code, lang) tools.trans_load(cr, trans_extra_file, lang, verbose=False, module_name=module_name, context=context) return True + + @api.model + def get_technical_translations(self, model_name): + """ Find the translations for the fields of `model_name` + + Find the technical translations for the fields of the model, including + string, tooltip and available selections. + + :return: action definition to open the list of available translations + """ + fields = self.env['ir.model.fields'].search([('model', '=', model_name)]) + view = self.env.ref("base.view_translation_tree", False) + return { + 'name': _("Technical Translation"), + 'view_mode': 'tree', + 'views': [(view and view.id or False, "list")], + 'res_model': 'ir.translation', + 'type': 'ir.actions.act_window', + 'domain': ['|', + '&',('type', '=', 'model'), + '&',('res_id', 'in', fields.ids), + ('name', 'like', 'ir.model.fields,'), + '&',('type', '=', 'selection'), + ('name', 'like', model_name+','), + ], + }