Propagate the changes done in the translate dialog back to the view

pull/1312/head
Guewen Baconnier 2014-04-02 10:56:31 +02:00 committed by Timon Tschanz
parent 91f8c43147
commit 5163cf2e5c
1 changed files with 1 additions and 11 deletions

View File

@ -186,17 +186,7 @@ openerp.web_translate_dialog = function (instance) {
});
_.each(translations, function(data, code) {
if (code === self.view_language) {
_.each(data, function(value, field) {
var view_field = self.view.fields[field];
var is_dirty = view_field.view.$el.hasClass('oe_form_dirty');
// update the field on the view
view_field.set_value(value);
if ( !is_dirty ) {
// Avoid to set the view dirty when not necessary:
// values have already been saved.
view_field.view.$el.removeClass('oe_form_dirty');
}
});
self.view.set_values(data);
}
translation_mutex.exec(function() {
return new instance.web.DataSet(self, self.view.dataset.model, self.view.dataset.get_context()).write(self.view.datarecord.id, data, { context : { 'lang': code }});