Skip to Content
Menu
This question has been flagged
1 Reply
2852 Views

After inheriting mail.activity for my model, I want to create a new notification in the top-right badge when someone creates new record in my model.

I know I need to use self.env['mail.activity'] to create new activity.

But I don't know how to get "res_model_id"?

And when I create it with random res_model_id number, the activity is mark as done, and does not show on the badge notification. How to create a new NOT_DONE activity?

Thank you.



Avatar
Discard
Best Answer

You can get the instant notifications from the model by inheriting mail.thread and giving attributes trackvisibiility = always or onchange. But for creating activities automatically whenever a record is created in your custom model, then you have to override the create function and create an activity record in type todo.

Avatar
Discard