[FIX] project,sale_project: fix action of milestone stat button
This commit fix button action of milestone stat button. task-2784776 closes odoo/odoo#89326 X-original-commit: 70f67d8ca012ccc7980a2cc8da1c2fea1fd15678 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
@@ -706,6 +706,28 @@ class Project(models.Model):
|
||||
'context': {'search_default_group_date': 1, 'default_account_id': self.analytic_account_id.id}
|
||||
}
|
||||
|
||||
def action_get_list_view(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Milestones'),
|
||||
'domain': [('project_id', '=', self.id)],
|
||||
'res_model': 'project.milestone',
|
||||
'views': [(self.env.ref('project.project_milestone_view_tree').id, 'tree')],
|
||||
'view_mode': 'tree',
|
||||
'help': _("""
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
No milestones found. Let's create one!
|
||||
</p><p>
|
||||
Track major progress points that must be reached to achieve success.
|
||||
</p>
|
||||
"""),
|
||||
'context': {
|
||||
'default_project_id': self.id,
|
||||
**self.env.context
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------
|
||||
# PROJECT UPDATES
|
||||
# ---------------------------------------------
|
||||
|
||||
@@ -53,21 +53,3 @@ class ProjectMilestone(models.Model):
|
||||
|
||||
def _get_data_list(self):
|
||||
return [ms._get_data() for ms in self]
|
||||
|
||||
def action_get_list_view(self):
|
||||
return {
|
||||
'name': _('Milestones'),
|
||||
'view_mode': 'tree',
|
||||
'res_model': 'project.milestone',
|
||||
'views': [(self.env.ref('project.project_milestone_view_tree').id, 'tree'), (False, 'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'domain': "[('project_id', '=', active_id)]",
|
||||
'context': {**self.env.context, 'default_project_id': self.env.context.get('active_id')},
|
||||
'help': """
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
No milestones found. Let's create one!
|
||||
</p><p>
|
||||
Track major progress points that must be reached to achieve success.
|
||||
</p>
|
||||
""",
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@
|
||||
name="%(act_project_project_2_project_task_all)d" icon="fa-tasks">
|
||||
<field string="Tasks In Progress" name="task_count" widget="statinfo" options="{'label_field': 'label_tasks'}"/>
|
||||
</button>
|
||||
<button class="oe_stat_button" name="action_get_list_view" type="model" icon="fa-check-square-o">
|
||||
<button class="oe_stat_button" name="action_get_list_view" type="object" icon="fa-check-square-o">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
<field name="milestone_count" nolabel="1"/>
|
||||
|
||||
@@ -104,6 +104,12 @@ class Project(models.Model):
|
||||
})
|
||||
return action_window
|
||||
|
||||
def action_get_list_view(self):
|
||||
action = super().action_get_list_view()
|
||||
if self.allow_billable:
|
||||
action['views'] = [(self.env.ref('sale_project.project_milestone_view_tree').id, 'tree'), (False, 'form')]
|
||||
return action
|
||||
|
||||
def action_profitability_items(self, section_name, domain=None, res_id=False):
|
||||
if section_name in ['service_revenues', 'other_revenues']:
|
||||
view_types = ['list', 'kanban', 'form']
|
||||
|
||||
@@ -19,10 +19,3 @@ class ProjectMilestone(models.Model):
|
||||
@api.model
|
||||
def _get_fields_to_export(self):
|
||||
return super()._get_fields_to_export() + ['allow_billable', 'quantity_percentage', 'sale_line_name']
|
||||
|
||||
def action_get_list_view(self):
|
||||
view = super().action_get_list_view()
|
||||
project = self.env['project.project'].browse(self.env.context.get('active_id'))
|
||||
if project.allow_billable:
|
||||
view['views'] = [(self.env.ref('sale_project.project_milestone_view_tree').id, 'tree'), (False, 'form')]
|
||||
return view
|
||||
|
||||
Reference in New Issue
Block a user