[FIX] When creating a project via a template, tasks were copied twice. template_coyp is now unnecessary, as copy handles task copy. Modified yml test accordingly.

bzr revid: tde@openerp.com-20120215142023-m0hq55ayf6njit9q
This commit is contained in:
Thibault Delavallée 2012-02-15 15:20:23 +01:00
parent a6948dada7
commit 46dd29fdfd
2 changed files with 3 additions and 13 deletions

View 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,

View 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")])
self.set_cancel(cr, uid, [ref("project_project_9")])