Search code examples
odooodoo-8odoo-9odoo-view

Functional change needed for "see own leads" option in Odoo 9


when i used this domain rulein "Personal leads" rule under "see own leads" group, so that users can also see those leads that they follow with leads they own i got an error,

domai rule :

['|',('user_id','=',user.id),('user_id','=',user.message_follower_ids)]

error:

"Invalid value %r in domain term %r" % (right, leaf)

AssertionError: Invalid value mail.followers(10,) in domain term ('user_id', '=', mail.followers(10,))


Solution

  • Edit You should search with the current user's partner in the models followers, like:

    ['|', ('user_id', '=', user.id), ('message_partner_ids', 'in', [user.partner_id.id])]

    Interesting example is one of Odoos default rules for project tasks "Project/Task: portal users: (portal and colleagues following) or (followers and following)"