Use get method in Binary widget when field has not get_data method

The binary widget can be used with non-binary field which does not have
get_data method like Char.

issue5989
review29701002
This commit is contained in:
Cédric Krier
2016-10-28 19:22:18 +02:00
parent 64c6426593
commit 306f5dd7ca
+7 -1
View File
@@ -2936,7 +2936,13 @@
var mimetype = params.mimetype || 'application/octet-binary';
var field = this.field();
var record = this.record();
field.get_data(record).done(function(data) {
var prm;
if (field.get_data) {
prm = field.get_data(record);
} else {
prm = jQuery.when(field.get(record));
}
prm.done(function(data) {
var blob = new Blob([data], {type: mimetype});
var blob_url = window.URL.createObjectURL(blob);
if (this.blob_url) {