Harry (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-delegate_task_with_attachments-hmo into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-delegate_task_with_attachments-hmo/+merge/83376
On delegate task
- attachments also copy in new delegate task so delegated user can follow
documents which made before delegated.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-delegate_task_with_attachments-hmo/+merge/83376
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-delegate_task_with_attachments-hmo.
=== modified file 'project/project.py'
--- project/project.py 2011-11-23 13:31:32 +0000
+++ project/project.py 2011-11-25 08:58:24 +0000
@@ -879,14 +879,24 @@
self.write(cr, uid, ids, {'state': 'draft'}, context=context)
return True
+
+ def _delegate_task_attachments(self, cr, uid, task_id, delegated_task_id, context=None):
+ attachment = self.pool.get('ir.attachment')
+ attachment_ids = attachment.search(cr, uid, [('res_model', '=', self._name), ('res_id', '=', task_id)], context=context)
+ new_attachment_ids = []
+ for attachment_id in attachment_ids:
+ new_attachment_ids.append(attachment.copy(cr, uid, attachment_id, default={'res_id': delegated_task_id}, context=context))
+ return new_attachment_ids
+
+
def do_delegate(self, cr, uid, ids, delegate_data={}, context=None):
"""
Delegate Task to another users.
"""
assert delegate_data['user_id'], _("Delegated User should be specified")
- delegrated_tasks = {}
+ delegated_tasks = {}
for task in self.browse(cr, uid, ids, context=context):
- delegrated_task_id = self.copy(cr, uid, task.id, {
+ delegated_task_id = self.copy(cr, uid, task.id, {
'name': delegate_data['name'],
'project_id': delegate_data['project_id'] and delegate_data['project_id'][0] or False,
'user_id': delegate_data['user_id'] and delegate_data['user_id'][0] or False,
@@ -897,6 +907,7 @@
'child_ids': [],
'work_ids': []
}, context=context)
+ self._delegate_task_attachments(cr, uid, task.id, delegated_task_id, context=context)
newname = delegate_data['prefix'] or ''
task.write({
'remaining_hours': delegate_data['planned_hours_me'],
@@ -910,8 +921,8 @@
message = _("The task '%s' has been delegated to %s.") % (delegate_data['name'], delegate_data['user_id'][1])
self.log(cr, uid, task.id, message)
- delegrated_tasks[task.id] = delegrated_task_id
- return delegrated_tasks
+ delegated_tasks[task.id] = delegated_task_id
+ return delegated_tasks
def do_pending(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'pending'}, context=context)
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp