diff options
| author | Jérome Maes <jem@openerp.com> | 2017-01-18 15:00:32 +0100 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2017-04-27 10:34:51 +0200 |
| commit | b6beff86b7e01cff1c63caea7a36bdfa67c50b7f (patch) | |
| tree | d92f853f412cf65366830cb6accf26bd0c2141d2 /addons/project/models | |
| parent | aab2dc14313ea7e653cfcbef66dad55bd79ade83 (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/project/models')
| -rw-r--r-- | addons/project/models/project.py | 4 |
1 files changed, 3 insertions, 1 deletions
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([ |
