summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-03-03 12:14:25 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit2e540eb3c1c712adfaaa23b497c6ae39494ab372 (patch)
tree872091f6c28253c3c3d077a9cbbb8f19cba4952f /addons/web/static/src/js/fields/basic_fields.js
parent8d2336abb340d06c64ff62c398e4ec7f7eabe54c (diff)
[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.
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
-rw-r--r--addons/web/static/src/js/fields/basic_fields.js20
1 files changed, 13 insertions, 7 deletions
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('<a href="#">', value >= parseInt(choice[0]), choice[0], choice[1]));
+ _.each(this.field.selection.slice(1), function(choice, index) {
+ self.$el.append(self.render_star('<a href="#">', 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';