[IMP] event, website_event_track: auto subscription.
event: organizer is now automatically added as follower of the event event_track: responsible and speakers are now automatically added as followers of the track
This commit is contained in:
committed by
Thibault Delavallée
parent
d34d142c8a
commit
e31e11449b
@@ -195,10 +195,19 @@ class event_event(models.Model):
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(event_event, self).create(vals)
|
||||
if res.organizer_id:
|
||||
res.message_subscribe([res.organizer_id.id])
|
||||
if res.auto_confirm:
|
||||
res.button_confirm()
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
res = super(event_event, self).write(vals)
|
||||
if vals.get('organizer_id'):
|
||||
self.message_subscribe([vals['organizer_id']])
|
||||
return res
|
||||
|
||||
@api.one
|
||||
def button_draft(self):
|
||||
self.state = 'draft'
|
||||
|
||||
@@ -29,7 +29,7 @@ class event_track(models.Model):
|
||||
|
||||
name = fields.Char('Title', required=True, translate=True)
|
||||
|
||||
user_id = fields.Many2one('res.users', 'Responsible', default=lambda self: self.env.user)
|
||||
user_id = fields.Many2one('res.users', 'Responsible', track_visibility='onchange', default=lambda self: self.env.user)
|
||||
speaker_ids = fields.Many2many('res.partner', string='Speakers')
|
||||
tag_ids = fields.Many2many('event.track.tag', string='Tags')
|
||||
state = fields.Selection([
|
||||
@@ -55,6 +55,19 @@ class event_track(models.Model):
|
||||
else:
|
||||
self.image = False
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(event_track, self).create(vals)
|
||||
res.message_subscribe(res.speaker_ids.ids)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
res = super(event_track, self).write(vals)
|
||||
if vals.get('speaker_ids'):
|
||||
self.message_subscribe([speaker['id'] for speaker in self.resolve_2many_commands('speaker_ids', vals['speaker_ids'], ['id'])])
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
@api.depends('name')
|
||||
def _website_url(self, field_name, arg):
|
||||
|
||||
Reference in New Issue
Block a user