From 4cdc1f4df2e01604ece0bdf85abd8753b54acfe9 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 11 Oct 2017 09:47:16 +0200 Subject: [PATCH] [FIX] base: avoid confusion between synchronize and update terms The action "Load a Translation" is wrongfully considered as only for installation of a new language (while it is for update too). The action "Synchronize Terms" is wrongfully considered as to refresh translations of installed language (while it is to generate empty translations). Rename to "Generate Missing Terms" The res.lang tree view encourage this misconception with a "update terms" that actually triggers a synchronize terms action. Change the triggered action to the "Load & Update" Move the list of languages to always visible in settings. This list is not very technical and will avoid to go to debug mode for basic actions like updating the sources of checking what languages are installed. Going less often to dev mode will hide the misleading "Synchronize Terms" action for normal users. Closes #19911 --- .../base/module/wizard/base_language_install.py | 13 ++++++++++++- .../base/module/wizard/base_update_translations.py | 9 +-------- .../module/wizard/base_update_translations_view.xml | 8 ++++---- odoo/addons/base/res/res_lang_view.xml | 4 ++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/odoo/addons/base/module/wizard/base_language_install.py b/odoo/addons/base/module/wizard/base_language_install.py index ae08af37587..438803ee388 100644 --- a/odoo/addons/base/module/wizard/base_language_install.py +++ b/odoo/addons/base/module/wizard/base_language_install.py @@ -8,11 +8,22 @@ class BaseLanguageInstall(models.TransientModel): _name = "base.language.install" _description = "Install Language" + @api.model + def _default_language(self): + """ Display the selected language when using the 'Update Terms' action + from the language list view + """ + if self._context.get('active_model') == 'res.lang': + lang = self.env['res.lang'].browse(self._context.get('active_id')) + return lang.code + return False + @api.model def _get_languages(self): return self.env['res.lang'].get_available() - lang = fields.Selection(_get_languages, string='Language', required=True) + lang = fields.Selection(_get_languages, string='Language', required=True, + default=_default_language) overwrite = fields.Boolean('Overwrite Existing Terms', help="If you check this box, your customized translations will be overwritten and replaced by the official ones.") state = fields.Selection([('init', 'init'), ('done', 'done')], diff --git a/odoo/addons/base/module/wizard/base_update_translations.py b/odoo/addons/base/module/wizard/base_update_translations.py index 8f487dbbafe..f9c9c0c8555 100644 --- a/odoo/addons/base/module/wizard/base_update_translations.py +++ b/odoo/addons/base/module/wizard/base_update_translations.py @@ -16,15 +16,8 @@ class BaseUpdateTranslations(models.TransientModel): langs = self.env['res.lang'].search([('active', '=', True), ('translatable', '=', True)]) return [(lang.code, lang.name) for lang in langs] - @api.model - def _default_language(self): - if self._context.get('active_model') == 'res.lang': - lang = self.env['res.lang'].browse(self._context.get('active_id')) - return lang.code - return False - lang = fields.Selection(_get_languages, 'Language', required=True, - default=_default_language) + lang = fields.Selection(_get_languages, 'Language', required=True) @api.model def _get_lang_name(self, lang_code): diff --git a/odoo/addons/base/module/wizard/base_update_translations_view.xml b/odoo/addons/base/module/wizard/base_update_translations_view.xml index cc127b39d1c..42baf0b04af 100644 --- a/odoo/addons/base/module/wizard/base_update_translations_view.xml +++ b/odoo/addons/base/module/wizard/base_update_translations_view.xml @@ -2,11 +2,11 @@ - Synchronize Terms + Generate Missing Terms base.update.translations -
- + +