From c0c99d1fda4570c6fd31bc58e53315ad90347af3 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Carreras Date: Tue, 31 Mar 2026 11:44:54 +0000 Subject: [PATCH] [IMP]project_ux:always display_in_project = True --- project_ux/README.rst | 1 + project_ux/models/project_task.py | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/project_ux/README.rst b/project_ux/README.rst index 2a4eb651..af8ac2b2 100644 --- a/project_ux/README.rst +++ b/project_ux/README.rst @@ -27,6 +27,7 @@ Several improvements to project: #. Incorporates a tab inside the project form view called "Task stages" that allows to select (or create) the task stages that will apply to that project. #. Incorporates an option inside the tasks stage configurations that allows to automatically set a state to the tasks when they are moved to these stages. #. Re-incorporate the field is_closed in the tasks, under the label "Folded in kanban" +#. Subtasks are created visible in the project's kanban view by default (display_in_project = True). Installation ============ diff --git a/project_ux/models/project_task.py b/project_ux/models/project_task.py index 2161a208..adc79fcc 100644 --- a/project_ux/models/project_task.py +++ b/project_ux/models/project_task.py @@ -13,6 +13,31 @@ class Task(models.Model): _inherit = "project.task" + display_in_project = fields.Boolean(default=True) + + @api.depends("project_id") + def _compute_display_in_project(self): + """We always want subtasks to be displayed in the project pipeline. + By default Odoo hides subtasks that share the same project as their + parent, making them invisible in kanban/list views. We override to + always set True so every task is visible. Users can still manually + hide individual tasks using the 'Hide in pipeline' button. + """ + for task in self: + task.display_in_project = True + + @api.model_create_multi + def create(self, vals_list): + """Force display_in_project=True on creation. + Odoo's views pass 'default_display_in_project': False in the context + when creating subtasks, which overrides both the field default and the + compute. We force it here so subtasks are always visible in the + pipeline. + """ + for vals in vals_list: + vals["display_in_project"] = True + return super().create(vals_list) + dont_send_stage_email = fields.Boolean( string="Don't Send Stage Email", default=False,