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


Hello, I just created an automatic action that should return a dynamic domain for a field but it is returning this error, I did it from the odoo interface

and it is returning this error

SyntaxError : 'return' outside function at line 5 None

Avatar
Zrušit
Nejlepší odpověď

You can follow this: https://youtu.be/XGqXEL2qQmE

Hope it helps,

Thanks

Avatar
Zrušit
Nejlepší odpověď

Hi,


The error 'return' outside a function occurs because return statements should be inside a function in Python. In Odoo'so automated actions, you don't need to use return to return a value. Instead, you should set the result directly. Here's how you can fix your code:


for record in self:

limited_records = self.env['x_reg_aprobaciones'].search([], limit=1,order='name')

if limited_records:

a = {'domain': {'x_aprobacion': [('x_aprobacion.id', 'in', limited_records.ids)]}}


Hope it helps

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 20
15810
1
říj 20
11755
1
pro 24
2317
3
úno 25
3496
0
kvě 24
46