mirror of https://github.com/OCA/web.git
Merge 61852cbd1b
into a5338d576b
commit
502b05564e
|
@ -2,7 +2,7 @@
|
|||
Web timeline
|
||||
============
|
||||
|
||||
..
|
||||
..
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
|
@ -69,6 +69,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 from the model to specify the color of the bar, colors will take precedence if used |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
@ -257,7 +259,7 @@ promote its widespread use.
|
|||
|
||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-tarteo|
|
||||
|maintainer-tarteo|
|
||||
|
||||
This module is part of the `OCA/web <https://github.com/OCA/web/tree/16.0/web_timeline>`_ project on GitHub.
|
||||
|
||||
|
|
|
@ -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 | Gets the color for the bar from field named here, if specified colors are set after this color |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| dependency_arrow | No | Set this attribute to a x2many field to draw arrows between the records referenced in the x2many field. |
|
||||
+--------------------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
|||
this.date_stop = params.date_stop;
|
||||
this.date_delay = params.date_delay;
|
||||
this.colors = params.colors;
|
||||
this.color_field = params.color_field;
|
||||
this.fieldNames = params.fieldNames;
|
||||
this.default_group_by = params.default_group_by;
|
||||
this.dependency_arrow = params.dependency_arrow;
|
||||
|
@ -512,7 +513,9 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
|||
} else {
|
||||
group = -1;
|
||||
}
|
||||
|
||||
if (this.color_field) {
|
||||
this.color = evt[this.color_field];
|
||||
}
|
||||
for (const color of this.colors) {
|
||||
if (py.eval(`'${evt[color.field]}' ${color.opt} '${color.value}'`)) {
|
||||
this.color = color.color;
|
||||
|
|
|
@ -76,6 +76,11 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
|||
);
|
||||
fieldNames = _.union(fieldNames, archFieldNames);
|
||||
|
||||
if (attrs.color_field) {
|
||||
fieldNames.push(attrs.color_field);
|
||||
}
|
||||
const color_field = attrs.color_field;
|
||||
|
||||
const colors = this.parse_colors();
|
||||
for (const color of colors) {
|
||||
if (!fieldNames.includes(color.field)) {
|
||||
|
@ -111,6 +116,7 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
|||
this.rendererParams.date_stop = date_stop;
|
||||
this.rendererParams.date_delay = date_delay;
|
||||
this.rendererParams.colors = colors;
|
||||
this.rendererParams.color_field = color_field;
|
||||
this.rendererParams.fieldNames = fieldNames;
|
||||
this.rendererParams.default_group_by = attrs.default_group_by;
|
||||
this.rendererParams.min_height = min_height;
|
||||
|
|
Loading…
Reference in New Issue