I try to write to Chatter Box, but I have the below error:
ValueError: Posting a message should be done on a business document. Use message_notify to send a notification to an user.
My code:
@api.onchange("my_field")
def write_to_chatter(self):
body = "My Message!"
self.message_post(body=body, subtype='my_subtype')
Sources:
Add Message To Chatter From Code in Odoo
Cybrosys || How To Post A Message To Chatter In Odoo 16