[MERGE] forward port branch saas-16 up to b8540eefe3

This commit is contained in:
Christophe Simonis
2017-12-06 11:59:38 +01:00
34 changed files with 228 additions and 55 deletions
@@ -1219,7 +1219,7 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
template: 'FieldBinaryFile',
events: _.extend({}, AbstractFieldBinary.prototype.events, {
'click': function (event) {
if (this.mode === 'readonly' && this.value) {
if (this.mode === 'readonly' && this.value && this.recordData.id) {
this.on_save_as(event);
}
},
@@ -1236,10 +1236,20 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
this.do_toggle(!!this.value);
if (this.value) {
this.$el.empty().append($("<span/>").addClass('fa fa-download'));
if (this.recordData.id) {
this.$el.css('cursor', 'pointer');
} else {
this.$el.css('cursor', 'not-allowed');
}
if (this.filename_value) {
this.$el.append(" " + this.filename_value);
}
}
if (!this.res_id) {
this.$el.css('cursor', 'not-allowed');
} else {
this.$el.css('cursor', 'pointer');
}
},
_renderEdit: function () {
if (this.value) {
@@ -1264,7 +1274,7 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
if (!this.value) {
this.do_warn(_t("Save As..."), _t("The field is empty, there's nothing to save !"));
ev.stopPropagation();
} else {
} else if (this.res_id) {
framework.blockUI();
var c = crash_manager;
var filename_fieldname = this.attrs.filename;