Hello Odoo Community,
I’m currently working with Odoo v17 and I’ve encountered an issue while trying to create a custom filter for project tasks and their related activities in the calendar view. I would like to visualize all planned activities (linked to tasks) with their status in the calendar of the Project module, but I'm facing the following problems:
The Context:
- I want to filter and display activities (like meetings, calls, etc.) that are associated with tasks from the Project module.
- The main goal is to visualize these activities in the calendar view under the Project module, with their due dates, names, and statuses.
- However, Odoo seems to apply the filter at the task level (model project.task), displaying only the task names instead of the activity names created and set for these tasks.
The Problems I Encountered:
- Model issue: When applying the filter on the project.task model, I’m getting the task names rather than the names of the planned activities. This filter works fine for showing the tasks, but my goal is to see the activities linked to those tasks (from the mail.activity model).
- Missing information: Even though the activities are linked to tasks, the filter doesn’t pull in the activity-related fields like the activity name, deadline, or type of activity. Instead, it keeps displaying the task-related fields.
- Calendar view limitation: The current filter setup works in the task view, but it doesn't display the detailed information for each activity in the calendar view—only the task name is shown.
What I Tried:
- Filter based on project.task: I tried creating a filter using the activity_ids field in the project.task model, which successfully pulled the tasks that have associated activities. However, this only displayed the task names in the calendar, not the actual activity names or due dates.
- Deadline filter: I also attempted to apply a filter to ensure that only activities with a deadline (date_deadline) would appear, but the calendar still shows the task data instead of the activity data.
My Goal:
I need to create a filter that:
- Displays all activities (from mail.activity) related to tasks in the calendar view under the Project module.
- Shows the activity name, due date, and status in the calendar instead of just the task information.
- Filters by activity statuses like planned, completed, or overdue.
Potential Solution:
After further investigation, it seems the proper way would be to apply a filter directly on the mail.activity model rather than project.task. The goal would be to filter the activities linked to the project.task model through the res_model field.
Here's an example of a filter I tried:
[('res_model', '=', 'project.task'), ('date_deadline', '!=', False)]
While this solution helps isolate the activities linked to project tasks, I still need to correctly visualize these activities in the calendar view. I'm considering adjusting the calendar view for mail.activity to make this work.
Request for Help:
I’m reaching out to the community for guidance on how to best approach this issue. If anyone has successfully managed to display planned activities linked to project tasks in the calendar view, I’d appreciate your advice on:
- How to apply a filter that works at the activity level and visualizes the activity name and deadline in the Project calendar.
- Whether there’s a way to modify the calendar view to display the activity-related fields rather than the task fields.
Any insights or suggestions would be greatly appreciated!
Thank you in advance!
It is great that you added such useful details to your question. Please consider updating the title of your post from "Personalized filters" to a question that offers an overview of what you ask as we get almost 1,000 posts a month and not everyone will open a post to find out what your question is.