Reputation: 37
I have this problem,I have a field that filter the messages when you click on Send message on the social network, but my problem is that i have to refresh the page to get the data. I wanna get it at the same time I send the message.
@api.multi
@api.depends('message_ids')
def _compute_defect_summary_attachment_ids(self):
body = ' '
attachments = []
cont = 1
for rec in self:
for msj in rec.message_ids:
if msj.message_type == 'comment' and msj.subtype_id.name == 'Debates':
soup = BeautifulSoup(msj.body)
body += u'- Observación ' + str(cont) + ': ' + soup.text + '\n' \
+ '- Reportante: ' + msj.create_uid.name + '\n' \
+ '- Fecha: ' + msj.date + '\n\n'
cont += 1
rec.update({
'defect_summary': body})
Trying fixing it, I saw when I add the widget doesn't work. Any idea? I need to use the also the widget.
Upvotes: 0
Views: 137
Reputation: 141
odoo 10 : Inherit mail.thread object in your class and also you can add message_ids in view.you can use in any module or class.
1) models/custom.py
class CustomDetails(models.Model):
_name = 'custom.details'
_inherit = ['mail.thread', 'ir.needaction_mixin']
2) views/custom_view.xml
<field name="message_ids" widget="mail_thread"/>
Upvotes: 1