[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.
This commit is contained in:
@@ -10,7 +10,6 @@ var QWeb = core.qweb;
|
|||||||
|
|
||||||
|
|
||||||
var ShowPaymentLineWidget = AbstractField.extend({
|
var ShowPaymentLineWidget = AbstractField.extend({
|
||||||
supportedFieldTypes: ['text'],
|
|
||||||
render: function() {
|
render: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
var info = JSON.parse(this.value);
|
var info = JSON.parse(this.value);
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ WebClient.include({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var Many2ManyAttendee = FieldMany2ManyTags.extend({
|
var Many2ManyAttendee = FieldMany2ManyTags.extend({
|
||||||
|
supported_field_types: [],
|
||||||
tag_template: "Many2ManyAttendeeTag",
|
tag_template: "Many2ManyAttendeeTag",
|
||||||
// FIXME: This widget used to refetch the relational data fields needed to
|
// FIXME: This widget used to refetch the relational data fields needed to
|
||||||
// its rendering. Basically, all usual fields for tags plus "status".
|
// its rendering. Basically, all usual fields for tags plus "status".
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
|||||||
|
|
||||||
var PresenceIndicator = AbstractField.extend({
|
var PresenceIndicator = AbstractField.extend({
|
||||||
template: 'PresenceIndicator',
|
template: 'PresenceIndicator',
|
||||||
supportedFieldTypes: ['selection'],
|
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
this.$el.tooltip({title: _t("Employee Presence<br/>Green: checked in<br/>Red: checked out"), trigger: 'hover'});
|
this.$el.tooltip({title: _t("Employee Presence<br/>Green: checked in<br/>Red: checked out"), trigger: 'hover'});
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ var LunchPreviousOrdersWidget = FieldMany2Many.extend({
|
|||||||
events: {
|
events: {
|
||||||
'click .o_add_button': 'set_order_line',
|
'click .o_add_button': 'set_order_line',
|
||||||
},
|
},
|
||||||
|
supported_field_types: [],
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.lunch_data = {};
|
this.lunch_data = {};
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
|||||||
|
|
||||||
|
|
||||||
var SetBulletStatus = AbstractField.extend({
|
var SetBulletStatus = AbstractField.extend({
|
||||||
supportedFieldTypes: ['selection'],
|
|
||||||
init: function() {
|
init: function() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.classes = this.nodeOptions && this.nodeOptions.classes || {};
|
this.classes = this.nodeOptions && this.nodeOptions.classes || {};
|
||||||
@@ -28,7 +27,6 @@ var SetBulletStatus = AbstractField.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var TimeCounter = AbstractField.extend({
|
var TimeCounter = AbstractField.extend({
|
||||||
supportedFieldTypes: ['float'],
|
|
||||||
start_time_counter: function(){
|
start_time_counter: function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ var InputField = AbstractField.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
var FieldChar = InputField.extend({
|
var FieldChar = InputField.extend({
|
||||||
supportedFieldTypes: ['char', 'text'],
|
supportedFieldTypes: ['char'],
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ var FieldDate = InputField.extend({
|
|||||||
className: "o_form_field_date",
|
className: "o_form_field_date",
|
||||||
tagName: "span",
|
tagName: "span",
|
||||||
replace_element: true,
|
replace_element: true,
|
||||||
supportedFieldTypes: ['date', 'datetime'],
|
supportedFieldTypes: ['date'],
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -711,7 +711,11 @@ var PriorityWidget = AbstractField.extend({
|
|||||||
this._setValue(new_value);
|
this._setValue(new_value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
supportedFieldTypes: ['integer'],
|
supportedFieldTypes: ['selection'],
|
||||||
|
|
||||||
|
is_set: function() {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
render_star: function (tag, is_full, value, tip) {
|
render_star: function (tag, is_full, value, tip) {
|
||||||
return $(tag)
|
return $(tag)
|
||||||
.attr('title', tip)
|
.attr('title', tip)
|
||||||
@@ -722,11 +726,13 @@ var PriorityWidget = AbstractField.extend({
|
|||||||
},
|
},
|
||||||
_render: function () {
|
_render: function () {
|
||||||
var self = this;
|
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.$el.empty();
|
||||||
this.empty_value = this.field.selection[0][0];
|
this.empty_value = this.field.selection[0][0];
|
||||||
_.each(this.field.selection.slice(1), function (choice) {
|
_.each(this.field.selection.slice(1), function(choice, index) {
|
||||||
self.$el.append(self.render_star('<a href="#">', value >= parseInt(choice[0]), choice[0], choice[1]));
|
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({
|
var FieldID = InputField.extend({
|
||||||
supportedFieldTypes: ['integer'],
|
supportedFieldTypes: ['id'],
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.mode = 'readonly';
|
this.mode = 'readonly';
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ var FieldMany2One = AbstractRelationalField.extend({
|
|||||||
'click .o_external_button': '_onExternalButtonClick',
|
'click .o_external_button': '_onExternalButtonClick',
|
||||||
'click': '_onClick',
|
'click': '_onClick',
|
||||||
}),
|
}),
|
||||||
|
supported_field_types: ['many2one'],
|
||||||
|
|
||||||
init: function () {
|
init: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, {
|
|||||||
events: _.extend({}, FieldBoolean.prototype.events, {
|
events: _.extend({}, FieldBoolean.prototype.events, {
|
||||||
'click input': '_onInputClicked',
|
'click input': '_onInputClicked',
|
||||||
}),
|
}),
|
||||||
|
supported_field_types: [],
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Private
|
// Private
|
||||||
@@ -142,6 +143,7 @@ var UpgradeRadio = FieldRadio.extend(AbstractFieldUpgrade, {
|
|||||||
events: _.extend({}, FieldRadio.prototype.events, {
|
events: _.extend({}, FieldRadio.prototype.events, {
|
||||||
'click input:last': '_onInputClicked',
|
'click input:last': '_onInputClicked',
|
||||||
}),
|
}),
|
||||||
|
supported_field_types: [],
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// Public
|
// Public
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ var field_registry = require('web.field_registry');
|
|||||||
var field_utils = require('web.field_utils');
|
var field_utils = require('web.field_utils');
|
||||||
var framework = require('web.framework');
|
var framework = require('web.framework');
|
||||||
var session = require('web.session');
|
var session = require('web.session');
|
||||||
var time = require('web.time');
|
|
||||||
var utils = require('web.utils');
|
var utils = require('web.utils');
|
||||||
var Widget = require('web.Widget');
|
var Widget = require('web.Widget');
|
||||||
|
|
||||||
var QWeb = core.qweb;
|
var QWeb = core.qweb;
|
||||||
|
var _t = core._t;
|
||||||
|
|
||||||
var KanbanRecord = Widget.extend({
|
var KanbanRecord = Widget.extend({
|
||||||
template: 'KanbanView.record',
|
template: 'KanbanView.record',
|
||||||
@@ -96,27 +96,34 @@ var KanbanRecord = Widget.extend({
|
|||||||
// the widget doesn't exist yet, so instanciate it
|
// the widget doesn't exist yet, so instanciate it
|
||||||
var Widget = field_registry.getAny(['kanban.' + field_widget, field_widget]);
|
var Widget = field_registry.getAny(['kanban.' + field_widget, field_widget]);
|
||||||
|
|
||||||
// some field's attrs might be record dependent (they start with
|
if (Widget) {
|
||||||
// 't-att-') and should thus be evaluated, which is done by qweb
|
// some field's attrs might be record dependent (they start with
|
||||||
// we here replace those attrs in the dict of attrs of the state
|
// 't-att-') and should thus be evaluated, which is done by qweb
|
||||||
// by their evaluted value, to make it transparent from the
|
// we here replace those attrs in the dict of attrs of the state
|
||||||
// field's widgets point of view
|
// by their evaluted value, to make it transparent from the
|
||||||
// that dict being shared between records, we don't modify it
|
// field's widgets point of view
|
||||||
// in place
|
// that dict being shared between records, we don't modify it
|
||||||
var attrs = Object.create(null);
|
// in place
|
||||||
_.each(self.state.fieldAttrs[field_name], function (value, key) {
|
var attrs = Object.create(null);
|
||||||
if (_.str.startsWith(key, 't-att-')) {
|
_.each(self.state.fieldAttrs[field_name], function (value, key) {
|
||||||
key = key.slice(6);
|
if (_.str.startsWith(key, 't-att-')) {
|
||||||
value = $field.attr(key);
|
key = key.slice(6);
|
||||||
}
|
value = $field.attr(key);
|
||||||
attrs[key] = value;
|
}
|
||||||
});
|
attrs[key] = value;
|
||||||
self.state.fieldAttrs[field_name] = attrs;
|
});
|
||||||
|
self.state.fieldAttrs[field_name] = attrs;
|
||||||
|
|
||||||
widget = new Widget(self, field_name, self.state, self.options);
|
widget = new Widget(self, field_name, self.state, self.options);
|
||||||
self.sub_widgets[field_name] = widget;
|
self.sub_widgets[field_name] = widget;
|
||||||
self._set_field_display(widget, field_name);
|
self._set_field_display(widget, field_name);
|
||||||
widget.replace($field);
|
widget.replace($field);
|
||||||
|
} else if (core.debug) {
|
||||||
|
// the widget is not implemented
|
||||||
|
$field.replaceWith($('<span>', {
|
||||||
|
text: _.str.sprintf(_t('[No widget %s]'), field_widget),
|
||||||
|
}));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// a widget already exists for that field, so reset it with the new state
|
// a widget already exists for that field, so reset it with the new state
|
||||||
widget.reset(self.state);
|
widget.reset(self.state);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
|||||||
|
|
||||||
var WidgetWebsiteButton = AbstractField.extend({
|
var WidgetWebsiteButton = AbstractField.extend({
|
||||||
template: 'WidgetWebsiteButton',
|
template: 'WidgetWebsiteButton',
|
||||||
supportedFieldTypes: ['boolean'],
|
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|||||||
Reference in New Issue
Block a user