Iwant to add my 'res.users' field to the followers of oe chatter :
Python
class StockAlert(models.Model):
_inherit = ['mail.thread', 'mail.activity.mixin']
responsable_id = fields.Many2one('res.users' ,store=True)
XML View
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Iwant to add my 'res.users' field to the followers of oe chatter :
Python
class StockAlert(models.Model):
_inherit = ['mail.thread', 'mail.activity.mixin']
responsable_id = fields.Many2one('res.users' ,store=True)
XML View
answer add :
@api.multi
def write(self, vals):
result = super(StockAlert, self).write(vals)
for record in result:
followers= []
if record.responsable_id.partner_id.id not in record.message_follower_ids.ids:
follower.append(record.responsable_id.partner_id.id)
record.message_subscribe(followers)
return result
@api.model
def create(self, vals):
result = super(StockAlert, self).create(vals)
for record in result:
followers= []
if record.responsable_id.partner_id.id not in record.message_follower_ids.ids:
followers.append(record.responsable_id.partner_id.id)
record.message_subscribe(followers)
return result
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
2
Sep 25
|
320 | ||
|
4
May 24
|
7658 | ||
|
1
Jul 23
|
2596 | ||
|
3
Jun 23
|
3582 | ||
|
4
Jun 22
|
5361 |