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

I have a server action (with id 421) that changes the field value of a specific partner.

Then I have a scheduled action that calls the server action like this:

Object: ir.actions.server
Method: _run_actions
Arguments: ([421],)

The server action, if started from the "more" menu, works but if I manually start the scheduled action, nothing happens and I don't even have any errors.

아바타
취소

I don't think you can use a Scheduled Action to do that. Maybe someone with more technical knowledge will explain why!

작성자

I got to this point following other forum posts so I assume it can be done but there is something in my odoo that is not right.

작성자
I'm new to Python ... is this useful?

@api.model
    def _run_actions(self, ids):
        """
            Run server actions with given ids.
            Allow crons to run specific server actions
        """
        return self.browse(ids).run()

Thank you very much
베스트 답변

Probably from the scheduler you don't have active records/IDs and I think that is why your code is not working from the scheduler.

From more, it is working because you have active records. If this is the case, please search the records when the method is called from the scheduler.

It would be more helpful to guide you if you share your python code as well.

EDIT:

Your python code should search the records because when the method is called from the scheduler, you will not have IDs.

def _run_actions(self, ids):
if not ids:
self.search([]) # Add your conditions in domain to search the records
return self.browse(ids).run()


아바타
취소
작성자 베스트 답변

Thank you so much for your help but i am too beginners to fix this.

I have yet to learn domain...

Could you give me an example to understand what to write in self.search ([...])

아바타
취소
관련 게시물 답글 화면 활동
2
10월 23
6499
2
11월 22
6880
0
9월 21
2991
4
8월 20
7797
2
3월 20
11693