summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2019-12-17 16:29:13 +0000
committerDamien Bouvy <dbo@odoo.com>2020-02-04 10:46:40 +0000
commitea4c93472879f042f8aa343d5c42fa6c2bd5cfce (patch)
tree43f8484f9c49d95d27333819b6543c23f55df9c6 /addons/web
parent411dd85a80ac4aa93753465dc3cc96f74a8eb72b (diff)
[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.
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index 996e759a70a..f2c44891ea2 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -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;