mirror of https://github.com/OCA/web.git
commit
0df646680c
|
@ -66,6 +66,8 @@ the possible attributes for the tag:
|
|||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| colors | No | Allows to set certain specific colors if the expressed condition (JS syntax) is met. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| color-field | No | Allows to set a field (on the current model) that contains the HTML color (e.g. #FFFFFF). This option has priority over 'colors'. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ the possible attributes for the tag:
|
|||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| colors | No | Allows to set certain specific colors if the expressed condition (JS syntax) is met. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| color-field | No | Allows to set a field (on the current model) that contains the HTML color (e.g. #FFFFFF). This option has priority over 'colors'. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
|
|
@ -421,11 +421,16 @@ odoo.define('web_timeline.TimelineRenderer', function (require) {
|
|||
} else {
|
||||
group = -1;
|
||||
}
|
||||
_.each(self.colors, function (color) {
|
||||
if (eval("'" + evt[color.field] + "' " + color.opt + " '" + color.value + "'")) {
|
||||
self.color = color.color;
|
||||
}
|
||||
});
|
||||
var color = null;
|
||||
if (self.arch.attrs.color_field !== undefined) {
|
||||
color = evt[self.arch.attrs.color_field];
|
||||
} else {
|
||||
_.each(self.colors, function (col) {
|
||||
if (eval("'" + evt[col.field] + "' " + col.opt + " '" + col.value + "'")) {
|
||||
color = col.color;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var content = _.isUndefined(evt.__name) ? evt.display_name : evt.__name;
|
||||
if (this.arch.children.length) {
|
||||
|
@ -438,13 +443,12 @@ odoo.define('web_timeline.TimelineRenderer', function (require) {
|
|||
'id': evt.id,
|
||||
'group': group,
|
||||
'evt': evt,
|
||||
'style': 'background-color: ' + self.color + ';'
|
||||
'style': 'background-color: ' + color + ';'
|
||||
};
|
||||
// Check if the event is instantaneous, if so, display it with a point on the timeline (no 'end')
|
||||
if (date_stop && !moment(date_start).isSame(date_stop)) {
|
||||
r.end = date_stop;
|
||||
}
|
||||
self.color = null;
|
||||
return r;
|
||||
},
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ odoo.define('web_timeline.TimelineView', function (require) {
|
|||
"default_group_by",
|
||||
"progress",
|
||||
"date_delay",
|
||||
"color_field",
|
||||
];
|
||||
|
||||
fieldsToGather.push(attrs.default_group_by);
|
||||
|
|
Loading…
Reference in New Issue