Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions project_ux/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
============
Expand Down
25 changes: 25 additions & 0 deletions project_ux/models/project_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading