attrs query operator "contains" "not contains"

Asked by Grzegorz Grzelak (OpenGLOBE.pl)

I want to set readonly attribute on field in a view. Let say it is Partner form and I don't want to change anything on General Tab in the form when user is not from Sales Team assigned to this Partner. It means all users have to see all Partner data (just see) and edit access is allowed only to members of Sales Team in the Partner (Sales Team is an "owner" of the partner)..

To not allow change for user other than Salesman (user_id) I can write:
attrs = ('readonly' :{'user_id','!=',uid}}

What should I write to not allow changes for user from group other than Sales Team (section_id)?
It should look like:
attrs = ('readonly' :{'section_id.member_ids','not contains',uid}}
But I never heard about such operator.
Has anything changes in 6.0 for such functionality or do you have any suggestion?

Thank you

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Husen Daudi (husendaudi) said :
#1

In V6 we can define read, write, create and unlink rights on record rules.
you can make record rules with 'user_id','=',uid domain and give them all rights except read so all user can read all partners but only salesman can edit and delete that partner.

here is the data description you should configure in new record rule to achieve this.
"Apply For Create","Apply For Delete","Apply For Read","Apply For Write","Domain","Global","Name","Object"
"True","True","","True","[('user_id','=',user.id)]","True","salesman","Partner"

Can you help with this problem?

Provide an answer of your own, or ask Grzegorz Grzelak (OpenGLOBE.pl) for more information if necessary.

To post a message you must log in.