[IMP] project: display milestone field in the tasks in Project Sharing

Before this commit, the external collaborator cannot see in which
milestone the tasks in the project are linked in the Project Sharing
feature.

This commit adds the milestone field in the Project Sharing to show the
milestone linked to a task in the project shared.

task-2829542
This commit is contained in:
Xavier BOL (xbo)
2022-05-31 10:29:09 +02:00
parent 50ffc33999
commit 3f263f1eae
4 changed files with 32 additions and 3 deletions
+4
View File
@@ -11,6 +11,10 @@
<record id="base.group_user" model="res.groups">
<field name="implied_ids" eval="[Command.link(ref('group_project_milestone'))]"/>
</record>
<!-- The feature is also enabled to portal user because the feature is displayed in the Project Sharing feature -->
<record id="base.group_portal" model="res.groups">
<field name="implied_ids" eval="[Command.link(ref('group_project_milestone'))]"/>
</record>
<!-- Categories -->
<record id="project_tags_00" model="project.tags">
+4 -2
View File
@@ -45,6 +45,9 @@ PROJECT_TASK_READABLE_FIELDS = {
'legend_done',
'user_ids',
'display_parent_task_button',
'allow_milestones',
'milestone_id',
'has_late_and_unreached_milestone',
}
PROJECT_TASK_WRITABLE_FIELDS = {
@@ -1138,7 +1141,6 @@ class Task(models.Model):
has_late_and_unreached_milestone = fields.Boolean(
compute='_compute_has_late_and_unreached_milestone',
search='_search_has_late_and_unreached_milestone',
groups='project.group_project_milestone',
)
# Task Dependencies fields
@@ -2024,7 +2026,7 @@ class Task(models.Model):
if all(not task.allow_milestones for task in self):
self.has_late_and_unreached_milestone = False
return
late_milestones = self.env['project.milestone']._search([
late_milestones = self.env['project.milestone'].sudo()._search([ # sudo is needed for the portal user in Project Sharing.
('id', 'in', self.milestone_id.ids),
('is_reached', '=', False),
('deadline', '<', fields.Date.today()),
+1 -1
View File
@@ -14,7 +14,7 @@ class ResConfigSettings(models.TransientModel):
group_project_stages = fields.Boolean("Project Stages", implied_group="project.group_project_stages")
group_project_recurring_tasks = fields.Boolean("Recurring Tasks", implied_group="project.group_project_recurring_tasks")
group_project_task_dependencies = fields.Boolean("Task Dependencies", implied_group="project.group_project_task_dependencies")
group_project_milestone = fields.Boolean('Milestones', implied_group='project.group_project_milestone')
group_project_milestone = fields.Boolean('Milestones', implied_group='project.group_project_milestone', group='base.group_portal,base.group_user')
rating_status = fields.Selection(
[('stage', 'Rating when changing stage'),
('periodic', 'Periodic rating')
@@ -44,6 +44,8 @@
<field name="legend_blocked" invisible="1"/>
<field name="legend_normal" invisible="1"/>
<field name="legend_done" invisible="1"/>
<field name="allow_milestones" />
<field name="has_late_and_unreached_milestone"/>
<progressbar field="kanban_state" colors='{"done": "success", "blocked": "danger", "normal": "muted"}'/>
<templates>
<t t-name="kanban-box">
@@ -56,6 +58,10 @@
<t t-else=""><field name="name" widget="name_with_subtask_count"/></t>
</strong>
<span invisible="context.get('default_project_id', False)"><br/><field name="project_id" required="1"/></span>
<span t-if="record.allow_milestones.raw_value and record.milestone_id.raw_value" t-attf-class="{{record.has_late_and_unreached_milestone.raw_value ? 'text-danger' : ''}}">
<br/>
<field name="milestone_id" />
</span>
<br />
<t t-if="record.partner_id.value">
<span t-if="!record.partner_is_company.raw_value">
@@ -119,10 +125,12 @@
<field name="is_closed" invisible="1" />
<field name="allow_subtasks" invisible="1" />
<field name="sequence" invisible="1" readonly="1"/>
<field name="allow_milestones" invisible="1"/>
<field name="priority" widget="priority" optional="show" nolabel="1"/>
<field name="name" widget="name_with_subtask_count"/>
<field name="child_text" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="milestone_id" attrs="{'column_invisible': [('allow_milestones', '=', False)]}"/>
<field name="partner_id" optional="hide"/>
<field name="portal_user_names" string="Assignees" optional="show"/>
<field name="date_deadline" optional="hide" widget="remaining_days" attrs="{'invisible': [('is_closed', '=', True)]}"/>
@@ -179,6 +187,13 @@
<group>
<field name="project_id" invisible="1"/>
<field name="display_project_id" string="Project" invisible="1"/>
<field name="allow_milestones" invisible="1"/>
<field name="milestone_id"
placeholder="e.g. Product Launch"
context="{'default_project_id': project_id if not parent_id or not display_project_id else display_project_id}"
attrs="{'invisible': [('allow_milestones', '=', False)]}"
options="{'no_open': True, 'no_create': True, 'no_edit': True}"
/>
<field name="user_ids" invisible="1" />
<field name="portal_user_names"
string="Assignees"
@@ -207,6 +222,12 @@
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="display_project_id" string="Project" optional="hide" invisible="1"/>
<field name="allow_milestones" invisible="1"/>
<field name="milestone_id"
optional="hide"
context="{'default_project_id': display_project_id or project_id}"
attrs="{'invisible': [('allow_milestones', '=', False)], 'column_invisible': [('parent.allow_milestones', '=', False)]}"
/>
<field name="company_id" invisible="1"/>
<field name="partner_id" options="{'no_open': True, 'no_create': True, 'no_edit': True}" optional="hide"/>
<field name="user_ids" invisible="1" />
@@ -240,6 +261,7 @@
<field name="partner_id" operator="child_of"/>
<field name="stage_id"/>
<field string="Project" name="display_project_id"/>
<field name="milestone_id" groups="project.group_project_milestone"/>
<filter string="Unassigned" name="unassigned" domain="[('user_ids', '=', False)]"/>
<separator/>
<filter string="High Priority" name="high_priority" domain="[('priority', '=', 1)]"/>
@@ -253,6 +275,7 @@
domain="[('activity_ids.date_deadline', '&gt;', context_today().strftime('%Y-%m-%d'))]"/>
<group expand="0" string="Group By">
<filter string="Stage" name="stage" context="{'group_by': 'stage_id'}"/>
<filter string="Milestone" name="milestone" context="{'group_by': 'milestone_id'}" groups="project.group_project_milestone"/>
<filter string="Customer" name="customer" context="{'group_by': 'partner_id'}"/>
<filter string="Kanban State" name="kanban_state" context="{'group_by': 'kanban_state'}"/>
<filter string="Deadline" name="date_deadline" context="{'group_by': 'date_deadline'}"/>