Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
1642 Lượt xem


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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Hope it helps,

Thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 20
15825
1
thg 10 20
11766
1
thg 12 24
2322
3
thg 2 25
3507
0
thg 5 24
46