From 3caf59155030727b868f709222858513293204d1 Mon Sep 17 00:00:00 2001 From: Randhir Mayatra rma-openerp Date: Tue, 25 Mar 2014 18:15:31 +0530 Subject: [IMP] change related button into stat for account,project bzr revid: rma@tinyerp.com-20140325124531-kkwm1v8bhndzs846 --- addons/project_long_term/project_long_term.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'addons/project_long_term/project_long_term.py') diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index a950907fb69..aee4f664fad 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -98,7 +98,14 @@ class project_phase(osv.osv): else: res[phase.id] = round(100.0 * done / tot, 2) return res - + def _tasks_count(self, cr, uid, ids, field_name, arg, context=None): + res = dict(map(lambda x: (x,0), ids)) + try: + for task in self.browse(cr, uid, ids, context=context): + res[task.id] = len(task.task_ids) + except: + pass + return res _columns = { 'name': fields.char("Name", size=64, required=True), 'date_start': fields.datetime('Start Date', select=True, help="It's computed by the scheduler according the project date or the end date of the previous phase.", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}), @@ -119,6 +126,7 @@ class project_phase(osv.osv): help='If the phase is created the status \'Draft\'.\n If the phase is started, the status becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' status.\ \n If the phase is over, the status is set to \'Done\'.'), 'progress': fields.function(_compute_progress, string='Progress', help="Computed based on related tasks"), + 'tasks_count': fields.function(_tasks_count, string='# Related Tasks', type='integer'), } _defaults = { 'state': 'draft', -- cgit v1.2.3