From 1d2adbd8c97d2eaecea86d012e8d65492fd52eaa Mon Sep 17 00:00:00 2001 From: Vincent Larcin Date: Tue, 15 Feb 2022 16:35:15 +0000 Subject: [PATCH] [IMP] project: add project color in task calendar filter This commit colors the project filter checkboxes on the right side panel of the task calendar view with the color of the corresponding project. It also changes the color of the events in the tasks in the calendar so it uses the color in the project in the view "All Tasks", and the color of the tasks in a calendar view of a specific project. Finally, it adds some colors to tasks in demo data to better showcase that feature. Task-2741733 Part-of: odoo/odoo#86008 --- addons/project/data/project_demo.xml | 11 +++++++++ addons/project/models/project.py | 1 + addons/project/views/project_views.xml | 33 ++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/addons/project/data/project_demo.xml b/addons/project/data/project_demo.xml index c3df3fd6e29..6e03a5fa54d 100644 --- a/addons/project/data/project_demo.xml +++ b/addons/project/data/project_demo.xml @@ -212,6 +212,7 @@ Office planning + 7 @@ -369,6 +370,7 @@ blocked + 1 project.task @@ -410,6 +412,7 @@ + 11 project.task @@ -448,6 +451,7 @@ + 9 project.task @@ -800,6 +804,7 @@ Send it ASAP, its urgent. + 2 project.task @@ -832,6 +837,7 @@ Send it ASAP, its urgent. + 2 project.task @@ -861,6 +867,7 @@ Send it ASAP, its urgent. + 11 project.task @@ -941,6 +948,7 @@ Send it ASAP, its urgent. + 7 project.task @@ -972,6 +980,7 @@ Send it ASAP, its urgent. + 4 @@ -985,6 +994,7 @@ Send it ASAP, its urgent. + 5 @@ -1058,6 +1068,7 @@ Send it ASAP, its urgent. + 9 diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 8cf76783020..909cdf0b4ae 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -1055,6 +1055,7 @@ class Task(models.Model): 'res.company', string='Company', compute='_compute_company_id', store=True, readonly=False, required=True, copy=True, default=_default_company_id) color = fields.Integer(string='Color Index') + project_color = fields.Integer(related='project_id.color', string='Project Color') rating_active = fields.Boolean(string='Project Rating Status', related="project_id.rating_active") attachment_ids = fields.One2many('ir.attachment', compute='_compute_attachment_ids', string="Main Attachments", help="Attachments that don't come from a message.") diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 377da872296..4c53fe2669e 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -1313,11 +1313,11 @@ - + @@ -1329,6 +1329,18 @@ + + project.task.all.calendar + project.task + + primary + + + project_color + + + + project.task.graph project.task @@ -1414,6 +1426,23 @@ + + + kanban + + + + + tree + + + + + calendar + + + +