From aa3472a3a491ed1f19a082b98a7862f948cd60e1 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 6 Dec 2013 14:53:11 +0100 Subject: [PATCH] [FIX] avoid to set the dirty flag on the view when not necessary, especially when the translate dialog is opened from the readonly view. --- .../static/src/js/web_translate_dialog.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web_translate_dialog/static/src/js/web_translate_dialog.js b/web_translate_dialog/static/src/js/web_translate_dialog.js index 124464fa..be66d719 100644 --- a/web_translate_dialog/static/src/js/web_translate_dialog.js +++ b/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) { if (code === self.view_language) { _.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() {