Hello,
in a customized report, i have added a data table to present tasks in the report but i need some tasks to be presented in the report, how do I filter and sort the table?
Thank you,
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello,
in a customized report, i have added a data table to present tasks in the report but i need some tasks to be presented in the report, how do I filter and sort the table?
Thank you,
Hi,
In your custom Odoo report, if you have successfully included all the task records, you can further refine the displayed data by applying filters and sorting directly in the report logic. Here are detailed examples:
1. Apply Domain Filtering:
if you only want to include tasks that are in progress and belong to a specific project, you can specify this in the domain.
domain = [
('state', '=', 'in_progress'),
('project_id', '=', specific_project_id)
]
tasks = self.env['project.task'].search(domain)
2. Use .filtered() Operation.
filtered_task = tasks.filtered(lambda t: t.name == any_name)
Apply additional filtering to include tasks with a specific name for example. This method allows for more complex filtering that doesn't directly translate into a domain
3. Sorting Tasks Using .sorted()
sorted_tasks = filtered_tasks.sorted(key=lambda t: t.created_date)
The .sorted() method sorts these tasks, enabling you to display them in a logical order in the report.
Hope it helps
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
sept 24
|
1862 | ||
How do i create report in Qweb?
Resuelto
|
|
5
ago 19
|
46480 | |
|
4
jun 18
|
20028 | ||
|
0
jun 18
|
3254 | ||
|
2
may 16
|
16881 |
Have you succeeded in bring all the tasks record into the record, if yes before do that you can try use filtered() method or sorted() method