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

Hi,

I'm using automated action with python code.

In some cases, I want to return another action (server action), for example

if test==true:

   do_stuff

else:

  action = {...}

The last line is causing me trouble.

The help says "To return an action, assign: action = {...}" but I can't figure out the correct syntax.

 any help?

Thanks

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

Thanks for the link, but I already search it and I didn't find the answer to my question...

Tác giả Câu trả lời hay nhất

Here is the code to use : 

action = {  "type": "ir.actions.server", "id": 524, }

This will trigger the action 524. You may find action id in the adress bar of the web browser in Odoo UI.


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

This is a helpful answer, but I don't think you can find the ID of the Server Action from the address bar (though it certainly works for Windows Actions). So you would need to find the Server Action you want to run and check for its ID).

Tác giả

Yes, you have the id for server action while in debug mode : go to settings/Technical/Actions/Server Action, then edit your action.

In the adress bar, the id of the action is displayed with "id=524" somewhere in the adress.

OK, I misunderstood your explanation - that is one way to get the ID of the Server Action.

Good Day Hargos,

I would like to thank you for your answer.

I've tried this code inside the automated action (Execute Python Code) it's not triggering .. DO you have any idea what should I change to make it workable.

Thanks in advance.

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

https://odootricks.tips/about/automated-actions/

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 20
13883
1
thg 7 18
5457
3
thg 4 24
2024
1
thg 9 23
1919
0
thg 5 21
4326