Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
941 Zobrazení

In Odoo 17 im making a controller for a webhook.

I have methods for creating and editing leads.

With creating I have no problems, but when I'm trying to:

lead.sudo().write({'user_id': any_user_id})

i have an error:  Access Denied by ACLs for operation: read, uid: 4, model: crm.lead. You are not allowed to access 'Lead/Opportunity' (crm.lead) records.


This operation is allowed for the following groups:

- Sales/Administrator

- Sales/User: Own Documents Only


Contact your administrator to request access if necessary.

But if I would like to change name of a lead for example(

lead.sudo().write({'name': any_name})

) it will work.


So I tried: 

 lead.with_user(SUPERUSER_ID).write
 lead.with_context({'check_record_rules': False}).sudo().write 

tried using in @http.route

auth='user'

Instead of 

auth='public'

None of it works, also manually changing/adding access rules in odoo is not an option for me. So please, maybe someone had the same problem, any ideas what else i could try?

Avatar
Zrušit
Nejlepší odpověď

Hello!

I'm currently experiencing the same issue with updating user_id in a controller. I was wondering if you managed to find a solution. So far, the only way I found to bypass it is using raw SQL.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
kvě 22
4574
4
led 17
4755
1
zář 16
5573
2
srp 25
2038
1
čvc 25
805