mirror of https://github.com/OCA/web.git
[FIX] web_timeline: Allow groupby m2m fields
parent
948716086c
commit
ee1e65db87
|
@ -14,13 +14,13 @@ Web timeline
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/web/tree/14.0/web_timeline
|
:target: https://github.com/OCA/web/tree/15.0/web_timeline
|
||||||
:alt: OCA/web
|
:alt: OCA/web
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_timeline
|
:target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_timeline
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||||
:target: https://runbot.odoo-community.org/runbot/162/14.0
|
:target: https://runbot.odoo-community.org/runbot/162/15.0
|
||||||
:alt: Try me on Runbot
|
:alt: Try me on Runbot
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
@ -152,6 +152,12 @@ Known issues / Roadmap
|
||||||
* Implement a more efficient way of refreshing timeline after a record update;
|
* Implement a more efficient way of refreshing timeline after a record update;
|
||||||
* Make `attrs` attribute work;
|
* Make `attrs` attribute work;
|
||||||
* Make action attributes work (create, edit, delete) like in form and tree views.
|
* Make action attributes work (create, edit, delete) like in form and tree views.
|
||||||
|
* When grouping by m2m and more than one record is set, the timeline item appears only
|
||||||
|
on one group. Allow showing in both groups.
|
||||||
|
* When grouping by m2m and dragging for changing the time or the group, the changes on
|
||||||
|
the group will not be set, because it could make disappear the records not related
|
||||||
|
with the changes that we want to make. When the item is showed in all groups change
|
||||||
|
the value according the group of the dragged item.
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
@ -159,7 +165,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/web/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
`feedback <https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -180,14 +186,17 @@ Contributors
|
||||||
|
|
||||||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
||||||
* Pedro M. Baeza <pedro.baeza@tecnativa.com>
|
|
||||||
* Leonardo Donelli <donelli@webmonks.it>
|
* Leonardo Donelli <donelli@webmonks.it>
|
||||||
* Adrien Didenot <adrien.didenot@horanet.com>
|
* Adrien Didenot <adrien.didenot@horanet.com>
|
||||||
* Dennis Sluijk <d.sluijk@onestein.nl>
|
* Dennis Sluijk <d.sluijk@onestein.nl>
|
||||||
* Thong Nguyen Van <thongnv@trobz.com>
|
* Thong Nguyen Van <thongnv@trobz.com>
|
||||||
* Alexandre Díaz <alexandre.diaz@tecnativa.com>
|
|
||||||
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
|
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
|
||||||
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
* Ammar Officewala <aofficewala@opensourceintegrators.com>
|
||||||
|
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||||
|
|
||||||
|
* Pedro M. Baeza
|
||||||
|
* Alexandre Díaz
|
||||||
|
* César A. Sánchez
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
@ -210,6 +219,6 @@ 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/14.0/web_timeline>`_ project on GitHub.
|
This module is part of the `OCA/web <https://github.com/OCA/web/tree/15.0/web_timeline>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"depends": ["web"],
|
"depends": ["web"],
|
||||||
"qweb": ["static/src/xml/web_timeline.xml"],
|
|
||||||
"data": [],
|
"data": [],
|
||||||
"maintainers": ["tarteo"],
|
"maintainers": ["tarteo"],
|
||||||
"application": False,
|
"application": False,
|
||||||
|
@ -29,6 +28,9 @@
|
||||||
"web_timeline/static/src/js/timeline_controller.js",
|
"web_timeline/static/src/js/timeline_controller.js",
|
||||||
"web_timeline/static/src/js/timeline_model.js",
|
"web_timeline/static/src/js/timeline_model.js",
|
||||||
"web_timeline/static/src/js/timeline_canvas.js",
|
"web_timeline/static/src/js/timeline_canvas.js",
|
||||||
]
|
],
|
||||||
|
"web.assets_qweb": [
|
||||||
|
"web_timeline/static/src/xml/web_timeline.xml",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
* Implement a more efficient way of refreshing timeline after a record update;
|
* Implement a more efficient way of refreshing timeline after a record update;
|
||||||
* Make `attrs` attribute work;
|
* Make `attrs` attribute work;
|
||||||
* Make action attributes work (create, edit, delete) like in form and tree views.
|
* Make action attributes work (create, edit, delete) like in form and tree views.
|
||||||
|
* When grouping by m2m and more than one record is set, the timeline item appears only
|
||||||
|
on one group. Allow showing in both groups.
|
||||||
|
* When grouping by m2m and dragging for changing the time or the group, the changes on
|
||||||
|
the group will not be set, because it could make disappear the records not related
|
||||||
|
with the changes that we want to make. When the item is showed in all groups change
|
||||||
|
the value according the group of the dragged item.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||||
<title>Web timeline</title>
|
<title>Web timeline</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||||
!! This file is generated by oca-gen-addon-readme !!
|
!! This file is generated by oca-gen-addon-readme !!
|
||||||
!! changes will be overwritten. !!
|
!! changes will be overwritten. !!
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_timeline"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_timeline"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_timeline"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_timeline"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/162/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>Define a new view displaying events in an interactive visualization chart.</p>
|
<p>Define a new view displaying events in an interactive visualization chart.</p>
|
||||||
<p>The widget is based on the external library
|
<p>The widget is based on the external library
|
||||||
<a class="reference external" href="https://visjs.github.io/vis-timeline/examples/timeline">https://visjs.github.io/vis-timeline/examples/timeline</a></p>
|
<a class="reference external" href="https://visjs.github.io/vis-timeline/examples/timeline">https://visjs.github.io/vis-timeline/examples/timeline</a></p>
|
||||||
|
@ -526,6 +526,12 @@ with the dragged start and end date.</p>
|
||||||
<li>Implement a more efficient way of refreshing timeline after a record update;</li>
|
<li>Implement a more efficient way of refreshing timeline after a record update;</li>
|
||||||
<li>Make <cite>attrs</cite> attribute work;</li>
|
<li>Make <cite>attrs</cite> attribute work;</li>
|
||||||
<li>Make action attributes work (create, edit, delete) like in form and tree views.</li>
|
<li>Make action attributes work (create, edit, delete) like in form and tree views.</li>
|
||||||
|
<li>When grouping by m2m and more than one record is set, the timeline item appears only
|
||||||
|
on one group. Allow showing in both groups.</li>
|
||||||
|
<li>When grouping by m2m and dragging for changing the time or the group, the changes on
|
||||||
|
the group will not be set, because it could make disappear the records not related
|
||||||
|
with the changes that we want to make. When the item is showed in all groups change
|
||||||
|
the value according the group of the dragged item.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
@ -533,7 +539,7 @@ with the dragged start and end date.</p>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/web/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
In case of trouble, please check there if your issue has already been reported.
|
||||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||||
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
<a class="reference external" href="https://github.com/OCA/web/issues/new?body=module:%20web_timeline%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -553,14 +559,18 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Laurent Mignon <<a class="reference external" href="mailto:laurent.mignon@acsone.eu">laurent.mignon@acsone.eu</a>></li>
|
<li>Laurent Mignon <<a class="reference external" href="mailto:laurent.mignon@acsone.eu">laurent.mignon@acsone.eu</a>></li>
|
||||||
<li>Adrien Peiffer <<a class="reference external" href="mailto:adrien.peiffer@acsone.eu">adrien.peiffer@acsone.eu</a>></li>
|
<li>Adrien Peiffer <<a class="reference external" href="mailto:adrien.peiffer@acsone.eu">adrien.peiffer@acsone.eu</a>></li>
|
||||||
<li>Pedro M. Baeza <<a class="reference external" href="mailto:pedro.baeza@tecnativa.com">pedro.baeza@tecnativa.com</a>></li>
|
|
||||||
<li>Leonardo Donelli <<a class="reference external" href="mailto:donelli@webmonks.it">donelli@webmonks.it</a>></li>
|
<li>Leonardo Donelli <<a class="reference external" href="mailto:donelli@webmonks.it">donelli@webmonks.it</a>></li>
|
||||||
<li>Adrien Didenot <<a class="reference external" href="mailto:adrien.didenot@horanet.com">adrien.didenot@horanet.com</a>></li>
|
<li>Adrien Didenot <<a class="reference external" href="mailto:adrien.didenot@horanet.com">adrien.didenot@horanet.com</a>></li>
|
||||||
<li>Dennis Sluijk <<a class="reference external" href="mailto:d.sluijk@onestein.nl">d.sluijk@onestein.nl</a>></li>
|
<li>Dennis Sluijk <<a class="reference external" href="mailto:d.sluijk@onestein.nl">d.sluijk@onestein.nl</a>></li>
|
||||||
<li>Thong Nguyen Van <<a class="reference external" href="mailto:thongnv@trobz.com">thongnv@trobz.com</a>></li>
|
<li>Thong Nguyen Van <<a class="reference external" href="mailto:thongnv@trobz.com">thongnv@trobz.com</a>></li>
|
||||||
<li>Alexandre Díaz <<a class="reference external" href="mailto:alexandre.diaz@tecnativa.com">alexandre.diaz@tecnativa.com</a>></li>
|
|
||||||
<li>Murtaza Mithaiwala <<a class="reference external" href="mailto:mmithaiwala@opensourceintegrators.com">mmithaiwala@opensourceintegrators.com</a>></li>
|
<li>Murtaza Mithaiwala <<a class="reference external" href="mailto:mmithaiwala@opensourceintegrators.com">mmithaiwala@opensourceintegrators.com</a>></li>
|
||||||
<li>Ammar Officewala <<a class="reference external" href="mailto:aofficewala@opensourceintegrators.com">aofficewala@opensourceintegrators.com</a>></li>
|
<li>Ammar Officewala <<a class="reference external" href="mailto:aofficewala@opensourceintegrators.com">aofficewala@opensourceintegrators.com</a>></li>
|
||||||
|
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
|
||||||
|
<li>Pedro M. Baeza</li>
|
||||||
|
<li>Alexandre Díaz</li>
|
||||||
|
<li>César A. Sánchez</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
|
@ -572,7 +582,7 @@ mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||||
<p><a class="reference external" href="https://github.com/tarteo"><img alt="tarteo" src="https://github.com/tarteo.png?size=40px" /></a></p>
|
<p><a class="reference external" href="https://github.com/tarteo"><img alt="tarteo" src="https://github.com/tarteo.png?size=40px" /></a></p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/14.0/web_timeline">OCA/web</a> project on GitHub.</p>
|
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/web/tree/15.0/web_timeline">OCA/web</a> project on GitHub.</p>
|
||||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -175,20 +175,29 @@ odoo.define("web_timeline.TimelineController", function (require) {
|
||||||
);
|
);
|
||||||
data[this.date_delay] = diff_seconds / 3600;
|
data[this.date_delay] = diff_seconds / 3600;
|
||||||
}
|
}
|
||||||
if (
|
const grouped_field = this.renderer.last_group_bys[0];
|
||||||
this.renderer.last_group_bys &&
|
this._rpc({
|
||||||
this.renderer.last_group_bys instanceof Array
|
model: this.modelName,
|
||||||
) {
|
method: "fields_get",
|
||||||
data[this.renderer.last_group_bys[0]] = group;
|
args: [grouped_field],
|
||||||
}
|
context: this.getSession().user_context,
|
||||||
|
}).then(async (fields_processed) => {
|
||||||
|
if (
|
||||||
|
this.renderer.last_group_bys &&
|
||||||
|
this.renderer.last_group_bys instanceof Array &&
|
||||||
|
fields_processed[grouped_field].type !== "many2many"
|
||||||
|
) {
|
||||||
|
data[this.renderer.last_group_bys[0]] = group;
|
||||||
|
}
|
||||||
|
|
||||||
this.moveQueue.push({
|
this.moveQueue.push({
|
||||||
id: event.data.item.id,
|
id: event.data.item.id,
|
||||||
data: data,
|
data: data,
|
||||||
event: event,
|
event: event,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.debouncedInternalMove();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.debouncedInternalMove();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -353,14 +353,15 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
data.push(this.event_data_transform(evt));
|
data.push(this.event_data_transform(evt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const groups = this.split_groups(events, group_bys);
|
this.split_groups(events, group_bys).then((groups) => {
|
||||||
this.timeline.setGroups(groups);
|
this.timeline.setGroups(groups);
|
||||||
this.timeline.setItems(data);
|
this.timeline.setItems(data);
|
||||||
const mode = !this.mode || this.mode === "fit";
|
const mode = !this.mode || this.mode === "fit";
|
||||||
const adjust = _.isUndefined(adjust_window) || adjust_window;
|
const adjust = _.isUndefined(adjust_window) || adjust_window;
|
||||||
if (mode && adjust) {
|
if (mode && adjust) {
|
||||||
this.timeline.fit();
|
this.timeline.fit();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,14 +372,15 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
* @private
|
* @private
|
||||||
* @returns {Array}
|
* @returns {Array}
|
||||||
*/
|
*/
|
||||||
split_groups: function (events, group_bys) {
|
split_groups: async function (events, group_bys) {
|
||||||
if (group_bys.length === 0) {
|
if (group_bys.length === 0) {
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
const groups = [];
|
const groups = [];
|
||||||
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>")});
|
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>")});
|
||||||
for (const evt of events) {
|
for (const evt of events) {
|
||||||
const group_name = evt[_.first(group_bys)];
|
const grouped_field = _.first(group_bys);
|
||||||
|
const group_name = evt[grouped_field];
|
||||||
if (group_name) {
|
if (group_name) {
|
||||||
if (group_name instanceof Array) {
|
if (group_name instanceof Array) {
|
||||||
const group = _.find(
|
const group = _.find(
|
||||||
|
@ -386,9 +388,38 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
(existing_group) => existing_group.id === group_name[0]
|
(existing_group) => existing_group.id === group_name[0]
|
||||||
);
|
);
|
||||||
if (_.isUndefined(group)) {
|
if (_.isUndefined(group)) {
|
||||||
groups.push({
|
// Check if group is m2m in this case add id -> value of all
|
||||||
id: group_name[0],
|
// found entries.
|
||||||
content: group_name[1],
|
await this._rpc({
|
||||||
|
model: this.modelName,
|
||||||
|
method: "fields_get",
|
||||||
|
args: [grouped_field],
|
||||||
|
context: this.getSession().user_context,
|
||||||
|
}).then(async (fields) => {
|
||||||
|
if (fields[grouped_field].type === "many2many") {
|
||||||
|
const list_values =
|
||||||
|
await this.get_m2m_grouping_datas(
|
||||||
|
fields[grouped_field].relation,
|
||||||
|
group_name
|
||||||
|
);
|
||||||
|
for (const vals of list_values) {
|
||||||
|
let is_inside = false;
|
||||||
|
for (const gr of groups) {
|
||||||
|
if (vals.id === gr.id) {
|
||||||
|
is_inside = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!is_inside) {
|
||||||
|
groups.push(vals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
groups.push({
|
||||||
|
id: group_name[0],
|
||||||
|
content: group_name[1],
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,6 +428,21 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
return groups;
|
return groups;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get_m2m_grouping_datas: async function (model, group_name) {
|
||||||
|
const groups = [];
|
||||||
|
for (const gr of group_name) {
|
||||||
|
await this._rpc({
|
||||||
|
model: model,
|
||||||
|
method: "name_get",
|
||||||
|
args: [gr],
|
||||||
|
context: this.getSession().user_context,
|
||||||
|
}).then((name) => {
|
||||||
|
groups.push({id: name[0][0], content: name[0][1]});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return groups;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get dates from given event
|
* Get dates from given event
|
||||||
*
|
*
|
||||||
|
|
|
@ -31,6 +31,7 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
||||||
Controller: TimelineController,
|
Controller: TimelineController,
|
||||||
Renderer: TimelineRenderer,
|
Renderer: TimelineRenderer,
|
||||||
}),
|
}),
|
||||||
|
viewType: "timeline",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @override
|
* @override
|
||||||
|
|
Loading…
Reference in New Issue