From 2e540eb3c1c712adfaaa23b497c6ae39494ab372 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Fri, 3 Mar 2017 12:14:25 +0100 Subject: [FIX] *: apply changes from web_studio The new views and widgets (at least some of them) first landed in web_studio (v10), and they we moved later to web, so changes in web_studio need to be applied in web. --- addons/web/static/src/js/fields/basic_fields.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index af2fdb50349..15bb042c072 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -117,7 +117,7 @@ var InputField = AbstractField.extend({ }); var FieldChar = InputField.extend({ - supportedFieldTypes: ['char', 'text'], + supportedFieldTypes: ['char'], tagName: 'span', }); @@ -125,7 +125,7 @@ var FieldDate = InputField.extend({ className: "o_form_field_date", tagName: "span", replace_element: true, - supportedFieldTypes: ['date', 'datetime'], + supportedFieldTypes: ['date'], start: function () { var self = this; @@ -711,7 +711,11 @@ var PriorityWidget = AbstractField.extend({ this._setValue(new_value); }, }, - supportedFieldTypes: ['integer'], + supportedFieldTypes: ['selection'], + + is_set: function() { + return true; + }, render_star: function (tag, is_full, value, tip) { return $(tag) .attr('title', tip) @@ -722,11 +726,13 @@ var PriorityWidget = AbstractField.extend({ }, _render: function () { var self = this; - var value = parseInt(this.value, 10); + var index_value = this.value ? _.findIndex(this.field.selection, function (v) { + return v[0] === self.value; + }) : 0; this.$el.empty(); this.empty_value = this.field.selection[0][0]; - _.each(this.field.selection.slice(1), function (choice) { - self.$el.append(self.render_star('', value >= parseInt(choice[0]), choice[0], choice[1])); + _.each(this.field.selection.slice(1), function(choice, index) { + self.$el.append(self.render_star('', index_value >= index+1, choice[1])); }); }, }); @@ -851,7 +857,7 @@ var FieldBooleanButton = AbstractField.extend({ }); var FieldID = InputField.extend({ - supportedFieldTypes: ['integer'], + supportedFieldTypes: ['id'], init: function () { this._super.apply(this, arguments); this.mode = 'readonly'; -- cgit v1.2.3