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

Hello, I am working on a payment plugin for odoo 16.

After a payment during the processing, i try to access a fonction that is in the payment_provider.py files by using tx.provider_id.my_function()

When i do that i get the following error : 

Access Denied by ACLs for operation: read, uid: 4, model: payment.provider

You are not allowed to access 'Payment Provider' (payment.provider) records.

This operation is allowed for the following groups:

- Administration/Settings


Contact your administrator to request access if necessary.


I don't want the user to have to modify the right of some groups to make the application work.

How should i proceed to be able to call that function everytime.


Avatar
Abbandona
Risposta migliore

The error you're encountering indicates that the user does not have sufficient access rights to read records of the payment.
By calling sudo() on the provider_id, you temporarily gain administrative privileges to access the record and call the function. This approach is useful when you need to perform operations that require elevated permissions.

tx.provider_id.my_function() is failing.
# Use sudo() to bypass ACLs

provider = tx.provider_id.sudo()

result = provider.my_function()

Avatar
Abbandona
Autore

Hi, thanks for the answer. Unfortunatly after using your idea, i still have the same exact error. Is this a bug comming from somewhere else? Do you have an idea about where it could be from?

Autore

It was a .sudo() problem, just not where i thought it was.
Thanks for the help.

Post correlati Risposte Visualizzazioni Attività
0
lug 24
612
1
ago 24
508
1
lug 24
545
2
mar 24
3247
0
set 24
605