In Odoo a menu item can link to an external URL. URL action (ir.actions.act_url) allows opening a URL (website/web page) via an Odoo action.
Here is the menu item code and its action:
<record model="ir.actions.act_url" id="act_reports"> <field name="name">Reports</field> <field name="url">http://www.example.com</field> <field name="target">new</field> </record> <menuitem name="Reports" id="menu_reports" parent="menu_root" action="act_reports"/>
You can follow these steps if you don’t want to create a new module:
- Go to the Odoo backend and select the application for which you want to add the menu item.
- Navigate to the “Settings” menu and click on “Technical” to access the developer mode.
- Go to “User Interface” and select “Menu Items” to create a new menu item or edit an existing one.
- In the “Action” tab, select “Execute Server Action” and create a new server action.
- In the server action, select “ir.actions.act_url” as the model and specify the URL you want to open in the “URL” field.
- Save the server action and go back to the menu item configuration. In the “Action” field, select the newly created server action.
- Save the menu item and you’re done! Now, when you click on the menu item, it will open the specified URL in a new tab.
It’s important to note that the URL you specify must include the protocol (e.g. http:// or https://). Also, make sure the URL is accessible from the server where your Odoo instance is running.