diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-01-10 20:35:53 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-01-10 20:35:53 +0100 |
| commit | 782154da11975b9db4620d7d39df3b567f3abcdc (patch) | |
| tree | 8cfe110e53ccfcee7a06421d6367b88d51d60add /addons/web/static/src/js/fields/basic_fields.js | |
| parent | 61bb46c82ba8113dddc0a95bd86cb029fbbf110e (diff) | |
| parent | f6ef0c776096774fc4c6821449ab42cfc2f53e62 (diff) | |
[MERGE] forward port branch saas-11.1 up to f6ef0c77609
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 21 |
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, |
