summaryrefslogtreecommitdiff
path: root/addons/project/wizard/project_task_delegate.py
diff options
context:
space:
mode:
authorpsi (Open ERP) <psi@tinyerp.co.in>2010-07-15 10:58:07 +0530
committerpsi (Open ERP) <psi@tinyerp.co.in>2010-07-15 10:58:07 +0530
commitf18f4398edcb1bfb13279abf8e4d17fe36ede0f5 (patch)
tree218a3fbfbf28d9680225be666f224d821f722773 /addons/project/wizard/project_task_delegate.py
parentddcee421f372c5fd57d31a1836ef946608a39680 (diff)
parent21335ab5907d4969bed6734e137ead3c5b3965e0 (diff)
[MERGE] merge with trunk-addons
bzr revid: psi@tinyerp.co.in-20100715052807-qd63ikmp1p3irgfi
Diffstat (limited to 'addons/project/wizard/project_task_delegate.py')
-rw-r--r--addons/project/wizard/project_task_delegate.py40
1 files changed, 26 insertions, 14 deletions
diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py
index adfddcd8fd9..850f27b99d4 100644
--- a/addons/project/wizard/project_task_delegate.py
+++ b/addons/project/wizard/project_task_delegate.py
@@ -33,12 +33,11 @@ class project_task_delegate(osv.osv_memory):
'new_task_description': fields.text('New Task Description', help="Reinclude the description of the task in the task of the user"),
'planned_hours': fields.float('Planned Hours', help="Estimated time to close this task by the delegated user"),
'planned_hours_me': fields.float('Hours to Validate', required=True, help="Estimated time for you to validate the work done by the user to whom you delegate this task"),
- 'state': fields.selection([('pending','Pending'),
- ('done','Done'),
- ],'Validation State', required=True, help="New state of your own task. Pending will be reopened automatically when the delegated task is closed"),
- }
+ 'state': fields.selection([('pending','Pending'), ('done','Done'), ], 'Validation State', required=True, help="New state of your own task. Pending will be reopened automatically when the delegated task is closed"), }
- def _get_name(self, cr, uid, context={}):
+ def _get_name(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
if task.name.startswith(_('CHECK: ')):
@@ -48,13 +47,17 @@ class project_task_delegate(osv.osv_memory):
return newname
return ''
- def _get_plan_hour(self, cr, uid, context={}):
+ def _get_plan_hour(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
return task.remaining_hours
return 0.0
- def _get_prefix(self, cr, uid, context={}):
+ def _get_prefix(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
if task.name.startswith(_('CHECK: ')):
@@ -64,7 +67,9 @@ class project_task_delegate(osv.osv_memory):
return _('CHECK: ')+ newname
return ''
- def _get_new_desc(self, cr, uid, context={}):
+ def _get_new_desc(self, cr, uid, context=None):
+ if context is None:
+ context = {}
if 'active_id' in context:
task = self.pool.get('project.task').browse(cr, uid, context['active_id'])
return task.description
@@ -77,10 +82,13 @@ class project_task_delegate(osv.osv_memory):
'prefix': _get_prefix,
'new_task_description': _get_new_desc,
'state': 'pending',
- }
+ }
- def validate(self, cr, uid, ids, context={}):
+ def validate(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
task_obj = self.pool.get('project.task')
+ user_obj = self.pool.get('res.users')
delegate_data = self.read(cr, uid, ids, context=context)[0]
task = task_obj.browse(cr, uid, context['active_id'], context=context)
newname = delegate_data['prefix'] or ''
@@ -94,16 +102,20 @@ class project_task_delegate(osv.osv_memory):
'description': delegate_data['new_task_description'] or '',
'child_ids': [],
'work_ids': []
- })
+ }, context)
task_obj.write(cr, uid, [task.id], {
'remaining_hours': delegate_data['planned_hours_me'],
'planned_hours': delegate_data['planned_hours_me'] + (task.effective_hours or 0.0),
'name': newname,
- })
+ }, context)
if delegate_data['state'] == 'pending':
- task_obj.do_pending(cr, uid, [task.id])
+ task_obj.do_pending(cr, uid, [task.id], context)
else:
- task_obj.do_close(cr, uid, [task.id])
+ context.update({'mail_send': False} )
+ task_obj.do_close(cr, uid, [task.id], context)
+ delegrate_user = user_obj.browse(cr, uid, delegate_data['user_id'], context=context)
+ message = _('Task ') + " '" + delegate_data['name'] + "' "+ _("is Delegated to User:") +" '"+ delegrate_user.name +"' "
+ self.log(cr, uid, task.id, message)
return {}
project_task_delegate()