I have applied the following python.
# -*- coding: utf-8 -*-
from odoo import _, api, exceptions, fields, models, tools, registry
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
message_reply = fields.Boolean(
'Partner Reply', help="If checked, Partner has replied to message.")
def message_update(self, msg, update_vals=None):
self.message_reply = 'True'
return super(MailThread, self).message_update(msg, update_vals=update_vals)
@api.model
def message_new(self, msg, custom_vals=None):
self.message_reply = 'True'
return super(MailThread, self).message_new(msg, custom_vals=custom_vals)
@api.returns('mail.message', lambda value: value.id)
def message_post(self, **kwargs):
if self.message_reply:
self.update({'message_reply' : False,})
return super(MailThread, self).message_post(**kwargs)
The methods for message_update and message_new, work as expected. However the message_post, throws the following error.
psycopg2.ProgrammingError: operator does not exist: integer = text
LINE 17: WHERE m.id = ANY (ARRAY['mail.message(149,)'...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
I am totally lost.
My first note is this : self.message_reply = 'True'
you should write : self.message_reply = True