DEV Community 👩‍💻👨‍💻

DEV Community 👩‍💻👨‍💻 is a community of 963,503 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Mossie Chao
Mossie Chao

Posted on

Server Action in Odoo 11

Server Action

View -> Python -> act_window

<record id="action_server_demo" model="ir.action">
    <field name="name">Test Action Server</field>
    <field name="type">ir.actions.server</field>
    <field name="state">code</field>
    <field name="model_id" ref="my_module.my_model" />
    <field name="binding_model_id" ref="my_module.my_model" />
    <field name="code">records.my_function()</field>
Enter fullscreen mode Exit fullscreen mode
def my_function(self):
    show_ids = [1,2,3,4,5,6]
    return {
        'type': 'ir.actions.act_window',
        'res_model': 'destination_model',
        'views': [[False, 'tree'], [False, 'form']],
        'domain': [['id', 'in', show_ids ]],
        'target': 'new',
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

songwutk profile image


  • แต่ละบรรทัดมันคืออะไร
  • ทำแล้วหน้าตา Output มันจะเป็นยังไง

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!