콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8643 화면

How would one debug python code in server actions?

아바타
취소

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.

베스트 답변

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.

아바타
취소
작성자

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.

베스트 답변

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.

아바타
취소

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

관련 게시물 답글 화면 활동
1
6월 15
4471
0
7월 25
2
1
5월 24
1159
3
6월 23
10673
4
3월 22
12686