Skip to content Skip to sidebar Skip to footer

How To Inherit Mail.thread Abstractmodel And Override Function From This Class In Odoo?

I would like to change something from mail.thread abstract class. So I inherited mail.thread and wrote override message_tracked function. But it did not call override function... j

Solution 1:

This is probably related to the issue described here: https://github.com/odoo/odoo/issues/9084

As a workaround you may try to solve this as described here: Override python function in odoo

I did it like this:

from openerp.addons.mail.mail_thread import mail_thread

message_new_orig = mail_thread.message_new

defmessage_new(self, cr, uid, msg_dict, custom_values=None, context=None):
    # call super function
    msg_id = message_new_orig(self, cr, uid, msg_dict,
                              custom_values=custom_values, context=context)
    # put custom code here# ...return msg_id

# install overide
mail_thread.message_new = message_new

Post a Comment for "How To Inherit Mail.thread Abstractmodel And Override Function From This Class In Odoo?"