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.js47
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,