def create(self, cr, uid, vals, context=None):
task_id = super(task, self).create(cr, uid, vals, context=context)
+ project_id = self.browse(cr, uid, task_id, context=context).project_id
+ if project_id:
+ followers = [follower.id for follower in project_id.message_follower_ids]
+ self.message_subscribe(cr, uid, [task_id], followers, context=context)
self._store_history(cr, uid, [task_id], context=context)
self.create_send_note(cr, uid, [task_id], context=context)
return task_id
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]
+ if vals.get('project_id'):
+ project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context)
+ vals['message_follower_ids'] = [(4, follower.id) for follower in project_id.message_follower_ids]
if vals and not 'kanban_state' in vals and 'stage_id' in vals:
new_stage = vals.get('stage_id')
vals_reset_kstate = dict(vals, kanban_state='normal')