Search code examples
searchconditional-statementsodooselection

Odoo select all records where user is follower


Can somebody give me example (or hint) how to select all records where user is follower? I cant find any information about handling followers. What the condition should be?

find_record = self.env['my_class'].search([( **user is floower** )])

Solution

  • Followers are related to partners, you can select records where current user related partner is in followers:

    self.env['sale.order'].search([('message_follower_ids.partner_id', '=', self.env.user.partner_id.id)])