How to create server actions in Odoo 10?

Server action is an new feature to the OpenERP available since the version 5.0 beta. This features enables to provides the quick and easy configuration some process which is day to day requirements: Like a block of python code that will be executed,  send a signal to a workflow, update the values of a record, choose a client action to launch etc.
Below is example of server actions in odoo10.  How to create a method using python which will trigger using server action:

Implemenation in Python:

def compute_project_type(self):
project_ids = self.env[‘project.project’].search([])
try:‘ Changing Project Type : Successful’)
except:‘ Changing Project Type : Failed’)

Implemenation in XML:

<record id="action_server_change_project_type" model="ir.actions.server">
    <field name="name">Change Project Type</field>
    <field name="model_id" ref="project.model_project_project"/>
    <field name="code">
        action = model.compute_project_type()
  • name : Automated Server Action Name,
  •  model_id : Format to define model_id module.model_model_name,
    • Here Project is Module where automated server action is created,
    • In model_project_project : “model_” is prefix and “model_name” is model name where automated server action will be triggered,
  • code : A piece of Python code to execute when the action is called.


On the Settings top menu, select the Technical / Actions/ Server Actions menu item:

The following screenshot shows the form of my action server.

To use it from the More menu in your model, click on “Add in the ‘More’ menu” button.

What am I missing here? Let me know in the comments and I’ll add it in 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.