diff options
Diffstat (limited to 'addons/web/static/src/js/fields')
| -rw-r--r-- | addons/web/static/src/js/fields/basic_fields.js | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index d08c628c164..a5596648251 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -258,16 +258,36 @@ var FieldDateTime = FieldDate.extend({ var FieldMonetary = InputField.extend({ className: 'o_list_number', supportedFieldTypes: ['float', 'monetary'], - // FieldMonetary overrides _formatValue to ensure that the format_monetary - // method is used. This allows this widget to be used with other field - // types, such as float. + + //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + /** + * For monetary fields, 0 is a valid value. + * + * @override + */ + isSet: function () { + return this.value === 0 || this._super.apply(this, arguments); + }, + + //-------------------------------------------------------------------------- + // Private + //-------------------------------------------------------------------------- + + /** + * FieldMonetary overrides _formatValue to ensure that the format_monetary + * method is used. This allows this widget to be used with other field + * types, such as float. + * + * @override + * @private + * @param {float} value + */ _formatValue: function (value) { - var options = _.extend({}, this.nodeOptions, { data: this.recordData }); - return field_utils.format.monetary(value, this.field, options); + return field_utils.format.monetary(value, this.field, this.record_data, this.node_options); }, - isSet: function () { - return this.value !== false; - } }); var FieldBoolean = AbstractField.extend({ |
