What is the Process For Adding a Button in Odoo 16 Action Menu

January 1, 1970

A change could be desired to the current record or set of records by clicking the action menu button in Odoo. As well as adding a button to the action menu, this blog post examines how to change or update the current record or group of records. Action menu buttons allow you to change action for a single record or for a group of records. However, the buttons in the record will affect only the operations associated with the present records.

Odoo action displays the button in both form and tree views. If we need to take action on only one record, we may place a button within a form view. Otherwise, we may incorporate a button within the tree view.

The following steps will guide you through adding a button to an action menu in Odoo 16.

An example of adding an action menu button is to update the invoice date


The first step is to create a Python function to update the invoice date

class AccountMoveInherit(models.Model):
_inherit = ‘account.move’
def action_update_invoice_date(self):
self.write({‘invoice_date’: fields.Date.today()})


Create a new XML action

<record model=”ir.actions.server” id=”action_update_invoice_date”>
<field name=”name”>Update Invoice Date</field>
<field name=”model_id” ref=”account.model_account_move”/>
<field name=”binding_model_id” ref=”account.model_account_move”/>
<field name=”state”>code</field>
<field name=”code”>
action = records.action_update_invoice_date()

We can see a button/submenu named update invoice date under the action menu

invoice date-under-the-action-menu

We can see that the invoice date is updated as soon as we click update.


If you would like to add this to the tree view, please add the code below

<field name=”binding_model_id” ref=”account.model_account_move”/>
<field name=”binding_view_types”>list,form</field>


"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *