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

How would one debug python code in server actions?

Ảnh đại diện
Huỷ bỏ

I've tried logging, warnings, exceptions and print. All don't work! :(

A colleague is also working on a separate effort to enable printing from within server actions.

Câu trả lời hay nhất

I'm currently working on a module that does just that. My current patch got rejected on grounds of changing too much code for a rarely used feature, so we decided on a compromise which is to make it available as a module. The module still needs to be written, but if you require this in the meantime, you can look at my current patch at https://github.com/odoo/odoo/pull/2139 - the final module will use roughly the same logic, but it will dispense with the --debug-server-actions flag and use the already existing --debug flag instead.

Ảnh đại diện
Huỷ bỏ
Tác giả

That sounds great. Altough we're not using odoo (not because of that issue) anymore I am sure someone else is very happy about your efforts.

Câu trả lời hay nhất

I'm afraid there is no easy way to do that. You could copy the python code in a method of the model the server action applies to, and call that method with the right ids and context.

Ảnh đại diện
Huỷ bỏ

Thanks. Do you execute this with a python server action or is there another way?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 15
4471
0
thg 7 25
2
1
thg 5 24
1156
3
thg 6 23
10670
4
thg 3 22
12686