-1

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 1
    May we see what code/config you have, and what you have tried? We encourage new posters to try what they want first, prior to asking the community. – halfer Jan 11 '17 at 08:35
  • i tried a lot of domain rule options and tried to access the ids of followers of a lead – priyanshi10 Jan 11 '17 at 09:04
  • 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,)) – priyanshi10 Jan 11 '17 at 09:04
  • Please add that information to your question, thanks. – halfer Jan 11 '17 at 09:05

2 Answers2

1

You're having this error ValueError: Invalid field 'user_id' in leaf "<osv.ExtendedLeaf: ('user_id', '=', 10) on mail_followers (ctx: )>" because the mail.followers model does not have a user_id field.

The domain that you're using is one that is used on crm.lead or sale.order (where user_id indicates the seller). Like @CZoellner points it out, you should read the examples he mentions.

Fields you filter records on must exist on the model.

Majikat
  • 722
  • 4
  • 13
0

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

CZoellner
  • 13,553
  • 3
  • 25
  • 38