From 1312ee72cf35e3887721ac56472f1188f636ec61 Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Thu, 19 Oct 2017 12:00:50 +0200 Subject: [FIX] web: correctly render the field image Before this commit, the image was directly built without using the corresponding template, which set some properties on the image (class, width, etc.). --- addons/web/static/src/js/fields/basic_fields.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 3985202fbd4..21205bfc033 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1129,7 +1129,6 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ supportedFieldTypes: ['binary'], _render: function () { var self = this; - var attrs = this.attrs; var url = this.placeholder; if (this.value) { if (!utils.is_bin_size(this.value)) { @@ -1144,11 +1143,7 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ }); } } - var $img = $('').attr('src', url); - $img.css({ - width: this.nodeOptions.size ? this.nodeOptions.size[0] : attrs.img_width || attrs.width, - height: this.nodeOptions.size ? this.nodeOptions.size[1] : attrs.img_height || attrs.height, - }); + var $img = $(qweb.render("FieldBinaryImage-img", {widget: this, url: url})); this.$('> img').remove(); this.$el.prepend($img); $img.on('error', function () { -- cgit v1.2.3