summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2019-02-06 13:20:39 +0000
committerSébastien Theys <seb@odoo.com>2019-02-06 13:20:39 +0000
commitf78b7a76d62d6b5f3e82f2f4a02b14981859df1f (patch)
treee556e1995821fa20af2adc93c346e059f99cdc84 /addons/web/static/src
parent724504ec1b930a18595021f359e2c9ed9e239baf (diff)
[FIX] web: fix kanban_image for binary data
`.value` is always bin size. By using `.raw_value` we allow the condition to be true when actually using binary data. This solves an issue when trying to display the image for a model being created since at that time the URL does not work yet since the model does not exist. Eg. website_sale extra images on product. This also prevents (potentially a lot of) unnecessary GET to fetch images for which we already have the binary data downloaded. Part of task 34045 PR: #30881
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_record.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_record.js b/addons/web/static/src/js/views/kanban/kanban_record.js
index 7e56ecf122b..3dc1d6788bf 100644
--- a/addons/web/static/src/js/views/kanban/kanban_record.js
+++ b/addons/web/static/src/js/views/kanban/kanban_record.js
@@ -183,10 +183,10 @@ var KanbanRecord = Widget.extend({
_getImageURL: function (model, field, id, cache, options) {
options = options || {};
var url;
- if (this.record[field] && this.record[field].value && !utils.is_bin_size(this.record[field].value)) {
+ if (this.record[field] && this.record[field].raw_value && !utils.is_bin_size(this.record[field].raw_value)) {
// Use magic-word technique for detecting image type
- url = 'data:image/' + this.file_type_magic_word[this.record[field].value[0]] + ';base64,' + this.record[field].value;
- } else if (this.record[field] && ! this.record[field].value) {
+ url = 'data:image/' + this.file_type_magic_word[this.record[field].raw_value[0]] + ';base64,' + this.record[field].raw_value;
+ } else if (this.record[field] && ! this.record[field].raw_value) {
url = "/web/static/src/img/placeholder.png";
} else {
if (_.isArray(id)) { id = id[0]; }