summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorJérome Maes <jem@openerp.com>2017-01-18 15:00:32 +0100
committerThibault Delavallée <tde@odoo.com>2017-04-27 10:34:51 +0200
commitb6beff86b7e01cff1c63caea7a36bdfa67c50b7f (patch)
treed92f853f412cf65366830cb6accf26bd0c2141d2 /addons
parentaab2dc14313ea7e653cfcbef66dad55bd79ade83 (diff)
[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.
Diffstat (limited to 'addons')
-rw-r--r--addons/hr_timesheet/project_timesheet_view.xml2
-rw-r--r--addons/project/models/project.py4
-rw-r--r--addons/project/views/project_views.xml7
-rw-r--r--addons/project_issue/views/project_project_views.xml2
4 files changed, 5 insertions, 10 deletions
diff --git a/addons/hr_timesheet/project_timesheet_view.xml b/addons/hr_timesheet/project_timesheet_view.xml
index b0f6c3ecdc0..b7f1b87bab4 100644
--- a/addons/hr_timesheet/project_timesheet_view.xml
+++ b/addons/hr_timesheet/project_timesheet_view.xml
@@ -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>
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index 360643cdd04..5c8447344f8 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -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([
diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml
index 8c7ee25578b..faff2856ec6 100644
--- a/addons/project/views/project_views.xml
+++ b/addons/project/views/project_views.xml
@@ -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>
diff --git a/addons/project_issue/views/project_project_views.xml b/addons/project_issue/views/project_project_views.xml
index b5169400bb3..4ea10a378c4 100644
--- a/addons/project_issue/views/project_project_views.xml
+++ b/addons/project_issue/views/project_project_views.xml
@@ -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>