[FIX] web: image fields re-render on next/previous

By default, on binary images read, the server returns the binary size
This is possible that two images have the exact same size
Therefore we trigger the change in case the image value hasn't changed
So the image is re-rendered correctly
This commit is contained in:
Denis Ledoux 2014-08-11 14:39:50 +02:00
parent 2b0487113a
commit 3632949cff
1 changed files with 14 additions and 0 deletions

View File

@ -5194,6 +5194,20 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
this._super.apply(this, arguments);
this.render_value();
this.set_filename('');
},
set_value: function(value_){
var changed = value_ !== this.get_value();
this._super.apply(this, arguments);
// By default, on binary images read, the server returns the binary size
// This is possible that two images have the exact same size
// Therefore we trigger the change in case the image value hasn't changed
// So the image is re-rendered correctly
if (!changed){
this.trigger("change:value", this, {
oldValue: value_,
newValue: value_
});
}
}
});