[FIX] Code cleaning
bzr revid: tde@openerp.com-20120215145112-xn04a7jyhdex3o0d
This commit is contained in:
parent
46dd29fdfd
commit
c867b07ca1
|
@ -252,14 +252,16 @@ class project(osv.osv):
|
|||
self.log(cr, uid, id, message)
|
||||
return res
|
||||
|
||||
def map_tasks(self,cr,uid,project_id,new_id,context=None):
|
||||
#copy all the task manually
|
||||
task_obj = self.pool.get('project.task')
|
||||
proj = self.browse(cr, uid, project_id, context=context)
|
||||
def map_tasks(self, cr, uid, old_project_id, new_project_id, context=None):
|
||||
""" copy and map tasks from old to new project """
|
||||
if context is None:
|
||||
context = {}
|
||||
map_task_id = {}
|
||||
task_obj = self.pool.get('project.task')
|
||||
proj = self.browse(cr, uid, old_project_id, context=context)
|
||||
for task in proj.tasks:
|
||||
map_task_id[task.id] = task_obj.copy(cr, uid, task.id, {}, context=context)
|
||||
self.write(cr, uid, new_id, {'tasks':[(6,0, map_task_id.values())]})
|
||||
self.write(cr, uid, new_project_id, {'tasks':[(6,0, map_task_id.values())]})
|
||||
task_obj.duplicate_task(cr, uid, map_task_id, context=context)
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue