summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorHarshad Modi <hmo@odoo.com>2017-06-07 13:45:04 +0530
committerged-odoo <ged@odoo.com>2017-06-07 10:15:04 +0200
commit922a04dbd2acbd547c0279b046099647c5f9eb3f (patch)
treef146f7283ef685c67d56042dfd0a19bf563cd540 /addons/web/static/src
parentac1fad575e8e6b668e4fb7d42340af8b0058b952 (diff)
[FIX] project: fix traceback while setting cover image
from project task kanban view (PR #17165)
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js22
-rw-r--r--addons/web/static/src/xml/base.xml5
2 files changed, 20 insertions, 7 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index a5ceba50d3f..d4013a8bcdb 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -1281,8 +1281,26 @@ var PriorityWidget = AbstractField.extend({
},
});
-var AttachmentImage = AbstractField.extend({
- template: 'AttachmentImage',
+var AttachmentImage = AbstractField.extend({
+ className: 'o_attachment_image',
+
+ //--------------------------------------------------------------------------
+ // Private
+ //--------------------------------------------------------------------------
+
+ /**
+ * Reset cover image when widget value change
+ *
+ * @private
+ */
+ _render: function () {
+ if (this.value) {
+ this.$el.empty().append($('<img>/', {
+ src: "/web/image/" + this.value.data.id + "?unique=1",
+ title: this.value.data.display_name
+ }));
+ }
+ }
});
var StateSelectionWidget = AbstractField.extend({
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index ccbf030ff1b..c4a3cc3939f 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -835,11 +835,6 @@
t-att-width="widget.node.attrs.img_width || widget.node.attrs.width"
t-att-height="widget.node.attrs.img_height || widget.node.attrs.height"/>
</t>
-<t t-name="AttachmentImage">
- <div class="o_attachment_image">
- <img t-att-src="'/web/image/' + widget.value + '?unique=1'"/>
- </div>
-</t>
<t t-name="FieldBinaryFile">
<a t-if="widget.mode === 'readonly'" href="javascript:void(0)" class="o_form_uri"/>