[FIX] document, mail, project: re-add tree view for attachments removed at revision...
[odoo/odoo.git] / addons / project / project.py
index 2f8e63f..2249cf0 100644 (file)
@@ -44,7 +44,6 @@ class project_task_type(osv.osv):
         'fold': fields.boolean('Folded in Kanban View',
                                help='This stage is folded in the kanban view when'
                                'there are no records in that stage to display.'),
-        'block_reason': fields.boolean('Block Reason Required',help='If true, Give the reason for blocking this task'),
     }
 
     def _get_default_project_ids(self, cr, uid, ctx={}):
@@ -187,20 +186,11 @@ class project(osv.osv):
             task_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)], context=context, count=True)
             res[id] = (project_attachments or 0) + (task_attachments or 0)
         return res
-
     def _task_count(self, cr, uid, ids, field_name, arg, context=None):
-        """ :deprecated: this method will be removed with OpenERP v8. Use task_ids
-                         fields instead. """
-        if context is None:
-            context = {}
-        res = dict.fromkeys(ids, 0)
-        ctx = context.copy()
-        ctx['active_test'] = False
-        task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)], context=ctx)
-        for task in self.pool.get('project.task').browse(cr, uid, task_ids, context):
-            res[task.project_id.id] += 1
+        res={}
+        for tasks in self.browse(cr, uid, ids, context):
+            res[tasks.id] = len(tasks.task_ids)
         return res
-
     def _get_alias_models(self, cr, uid, context=None):
         """ Overriden in project_issue to offer more options """
         return [('project.task', "Tasks")]
@@ -224,7 +214,7 @@ class project(osv.osv):
             'res_model': 'ir.attachment',
             'type': 'ir.actions.act_window',
             'view_id': False,
-            'view_mode': 'kanban,form',
+            'view_mode': 'kanban,tree,form',
             'view_type': 'form',
             'limit': 80,
             'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
@@ -266,8 +256,7 @@ class project(osv.osv):
             }),
         'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ),
         'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
-        'task_count': fields.function(_task_count, type='integer', string="Open Tasks",
-                                      deprecated="This field will be removed in OpenERP v8. Use task_ids one2many field instead."),
+        'task_count': fields.function(_task_count, type='integer', string="Tasks",),
         'task_ids': fields.one2many('project.task', 'project_id',
                                     domain=[('stage_id.fold', '=', False)]),
         'color': fields.integer('Color Index'),
@@ -576,7 +565,7 @@ class task(osv.osv):
         },
         'kanban_state': {
             'project.mt_task_blocked': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'blocked',
-            'project.mt_task_done': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',
+            'project.mt_task_ready': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',
         },
     }