[FIX] When creating a project via a template, tasks were copied twice. template_coyp...
authorThibault Delavallée <tde@openerp.com>
Wed, 15 Feb 2012 14:20:23 +0000 (15:20 +0100)
committerThibault Delavallée <tde@openerp.com>
Wed, 15 Feb 2012 14:20:23 +0000 (15:20 +0100)
bzr revid: tde@openerp.com-20120215142023-m0hq55ayf6njit9q

addons/project/project.py
addons/project/test/project_process.yml

index b4b374c..67767a5 100644 (file)
@@ -279,16 +279,6 @@ class project(osv.osv):
         self.map_tasks(cr,uid,id,res,context)
         return res
 
-
-    def template_copy(self, cr, uid, id, default={}, context=None):
-        proj = self.browse(cr, uid, id, context=context)
-
-        default['tasks'] = [] #avoid to copy all the task automaticly
-        res = self.copy(cr, uid, id, default=default, context=context)
-
-        self.map_tasks(cr,uid,id,res,context)
-        return res
-
     def duplicate_template(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
@@ -304,7 +294,7 @@ class project(osv.osv):
                 end_date = date(*time.strptime(proj.date,'%Y-%m-%d')[:3])
                 new_date_end = (datetime(*time.strptime(new_date_start,'%Y-%m-%d')[:3])+(end_date-start_date)).strftime('%Y-%m-%d')
             context.update({'copy':True})
-            new_id = self.template_copy(cr, uid, proj.id, default = {
+            new_id = self.copy(cr, uid, proj.id, default = {
                                     'name': proj.name +_(' (copy)'),
                                     'state':'open',
                                     'date_start':new_date_start,
index 3c51c46..88796e8 100644 (file)
@@ -62,9 +62,9 @@
   I copy the tasks of project.
 -
   !python {model: project.project}: |
-    self.template_copy(cr, uid, ref("project_integrate_openerp"))
+    self.copy(cr, uid, ref("project_integrate_openerp"))
 -
   I cancel Project.
 -
   !python {model: project.project}: |
-    self.set_cancel(cr, uid, [ref("project_project_9")])
\ No newline at end of file
+    self.set_cancel(cr, uid, [ref("project_project_9")])