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
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
InscribirsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
2
sept 25
|
324 | ||
|
4
may 24
|
7678 | ||
|
1
jul 23
|
2602 | ||
|
3
jun 23
|
3598 | ||
|
4
jun 22
|
5375 |