diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-07-07 14:30:30 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-07-07 14:30:30 +0200 |
| commit | bf51fe55a149fb642a410f579dc4b6dcbd794eac (patch) | |
| tree | f4f208f06094bcef6541fd1fc034e0265de4ad21 /addons/web/static/src/js/fields/basic_fields.js | |
| parent | bf32940142beb879211b7034bb77a7845c9d0555 (diff) | |
| parent | 0f2b2c4e2b99df8d68456016a4bea86e26c1c80e (diff) | |
[MERGE] forward port branch saas-16 up to 0f2b2c4e2b9
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 82970255b3e..1868a29a237 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -17,7 +17,6 @@ var dom = require('web.dom'); var Domain = require('web.Domain'); var DomainSelector = require('web.DomainSelector'); var DomainSelectorDialog = require('web.DomainSelectorDialog'); -var field_utils = require('web.field_utils'); var framework = require('web.framework'); var session = require('web.session'); var utils = require('web.utils'); @@ -476,15 +475,14 @@ var FieldMonetary = InputField.extend({ this._setCurrency(); - if (this.mode === 'edit' && this.currency) { + if (this.mode === 'edit') { this.tagName = 'div'; this.className += ' o_input'; - } - // use the formatFloat function in edit - if (this.mode === 'edit') { + // use the formatFloat function in edit this.formatType = 'float'; } + this.formatOptions.currency = this.currency; this.formatOptions.digits = [16, 2]; }, @@ -514,20 +512,19 @@ var FieldMonetary = InputField.extend({ * @private */ _renderEdit: function () { - if (!this.currency) { - this._super.apply(this, arguments); - return; - } - this.$el.empty(); + // Prepare and add the input this._prepareInput().appendTo(this.$el); - // prepare and add the currency symbol - var $currencySymbol = $('<span>', {text: this.currency.symbol}); - if (this.currency.position === "after") { - this.$el.append($currencySymbol); - } else { - this.$el.prepend($currencySymbol); + + if (this.currency) { + // Prepare and add the currency symbol + var $currencySymbol = $('<span>', {text: this.currency.symbol}); + if (this.currency.position === "after") { + this.$el.append($currencySymbol); + } else { + this.$el.prepend($currencySymbol); + } } }, /** @@ -791,6 +788,23 @@ var FieldText = InputField.extend(TranslatableFieldMixin, { } return this._super(); }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * Stops the enter navigation in a text area. + * + * @private + * @param {OdooEvent} ev + */ + _onKeydown: function (ev) { + if (ev.which === $.ui.keyCode.ENTER) { + return; + } + this._super.apply(this, arguments); + }, }); /** @@ -2237,6 +2251,7 @@ var AceEditor = DebouncedField.extend({ }); return { + TranslatableFieldMixin: TranslatableFieldMixin, DebouncedField: DebouncedField, FieldEmail: FieldEmail, FieldBinaryFile: FieldBinaryFile, |
