[IMP] project: improve the project kanban and task breadcrumb
Purpose of the task is, when some one remove the default filter at that time kanban view is really a mess so when go though the project always apply the domain of current project instead of filter. The breadcrumb should be the name of the project instead of name of the action(tasks) so pass display_name from method to change the breadcrum when view the task from kanban view. closes odoo/odoo#40922 Task: 2124377 Closes: #40922 Related: odoo/enterprise#6903 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
committed by
Yannick Tivisse
parent
8f0d1f1462
commit
edf04f317c
@@ -362,11 +362,10 @@ class Project(models.Model):
|
||||
not_fav_projects.write({'favorite_user_ids': [(4, self.env.uid)]})
|
||||
favorite_projects.write({'favorite_user_ids': [(3, self.env.uid)]})
|
||||
|
||||
def open_tasks(self):
|
||||
ctx = dict(self._context)
|
||||
ctx.update({'search_default_project_id': self.id})
|
||||
action = self.env['ir.actions.act_window'].for_xml_id('project', 'act_project_project_2_project_task_all')
|
||||
return dict(action, context=ctx)
|
||||
def action_view_tasks(self):
|
||||
action = self.with_context(active_id=self.id, active_ids=self.ids).env.ref('project.act_project_project_2_project_task_all').read()[0]
|
||||
action['display_name'] = self.name
|
||||
return action
|
||||
|
||||
def action_view_account_analytic_line(self):
|
||||
""" return the action to see all the analytic lines of the project's analytic account """
|
||||
|
||||
@@ -57,9 +57,9 @@
|
||||
<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">[('project_id', '=', active_id)]</field>
|
||||
<field name="context">{
|
||||
'pivot_row_groupby': ['user_id'],
|
||||
'search_default_project_id': [active_id],
|
||||
'default_project_id': active_id,
|
||||
}</field>
|
||||
<field name="search_view_id" ref="view_task_search_form"/>
|
||||
@@ -293,7 +293,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group" position="after">
|
||||
<footer>
|
||||
<button string="Create" name="open_tasks" type="object" class="btn-primary o_open_tasks"/>
|
||||
<button string="Create" name="action_view_tasks" type="object" class="btn-primary o_open_tasks"/>
|
||||
<button string="Discard" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</xpath>
|
||||
@@ -375,7 +375,7 @@
|
||||
</div>
|
||||
|
||||
<div class="o_project_kanban_boxes">
|
||||
<a class="o_project_kanban_box" name="%(act_project_project_2_project_task_all)d" type="action">
|
||||
<a class="o_project_kanban_box" name="action_view_tasks" type="object">
|
||||
<div>
|
||||
<span class="o_value"><t t-esc="record.task_count.value"/></span>
|
||||
<span class="o_label"><t t-esc="record.label_tasks.value"/></span>
|
||||
|
||||
@@ -99,6 +99,7 @@ class SaleOrder(models.Model):
|
||||
if len(task_projects) == 1 and len(self.tasks_ids) > 1: # redirect to task of the project (with kanban stage, ...)
|
||||
action = self.with_context(active_id=task_projects.id).env.ref(
|
||||
'project.act_project_project_2_project_task_all').read()[0]
|
||||
action['domain'] = [('project_id', '=', task_projects.id)]
|
||||
if action.get('context'):
|
||||
eval_context = self.env['ir.actions.actions']._get_eval_context()
|
||||
eval_context.update({'active_id': task_projects.id})
|
||||
|
||||
Reference in New Issue
Block a user