[FIX] fixed problems with images in kanban o2m
bzr revid: nicolas.vanhoren@openerp.com-20120808091532-zjnvgpx33nkwj1z8
This commit is contained in:
parent
71cd55490a
commit
5d41615217
|
@ -4606,7 +4606,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
|
|||
},
|
||||
render_value: function() {
|
||||
var url;
|
||||
if (this.get('value') && this.get('value').substr(0, 10).indexOf(' ') == -1) {
|
||||
if (this.get('value') && ! /^\d+(\.\d*)? \w+$/.test(this.get('value'))) {
|
||||
url = 'data:image/png;base64,' + this.get('value');
|
||||
} else if (this.get('value')) {
|
||||
url = '/web/binary/image?session_id=' + this.session.session_id + '&model=' +
|
||||
|
|
|
@ -750,14 +750,17 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({
|
|||
return 'http://www.gravatar.com/avatar/' + email_md5 + '.png?s=' + size + '&d=' + default_;
|
||||
},
|
||||
kanban_image: function(model, field, id, cache) {
|
||||
id = id || '';
|
||||
var url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
|
||||
if (cache !== undefined) {
|
||||
// Set the cache duration in seconds.
|
||||
url += '&cache=' + parseInt(cache, 10);
|
||||
}
|
||||
var url;
|
||||
if (this.record[field] && this.record[field].value && ! /^\d+(\.\d*)? \w+$/.test(this.record[field].value)) {
|
||||
url = 'data:image/png;base64,' + this.record[field].value;
|
||||
} else if (this.record[field] && ! this.record[field].value) {
|
||||
url = "/web/static/src/img/placeholder.png";
|
||||
} else {
|
||||
url = instance.connection.prefix + '/web/binary/image?session_id=' + this.session.session_id + '&model=' + model + '&field=' + field + '&id=' + id;
|
||||
if (cache !== undefined) {
|
||||
// Set the cache duration in seconds.
|
||||
url += '&cache=' + parseInt(cache, 10);
|
||||
}
|
||||
}
|
||||
return url;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue