Hello, how i can add one button for link exterior like "booking on airbnb" with my special link?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
To add a button in Odoo v1 that links to an external website, you can follow these steps:
1) In your custom module, create a new model for the object that you want to add the button to (e.g. res.partner).
2) Add a new field to the model for the button. The field should be of type "button" and have a label and an icon.
3) In the XML file for the view of the object (e.g. res_partner_views.xml), add the button to the desired location in the view. Use the attrs attribute to set the button's label and icon, and use the string attribute to set the text that will be displayed when the button is hovered over.
4) Add a method to the model that will handle the button click event. In the method, use the webbrowser Python module to open the desired URL in the user's default web browser.
Here is some sample code to get you started:
typescript
import webbrowser
class ResPartner(models.Model):
_inherit = 'res.partner'
airbnb_booking_url = fields.Char(string='Airbnb Booking URL')
def open_airbnb_booking(self):
url = self.airbnb_booking_url
if url:
webbrowser.open(url)
In the above code, a new field called airbnb_booking_url is added to the res.partner model to store the URL of the Airbnb booking page. The open_airbnb_booking method is defined to handle the button click event, and it uses the webbrowser module to open the URL in the user's default browser. Finally, the button is added to the footer of the form view using the footer tag in the XML.
Hi,
You can try add like below
<a href="Link of the page" target="_blank"><button>Booking on Airbnb</button></a>
Regards
Thank you for your answers :-)
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up