[FIX] project: avoid traceback on View Task in project sharing + other small bugfix

This commit will fix the following bugs:
- prevents a traceback to appear when clicking on View Task button in sub-tasks tab
	when in project sharing
- adds a forgotten state display in the sub-tasks tab in project sharing
	(was missing)
- in the kanban card sub-tasks dropdown, only the sub-tasks without project should
	toggle from In Progress to Done (previously every subtask toggled)

Task-3280844

closes odoo/odoo#128385

X-original-commit: 928c8cc2ac83c5ac4a175848b1ac862e9b914daa
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Bastien (bvdn)
2023-07-13 18:18:09 +02:00
parent 7c07a73b6c
commit db6b6880d6
3 changed files with 9 additions and 3 deletions
@@ -48,11 +48,12 @@ export class SubtaskKanbanList extends Component {
}
get fields() {
const { display_name, state, user_ids } = this.props.record.fields;
const { display_name, state, user_ids, project_id } = this.props.record.fields;
return {
display_name,
state,
user_ids,
project_id,
};
}
@@ -66,6 +67,9 @@ export class SubtaskKanbanList extends Component {
user_ids: {
field: getFieldFromRegistry(this.fields.user_ids.type, "many2many_avatar_user", "kanban"),
},
project_id: {
field: getFieldFromRegistry(this.fields.project_id.type, "project_private_task", "kanban")
},
};
}
@@ -37,6 +37,7 @@ QUnit.module('Subtask Kanban List tests', {
`<kanban js_class="project_task_kanban">
<field name="subtask_count"/>
<field name="closed_subtask_count"/>
<field name="project_id"/>
<templates>
<t t-name="kanban-box">
<div>
@@ -188,6 +188,7 @@
<field name="state" invisible="1"/>
<field name="sequence" widget="handle"/>
<field name="priority" widget="priority" optional="show" nolabel="1"/>
<field name="state" widget="project_task_state_selection" nolabel="1"/>
<field name="name"/>
<field name="allow_milestones" invisible="1"/>
<field name="milestone_id"
@@ -203,8 +204,8 @@
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" optional="hide"/>
<field name="stage_id" optional="show"/>
<button name="action_open_task" type="object" title="View Task" string="View Task" class="btn btn-link float-end"
context="{'form_view_ref': 'project.project_sharing_project_task_view_form'}"
attrs="{'invisible': &quot;[('project_id', '!=', False), ('project_id', '!=', active_id)]&quot;}"/>
context="{'form_view_ref': 'project.project_sharing_project_task_view_form', 'search_view_ref': 'project.project_sharing_project_task_view_search'}"
attrs="{'invisible': &quot;['|', ('project_id', '=', False), ('project_id', '!=', active_id)]&quot;}"/>
</tree>
</field>
</page>