Skip to content

Commit

Permalink
[FIX] web: image fields re-render on next/previous
Browse files Browse the repository at this point in the history
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
  • Loading branch information
beledouxdenis committed Aug 11, 2014
1 parent 2b04871 commit 3632949
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions addons/web/static/src/js/view_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_
});
}
}
});

Expand Down

0 comments on commit 3632949

Please sign in to comment.