Server Action in Odoo 11
Perm Chao
Posted on February 14, 2020
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>
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',
}
💖 💪 🙅 🚩
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
githubcopilot AI Innovations at Microsoft Ignite 2024 What You Need to Know (Part 2)
November 29, 2024