summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/translation_dialog.js
diff options
context:
space:
mode:
authorjvm-odoo <jvm@odoo.com>2020-02-12 07:18:28 +0000
committerjvm-odoo <jvm@odoo.com>2020-02-12 15:07:05 +0000
commitbf14a04010bcc486e1abe425b27ec4cf0b191b04 (patch)
treed66e447707fc03cc37dbebb6074d01daadd76f3d /addons/web/static/src/js/widgets/translation_dialog.js
parent9a4da8894fdb7b51e01fa05a3911ccf57b143563 (diff)
[FIX] web: fix translation dialog should use only active languages
Issue - Install CRM and at least 3 languages - Deactivate one of them - Go to CRM > Configuration > Activity Type - Edit an activity type and try to edit translation Traceback (Cannot read property '1' of undefined) Cause This is because all the translations are fetched but we don't look if the language they use is active. So at one moment, the relatedLanguage is undefined and we do relatedLanguage[1] Solution Filter the translation, to keep only the ones with an active language. OPW-2193969 closes odoo/odoo#45215 X-original-commit: 9d1259da1bfd60362ec93996f723a4e378434dc8 Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/widgets/translation_dialog.js')
-rw-r--r--addons/web/static/src/js/widgets/translation_dialog.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/addons/web/static/src/js/widgets/translation_dialog.js b/addons/web/static/src/js/widgets/translation_dialog.js
index 426ef68cb35..434b7ebcffe 100644
--- a/addons/web/static/src/js/widgets/translation_dialog.js
+++ b/addons/web/static/src/js/widgets/translation_dialog.js
@@ -57,10 +57,10 @@ odoo.define('web.TranslationDialog', function (require) {
this._super(),
this._loadLanguages().then((l) => {
this.languages = l;
+ return this._loadTranslations().then((t) => {
+ this.translations = t;
+ });
}),
- this._loadTranslations().then((t) => {
- this.translations = t;
- })
]).then(() => {
this.data = this.translations.map((term) => {
let relatedLanguage = this.languages.find((language) => language[0] === term.lang);
@@ -91,11 +91,12 @@ odoo.define('web.TranslationDialog', function (require) {
* @private
*/
_loadTranslations: function () {
+ const domain = [...this.domain, ['lang', 'in', this.languages.map(l => l[0])]];
return this._rpc({
model: 'ir.translation',
method: 'search_read',
fields: ['lang', 'src', 'value'],
- domain: this.domain,
+ domain: domain,
});
},
/**