Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
1446 Переглядів

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.


Аватар
Відмінити
Найкраща відповідь

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()

Аватар
Відмінити
Автор

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?

Автор

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

Related Posts Відповіді Переглядів Дія
0
лип. 24
643
1
серп. 24
538
1
лип. 24
584
2
бер. 24
3320
0
вер. 24
625