Browse Source

[FIX] avoid to set the dirty flag on the view when not necessary, especially when the translate dialog is opened from the readonly view.

pull/4/head
Guewen Baconnier 11 years ago
parent
commit
aa3472a3a4
  1. 10
      web_translate_dialog/static/src/js/web_translate_dialog.js

10
web_translate_dialog/static/src/js/web_translate_dialog.js

@ -179,7 +179,15 @@ openerp.web_translate_dialog = function (instance) {
_.each(trads, function(data, code) { _.each(trads, function(data, code) {
if (code === self.view_language) { if (code === self.view_language) {
_.each(data, function(value, field) { _.each(data, function(value, field) {
self.view.fields[field].set_value(value);
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');
}
}); });
} }
trads_mutex.exec(function() { trads_mutex.exec(function() {

Loading…
Cancel
Save