Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
20260 มุมมอง

The Scheduler allows you to regularly run a processs.

But the "action triggered" must be a method on an object.

I would like to run a Server Action instead - what would be my options?

อวตาร
ละทิ้ง

have you try to make a dummy object and call the server Action inside?

If it worked for you, you should accept the answer. See http://help.openerp.com/question/1477/meta-add-to-the-faq-explanation-on-why-to-accept-answers/

คำตอบที่ดีที่สุด

As everything in OpenERP, a server action is an object, and you want execute the method run

1. Create the server action you want to execute

2. Find its ID
You'll need the ID of the server action to pass as argument of your scheduled action. You can find it in several ways: select the action and look for id=<action_id> in the address bar, enable developer mode and select view_log in the developer options, find it in the database using psql or pgadmin...

3. Create the scheduled action
Use the following values:

  • Object: ir.actions.server
  • Method: run
  • Arguments: ([<id_of_the_action],) e.g. ([596],)
    (cr and uid are passed automatically)
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

For Odoo 14 use the command: 

model.browse(ID_OF_THE_SERVER_ACTION).run()
For the whole explanation visit this post: 

\https://www.odoo.com/de_DE/forum/hilfe-1/odoo-14-use-the-scheduled-actions-to-execute-a-server-action-192450

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Wassim,

I noticed your observation about Odoo 10 but I'm getting an error

ValueError: <type 'exceptions.NameError'>: "name '_run_actions' is not defined"

Am I missing something? I just typed

_run_actions(362)


อวตาร
ละทิ้ง

i think your method is private. remove '_' from beginning

คำตอบที่ดีที่สุด

Just an additional note:
For odoo10 use the method: _run_actions instead of run

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 21
4571
3
มิ.ย. 20
5210
0
มิ.ย. 20
2799
0
ก.พ. 16
3867
0
ส.ค. 23
3555