Kirill Kriachenko
Kirill Kriachenko

Reputation: 61

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** )])

Upvotes: 1

Views: 512

Answers (2)

proggyhead
proggyhead

Reputation: 1

try the following

first element of the tuple : the partner id related to the user

2nd element of the tuple : the logical operator 'in'

3rd element of the tuple : the id of partners following the record

self.env['helpdesk.ticket'].search([(self.env.user.partner_id.id, 'in', 'message_follower_ids.partner_id')])

Upvotes: 0

Kenly
Kenly

Reputation: 26738

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)])

Upvotes: 2

Related Questions