[MERGE]: Merged lp:~openerp-dev/openobject-addons/trunk-auto_follow-atp-auto_follow_project-nco
bzr revid: atp@tinyerp.com-20120924120541-uczgc1r8vau96ae7
This commit is contained in:
commit
1283433051
|
@ -1097,9 +1097,18 @@ class task(base_stage, osv.osv):
|
|||
|
||||
}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
def project_message_followers(self, cr, uid, task_id, context=None):
|
||||
project_obj = self.pool.get("project.project")
|
||||
project_id = self.browse(cr, uid, task_id, context=context).project_id
|
||||
if project_id:
|
||||
followers = [follower.id for follower in project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids]
|
||||
self.message_subscribe(cr, uid, task_id, followers, context=context)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
task_id = super(task, self).create(cr, uid, vals, context=context)
|
||||
self.project_message_followers(cr, uid, task_id, context=context)
|
||||
self._store_history(cr, uid, [task_id], context=context)
|
||||
self.create_send_note(cr, uid, [task_id], context=context)
|
||||
return task_id
|
||||
|
|
|
@ -379,8 +379,16 @@ class project_issue(base_stage, osv.osv):
|
|||
self.write(cr, uid, ids, {'date_open': False, 'date_closed': False})
|
||||
return res
|
||||
|
||||
def project_message_followers(self, cr, uid, issue_id, context=None):
|
||||
project_obj = self.pool.get("project.project")
|
||||
project_id = self.browse(cr, uid, issue_id, context=context).project_id
|
||||
followers = [follower.id for follower in project_obj.browse(cr, uid, project_id.id, context=context).message_follower_ids]
|
||||
self.message_subscribe(cr, uid, issue_id, followers, context=context)
|
||||
return True
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
obj_id = super(project_issue, self).create(cr, uid, vals, context=context)
|
||||
self.project_message_followers(cr, uid, obj_id, context=context)
|
||||
self.create_send_note(cr, uid, [obj_id], context=context)
|
||||
return obj_id
|
||||
|
||||
|
|
Loading…
Reference in New Issue