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. |
|
| 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. |
|
| 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. |
|
| 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. |
|
| 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 {
|
} else {
|
||||||
group = -1;
|
group = -1;
|
||||||
}
|
}
|
||||||
_.each(self.colors, function (color) {
|
var color = null;
|
||||||
if (eval("'" + evt[color.field] + "' " + color.opt + " '" + color.value + "'")) {
|
if (self.arch.attrs.color_field !== undefined) {
|
||||||
self.color = color.color;
|
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;
|
var content = _.isUndefined(evt.__name) ? evt.display_name : evt.__name;
|
||||||
if (this.arch.children.length) {
|
if (this.arch.children.length) {
|
||||||
|
@ -438,13 +443,12 @@ odoo.define('web_timeline.TimelineRenderer', function (require) {
|
||||||
'id': evt.id,
|
'id': evt.id,
|
||||||
'group': group,
|
'group': group,
|
||||||
'evt': evt,
|
'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')
|
// 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)) {
|
if (date_stop && !moment(date_start).isSame(date_stop)) {
|
||||||
r.end = date_stop;
|
r.end = date_stop;
|
||||||
}
|
}
|
||||||
self.color = null;
|
|
||||||
return r;
|
return r;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ odoo.define('web_timeline.TimelineView', function (require) {
|
||||||
"default_group_by",
|
"default_group_by",
|
||||||
"progress",
|
"progress",
|
||||||
"date_delay",
|
"date_delay",
|
||||||
|
"color_field",
|
||||||
];
|
];
|
||||||
|
|
||||||
fieldsToGather.push(attrs.default_group_by);
|
fieldsToGather.push(attrs.default_group_by);
|
||||||
|
|
Loading…
Reference in New Issue