Server Action in Odoo 11

mossnana

Perm Chao

Posted on February 14, 2020

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>
</record>
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
💖 💪 🙅 🚩
mossnana
Perm Chao

Posted on February 14, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related