Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
3382 Visualizzazioni

(I'm new in odoo and still learning so bear with me) Using record rules I was able to limit my user from viewing all customers in his contact list to only view the ones that have as salesperson, I used this domain expression : [('user_id','=',user.id)] .

The issue that Im facing is when I try to create a new sale order with this user I get this error : 

The requested operation ("read" on "Users" (res.users)) was rejected because of the following rules:

(Records: False (id=8), User: False (id=8))

Implicitly accessed through 'Users' (res.users).

My goal is to give my user access to only view his customers in contact list and when he create a sale order (in the customer list).

Avatar
Abbandona
Risposta migliore

Hello, simo br
Hope you doing well.

You can inherit sale.order model and redefine field partner_id like in example use domain like this "[('user_id', '=', user_id)]" in field and it will show only his customers in contact list when he create a sale order.

Please find code in comment. 

I hope this would be helpful.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Avatar
Abbandona

Please find code here :-

partner_id = fields.Many2one(
'res.partner', string='Customer', readonly=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
required=True, change_default=True, index=True, tracking=1,
domain="[('type', '!=', 'private'), ('company_id', 'in', (False, company_id)), ('user_id', '=', user_id)]",)

Post correlati Risposte Visualizzazioni Attività
1
mar 25
1625
1
mag 24
1975
0
ago 22
1805
2
giu 25
769
1
gen 25
1537