diff --git a/addons/project/project.py b/addons/project/project.py
index 791d8c902df..230eeb926a1 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -624,37 +624,39 @@ class task(osv.osv):
Close Task
"""
request = self.pool.get('res.request')
- for task in self.browse(cr, uid, ids, context=context):
- vals = {}
- project = task.project_id
- if project:
- # Send request to project manager
- if project.warn_manager and project.user_id and (project.user_id.id != uid):
- request.create(cr, uid, {
- 'name': _("Task '%s' closed") % task.name,
- 'state': 'waiting',
- 'act_from': uid,
- 'act_to': project.user_id.id,
- 'ref_partner_id': task.partner_id.id,
- 'ref_doc1': 'project.task,%d'% (task.id,),
- 'ref_doc2': 'project.project,%d'% (project.id,),
- }, context=context)
+ # calling do_close from demo data it returns id in string therefor need to convert in list
+ if not isinstance(ids,list): ids = [ids]
+ task = self.browse(cr, uid, ids, context=context)[0]
+ vals = {}
+ project = task.project_id
+ if project:
+ # Send request to project manager
+ if project.warn_manager and project.user_id and (project.user_id.id != uid):
+ request.create(cr, uid, {
+ 'name': _("Task '%s' closed") % task.name,
+ 'state': 'waiting',
+ 'act_from': uid,
+ 'act_to': project.user_id.id,
+ 'ref_partner_id': task.partner_id.id,
+ 'ref_doc1': 'project.task,%d'% (task.id,),
+ 'ref_doc2': 'project.project,%d'% (project.id,),
+ }, context=context)
- for parent_id in task.parent_ids:
- if parent_id.state in ('pending','draft'):
- reopen = True
- for child in parent_id.child_ids:
- if child.id != task.id and child.state not in ('done','cancelled'):
- reopen = False
- if reopen:
- self.do_reopen(cr, uid, [parent_id.id], context=context)
- vals.update({'state': 'done'})
- vals.update({'remaining_hours': 0.0})
- if not task.date_end:
- vals.update({ 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
- self.write(cr, uid, [task.id],vals, context=context)
- message = _("The task '%s' is done") % (task.name,)
- self.log(cr, uid, task.id, message)
+ for parent_id in task.parent_ids:
+ if parent_id.state in ('pending','draft'):
+ reopen = True
+ for child in parent_id.child_ids:
+ if child.id != task.id and child.state not in ('done','cancelled'):
+ reopen = False
+ if reopen:
+ self.do_reopen(cr, uid, [parent_id.id], context=context)
+ vals.update({'state': 'done'})
+ vals.update({'remaining_hours': 0.0})
+ if not task.date_end:
+ vals.update({ 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
+ self.write(cr, uid, [task.id],vals, context=context)
+ message = _("The task '%s' is done") % (task.name,)
+ self.log(cr, uid, task.id, message)
return True
def do_reopen(self, cr, uid, ids, context=None):
@@ -698,14 +700,12 @@ class task(osv.osv):
return True
def do_open(self, cr, uid, ids, context={}):
- tasks= self.browse(cr, uid, ids, context=context)
- for t in tasks:
- data = {'state': 'open'}
- if not t.date_start:
- data['date_start'] = time.strftime('%Y-%m-%d %H:%M:%S')
- self.write(cr, uid, [t.id], data, context=context)
- message = _("The task '%s' is opened.") % (t.name,)
- self.log(cr, uid, t.id, message)
+ # calling do_open from demo data it returns id in string therefor need to convert in list
+ if not isinstance(ids,list): ids = [ids]
+ task = self.browse(cr, uid, ids, context=context)[0]
+ self.write(cr, uid, [task.id], {'state': 'open'}, context=context)
+ message = _("The task '%s' is opened.") % (task.name)
+ self.log(cr, uid, task.id, message)
return True
def do_draft(self, cr, uid, ids, context={}):
diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml
index 6bb01cffb6a..eec3da582b0 100644
--- a/addons/project/project_demo.xml
+++ b/addons/project/project_demo.xml
@@ -171,6 +171,8 @@
+
+
@@ -178,10 +180,11 @@
Integrate Modules
- done
+
+
@@ -192,6 +195,8 @@
pending
+
+
@@ -202,6 +207,8 @@
pending
+
+
@@ -209,10 +216,11 @@
Documentation
- open
06-02-2011
+
+
@@ -221,10 +229,11 @@
Performance Tuning
- open
+
+
@@ -232,10 +241,11 @@
Deploy and Review on Customer System
- open
+
+
@@ -243,10 +253,10 @@
Training and Presentation
- open
09-21-2011
+
@@ -299,9 +309,11 @@
BoM, After sales returns, interventions. Traceability.
Specific adaptation to MRP
- open
12-18-2011
+
+
+
16.0
16.0
@@ -309,9 +321,11 @@
Data importation + Doc
- open
+
+
+
16.0
16.0
@@ -319,9 +333,11 @@
Modifications asked by the customer.
- open
08-13-2011
+
+
+
16.0
16.0
@@ -330,9 +346,11 @@
0
Customer analysis + Architecture
- open
12-17-2011
+
+
+
15
8.0
@@ -341,9 +359,11 @@
Internal testing + Software Install
- open
09-15-2011
+
+
+
17
16.0
@@ -351,32 +371,37 @@
2
- open
Analysis, Data Importation
10-07-2011
+
+
+
20
16.0
16.0
- open
Parameters
11-09-2011
+
+
+
20
32.0
32.0
- open
Start of the doc redaction + MRP
-
+
+
+