Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1017 มุมมอง

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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
Send notification to specific users แก้ไขแล้ว
2
ก.ย. 25
275
0
พ.ค. 22
4650
4
ม.ค. 17
4804
0
ก.ย. 25
261
1
ก.ย. 16
5649