summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js
index eb56844de14..d0662fe7cef 100644
--- a/addons/web/static/src/js/fields/basic_fields.js
+++ b/addons/web/static/src/js/fields/basic_fields.js
@@ -582,6 +582,7 @@ var FieldMonetary = InputField.extend({
this.formatOptions.currency = this.currency;
this.formatOptions.digits = [16, 2];
+ this.formatOptions.field_digits = this.nodeOptions.field_digits;
},
//--------------------------------------------------------------------------
@@ -1311,6 +1312,25 @@ var FieldBinaryFile = AbstractFieldBinary.extend({
},
});
+var FieldBinaryDownloadLink = AbstractFieldBinary.extend({
+ template: 'FieldBinaryDownloadLink',
+ events: _.extend({}, AbstractFieldBinary.prototype.events, {
+ 'click': function (ev) {
+ ev.stopPropagation();
+ },
+ }),
+ supportedFieldTypes: ['binary'],
+ init: function () {
+ this._super.apply(this, arguments);
+ this.filename = _t("Binary File");
+ if (this.nodeOptions.filename && this.recordData[this.nodeOptions.filename]) {
+ this.filename = this.recordData[this.nodeOptions.filename];
+ }
+ this.url = "data:application/octet-stream;base64," + this.value;
+ this.text = _t("Download");
+ },
+});
+
var PriorityWidget = AbstractField.extend({
// the current implementation of this widget makes it
// only usable for fields of type selection
@@ -2541,6 +2561,7 @@ return {
TranslatableFieldMixin: TranslatableFieldMixin,
DebouncedField: DebouncedField,
FieldEmail: FieldEmail,
+ FieldBinaryDownloadLink: FieldBinaryDownloadLink,
FieldBinaryFile: FieldBinaryFile,
FieldBinaryImage: FieldBinaryImage,
FieldBoolean: FieldBoolean,