[FIX] project: hide empty stages when user perform subtask action

Step:
  - Install project app
  - Activated  Task Dependencies
  - Create project and task
  - Add sub-task
  - Click sub-task action

issue:
    In the commit below we have passed the default_project reference so we get the
   current project stage.
Fix:
   we pass 'subtask_action' context to subtask action and we checked that context
   in _read_group_stage_ids method if subtask_action context is found then we will not
   fetch project's stages.

Side effect of this commit-https://github.com/odoo/odoo/commit/23cf9318084c8a00f37ffcefefa3e056583d2d77

task-3390279

closes odoo/odoo#138024

X-original-commit: 82c29c03cbaa351600b782082554378b4a320b73
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Prakash Prajapati
2023-10-10 08:19:34 +00:00
parent 37eb4cc268
commit 506e779261
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ class Task(models.Model):
@api.model
def _read_group_stage_ids(self, stages, domain, order):
search_domain = [('id', 'in', stages.ids)]
if 'default_project_id' in self.env.context:
if 'default_project_id' in self.env.context and not self._context.get('subtask_action'):
search_domain = ['|', ('project_ids', '=', self.env.context['default_project_id'])] + search_domain
stage_ids = stages._search(search_domain, order=order, access_rights_uid=SUPERUSER_ID)
+2 -1
View File
@@ -292,7 +292,8 @@
<field name="recurring_count" widget="statinfo" string="Recurring Tasks"/>
</button>
<button name="%(project_task_action_sub_task)d" type="action" class="oe_stat_button" icon="fa-tasks"
invisible="not id or subtask_count == 0" context="{'default_user_ids': user_ids, 'default_project_id': project_id, 'default_milestone_id': milestone_id}">
invisible="not id or subtask_count == 0"
context="{'default_user_ids': user_ids, 'default_project_id': project_id, 'default_milestone_id': milestone_id, 'subtask_action': True}">
<div class="o_field_widget o_stat_info">
<div class="d-flex align-items-baseline gap-1">
<span class="o_stat_value order-1">