[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({
|
||||
supportedFieldTypes: ['text'],
|
||||
render: function() {
|
||||
var self = this;
|
||||
var info = JSON.parse(this.value);
|
||||
|
||||
@@ -101,6 +101,7 @@ WebClient.include({
|
||||
});
|
||||
|
||||
var Many2ManyAttendee = FieldMany2ManyTags.extend({
|
||||
supported_field_types: [],
|
||||
tag_template: "Many2ManyAttendeeTag",
|
||||
// FIXME: This widget used to refetch the relational data fields needed to
|
||||
// its rendering. Basically, all usual fields for tags plus "status".
|
||||
|
||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
||||
|
||||
var PresenceIndicator = AbstractField.extend({
|
||||
template: 'PresenceIndicator',
|
||||
supportedFieldTypes: ['selection'],
|
||||
|
||||
start: function() {
|
||||
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: {
|
||||
'click .o_add_button': 'set_order_line',
|
||||
},
|
||||
supported_field_types: [],
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.lunch_data = {};
|
||||
|
||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
||||
|
||||
|
||||
var SetBulletStatus = AbstractField.extend({
|
||||
supportedFieldTypes: ['selection'],
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.classes = this.nodeOptions && this.nodeOptions.classes || {};
|
||||
@@ -28,7 +27,6 @@ var SetBulletStatus = AbstractField.extend({
|
||||
});
|
||||
|
||||
var TimeCounter = AbstractField.extend({
|
||||
supportedFieldTypes: ['float'],
|
||||
start_time_counter: function(){
|
||||
var self = this;
|
||||
clearTimeout(this.timer);
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -117,6 +117,7 @@ var FieldMany2One = AbstractRelationalField.extend({
|
||||
'click .o_external_button': '_onExternalButtonClick',
|
||||
'click': '_onClick',
|
||||
}),
|
||||
supported_field_types: ['many2one'],
|
||||
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
@@ -119,6 +119,7 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, {
|
||||
events: _.extend({}, FieldBoolean.prototype.events, {
|
||||
'click input': '_onInputClicked',
|
||||
}),
|
||||
supported_field_types: [],
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
@@ -142,6 +143,7 @@ var UpgradeRadio = FieldRadio.extend(AbstractFieldUpgrade, {
|
||||
events: _.extend({}, FieldRadio.prototype.events, {
|
||||
'click input:last': '_onInputClicked',
|
||||
}),
|
||||
supported_field_types: [],
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
|
||||
@@ -7,11 +7,11 @@ var field_registry = require('web.field_registry');
|
||||
var field_utils = require('web.field_utils');
|
||||
var framework = require('web.framework');
|
||||
var session = require('web.session');
|
||||
var time = require('web.time');
|
||||
var utils = require('web.utils');
|
||||
var Widget = require('web.Widget');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
var _t = core._t;
|
||||
|
||||
var KanbanRecord = Widget.extend({
|
||||
template: 'KanbanView.record',
|
||||
@@ -96,27 +96,34 @@ var KanbanRecord = Widget.extend({
|
||||
// the widget doesn't exist yet, so instanciate it
|
||||
var Widget = field_registry.getAny(['kanban.' + field_widget, field_widget]);
|
||||
|
||||
// some field's attrs might be record dependent (they start with
|
||||
// 't-att-') and should thus be evaluated, which is done by qweb
|
||||
// we here replace those attrs in the dict of attrs of the state
|
||||
// by their evaluted value, to make it transparent from the
|
||||
// field's widgets point of view
|
||||
// that dict being shared between records, we don't modify it
|
||||
// in place
|
||||
var attrs = Object.create(null);
|
||||
_.each(self.state.fieldAttrs[field_name], function (value, key) {
|
||||
if (_.str.startsWith(key, 't-att-')) {
|
||||
key = key.slice(6);
|
||||
value = $field.attr(key);
|
||||
}
|
||||
attrs[key] = value;
|
||||
});
|
||||
self.state.fieldAttrs[field_name] = attrs;
|
||||
if (Widget) {
|
||||
// some field's attrs might be record dependent (they start with
|
||||
// 't-att-') and should thus be evaluated, which is done by qweb
|
||||
// we here replace those attrs in the dict of attrs of the state
|
||||
// by their evaluted value, to make it transparent from the
|
||||
// field's widgets point of view
|
||||
// that dict being shared between records, we don't modify it
|
||||
// in place
|
||||
var attrs = Object.create(null);
|
||||
_.each(self.state.fieldAttrs[field_name], function (value, key) {
|
||||
if (_.str.startsWith(key, 't-att-')) {
|
||||
key = key.slice(6);
|
||||
value = $field.attr(key);
|
||||
}
|
||||
attrs[key] = value;
|
||||
});
|
||||
self.state.fieldAttrs[field_name] = attrs;
|
||||
|
||||
widget = new Widget(self, field_name, self.state, self.options);
|
||||
self.sub_widgets[field_name] = widget;
|
||||
self._set_field_display(widget, field_name);
|
||||
widget.replace($field);
|
||||
widget = new Widget(self, field_name, self.state, self.options);
|
||||
self.sub_widgets[field_name] = widget;
|
||||
self._set_field_display(widget, field_name);
|
||||
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 {
|
||||
// a widget already exists for that field, so reset it with the new state
|
||||
widget.reset(self.state);
|
||||
|
||||
@@ -10,7 +10,6 @@ var _t = core._t;
|
||||
|
||||
var WidgetWebsiteButton = AbstractField.extend({
|
||||
template: 'WidgetWebsiteButton',
|
||||
supportedFieldTypes: ['boolean'],
|
||||
|
||||
render: function () {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
Reference in New Issue
Block a user