so what i want in general is to display tasks and only display the subtasks if the display_under_tasks is true of the selected project not all the projects
in odoo in the project model when i choose a project you can see project's tasks with this domain
('display_project_id', '=', active_id),
but i want to display the sub tasks too based on a field called display_under_tasks if it's true then i'll display them if not i won't, but when i add this
'(parent_id', '!=', False),
('project_id.display_under_tasks', '=', True)
to the domain everything goes messy
i almost found a solution i guess
[('parent_id','!=',False),'|',('display_project_id', '=', active_id),
('project_id.display_under_tasks', '=', True)],
with this domain it gives me the sub tasks based on the display_under_tasks field if it's true if not then it won't but i gives me all the tasks of all the project but i want only the tasks of the project i am in and when i did this
('parent_id','!=',False),
'|',
('parent_id','=',False),
('display_project_id', '=', active_id),
'&',
('project_id.display_under_tasks', '=', True),
('project_id', '=', active_id)
the normal tasks are not showed only the subtasks are displayed
this is the whole code
<record id="project.act_project_project_2_project_task_all" model="ir.actions.act_window">
<field name="name">Tasks</field>
<field name="res_model">project.task</field>
<field name="view_mode">kanban,tree,form,calendar,pivot,graph,activity</field>
<field name="domain">[('parent_id','!=',False),
'|',
('parent_id','=',False),
('display_project_id', '=', active_id),
'&',
('project_id.display_under_tasks', '=', True),
('project_id', '=', active_id)]
</field>
<field name="context">{ 'default_project_id': active_id, 'show_project_update': True }</field>
<field name="search_view_id" ref="project.view_task_search_form"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No tasks found. Let's create one!
</p>
<p>
Keep track of the progress of your tasks from creation to completion.
<br/>
Collaborate efficiently by chatting in real-time or via email.
</p>
</field>
</record>
so here's what i've done
Here's the code snippet for the action where tasks are always displayed, and subtasks are conditionally displayed:
<record id="action_task" model="ir.actions.act_window">
<field name="name">Tasks</field>
<field name="res_model">project.task</field>
<field name="view_mode">tree,form</field>
<field name="domain">
[('project_id', '=', active_id),
'|',
('parent_id', '=', False),
'&', ('project_id.display_under_tasks', '=', True), ('parent_id', '!=', False)]
</field>