[IMP] web: allow background-style images for custom models

The `FieldBinaryImage` assumes that the image mixin is used to manage
its fields - this is mostly true, until you use custom fields.

This commit makes using the 'background' option of the Image widget
possible by fallbacking the thumbnail field's name to the name of
the field itself instead of `image_128` when we're dealing with a custom
field.
This commit is contained in:
Damien Bouvy
2020-02-04 10:46:40 +00:00
parent 411dd85a80
commit ea4c934728
@@ -1875,7 +1875,8 @@ var FieldBinaryImage = AbstractFieldBinary.extend({
this.$el.addClass(this.attrs.class);
}
var urlThumb = this._getImageUrl(this.model, this.res_id, 'image_128', unique);
const image_field = this.field.manual ? this.name:'image_128';
var urlThumb = this._getImageUrl(this.model, this.res_id, image_field, unique);
this.$el.empty();
$img = this.$el;