[FIX] web_editor: Avoid twice translated for static xml

Avoid texts to be translated twice if some modules have the translated
value corresponding to the English source term.

To reproduce: create a translation for static xml (comment 'openerp-web')
with 'Modifier' translated by 'Tadaaa'. In french context, the 'Edit'
button in forms is translated by 'Tadaaa'.

Don't translate template in web_editor if we are in the backend because
the translations of all the modules have already been loaded and applied.
This commit is contained in:
Christophe Matthieu
2017-12-19 13:35:36 +01:00
committed by Nicolas Martinelli
parent f3da958fa1
commit 7dfdfa0103
+4 -1
View File
@@ -32,7 +32,10 @@ data.dom_ready = dom_ready;
var all_ready;
data.ready = function () {
if (!all_ready) {
all_ready = $.when(dom_ready, ajax.loadXML()).then(translations);
all_ready = $.when(dom_ready, ajax.loadXML());
if (!odoo._modules) {
all_ready.then(translations);
}
} else if(all_ready.state() === "resolved") { // can add async template
all_ready = $.when(dom_ready, ajax.loadXML());
}