-
-
Notifications
You must be signed in to change notification settings - Fork 401
OLD 8.0 2015 02 06
Xavier Brochard edited this page Oct 29, 2021
·
1 revision
Conflict:
diff --cc addons/web/static/src/js/view_list.js
index 76745f9,1929dfe..0000000
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@@ -2304,10 -2304,18 +2304,24 @@@ instance.web.list.Binary = instance.web
_format: function (row_data, options) {
var text = _t("Download");
var value = row_data[this.id].value;
+ if (!value) {
+ return options.value_if_empty || '';
+ }
+
var download_url;
++<<<<<<< HEAD
+ download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});
+ if (this.filename) {
+ download_url += '&filename_field=' + this.filename;
++=======
+ if (value.substr(0, 10).indexOf(' ') == -1) {
+ download_url = "data:application/octet-stream;base64," + value;
+ } else {
+ download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});
+ if (this.filename) {
+ download_url += '&filename_field=' + this.filename;
+ }
++>>>>>>> odoo/8.0
}
if (this.filename && row_data[this.filename]) {
text = _.str.sprintf(_t("Download \"%s\""), instance.web.format_value(
resolved by
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -2304,10 +2304,18 @@ instance.web.list.Binary = instance.web.list.Column.extend({
_format: function (row_data, options) {
var text = _t("Download");
var value = row_data[this.id].value;
+ if (!value) {
+ return options.value_if_empty || '';
+ }
+
var download_url;
- download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});
- if (this.filename) {
- download_url += '&filename_field=' + this.filename;
+ if (value.substr(0, 10).indexOf(' ') == -1) {
+ download_url = "data:application/octet-stream;base64," + value;
+ } else {
+ download_url = instance.session.url('/web/binary/saveas', {model: options.model, field: this.id, id: options.id});
+ if (this.filename) {
+ download_url += '&filename_field=' + this.filename;
+ }
}
if (this.filename && row_data[this.filename]) {
text = _.str.sprintf(_t("Download \"%s\""), instance.web.format_value(
That's reverting the conflicting part from https://github.com/OCA/OCB/commit/a012b8fc335ab07f2349b170ced4ad5bde8f95af (if we get a base64 encoded bytesstream, still use that, even though we took care in this patch this this doesn't happen)
Committed as https://github.com/OCA/OCB/commit/fde0190 by @hbrunn
Website | Online Demo | Community | Documentation | Help