跳至内容
菜单
此问题已终结
1 回复
987 查看

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?

形象
丢弃
最佳答案

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.

形象
丢弃
相关帖文 回复 查看 活动
3
9月 25
79
0
5月 22
4616
4
1月 17
4788
0
9月 25
169
1
9月 16
5604