[IMP] project: remove doc count on project kanban view and optimize task count

This commit removes document count on project kanban view. Indeed it
does not add much valuable information and bloats the kanban cards.

In order to keep the kanban card order, it was required to adapt all
inherited views. The order is 'task', 'issue', 'rating', 'timesheet'
and 'forecast'.

It also uses a read_group to better compute task count, by the way.
This commit is contained in:
Jérome Maes
2017-04-27 10:34:51 +02:00
committed by Thibault Delavallée
parent aab2dc1431
commit b6beff86b7
4 changed files with 5 additions and 10 deletions
@@ -153,7 +153,7 @@
<a name="%(act_hr_timesheet_line_by_project)d" type="action">Timesheets</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_project_kanban_box')]/div[last()]" position="before">
<xpath expr="//div[contains(@class, 'o_project_kanban_box')]/div[last()]" position="after">
<div attrs="{'invisible': [('allow_timesheets', '=', False)]}" class="o_project_kanban_box">
<a t-if="record.allow_timesheets.raw_value" name="%(act_hr_timesheet_line_by_project)d" type="action">
<span class="o_label">Timesheets</span>
+3 -1
View File
@@ -86,8 +86,10 @@ class Project(models.Model):
])
def _compute_task_count(self):
task_data = self.env['project.task'].read_group([('project_id', 'in', self.ids), '|', ('stage_id.fold', '=', False), ('stage_id', '=', False)], ['project_id'], ['project_id'])
result = dict((data['project_id'][0], data['project_id_count']) for data in task_data)
for project in self:
project.task_count = len(project.task_ids)
project.task_count = result.get(project.id, 0)
def _compute_task_needaction_count(self):
projects_data = self.env['project.task'].read_group([
-7
View File
@@ -246,7 +246,6 @@
<field name="alias_id"/>
<field name="alias_name"/>
<field name="alias_domain"/>
<field name="doc_count"/>
<field name="is_favorite"/>
<templates>
<t t-name="kanban-box">
@@ -291,12 +290,6 @@
<t t-esc="record.task_needaction_count.raw_value"/>
</a>
</div>
<div t-if="record.doc_count.raw_value" class="o_project_kanban_box">
<a name="attachment_tree_view" type="object">
<span class="o_value"><t t-esc="record.doc_count.value"/></span>
<span class="o_label">Documents</span>
</a>
</div>
</div>
</div>
</t>
@@ -32,7 +32,7 @@
<a name="%(action_project_issue_report_filtered)d" type="action">Issues</a>
</div>
</xpath>
<xpath expr="//div[contains(@class, 'o_project_kanban_box')]/div[last()]" position="before">
<xpath expr="//div[contains(@class, 'o_project_kanban_box')]/div[last()]" position="after">
<div attrs="{'invisible': [('use_issues', '=', False)]}" class="o_project_kanban_box">
<a name="%(act_project_project_2_project_issue_all)d" type="action">
<span class="o_value"><t t-raw="record.issue_ids.raw_value.length"/></span>