▶️ Introduction
Want to let your website visitors book appointments directly from your Odoo website? In this tutorial, we walk you through building a fully functional appointment booking module in Odoo 19, complete with:
✔ A custom controller to handle web requests
✔ Dynamic forms on the website
✔ Backend models to store appointments
✔ Confirmation or success messages
This guide is based on the comprehensive Odooistic video tutorial linked below. YouTube
🎥 Watch the video tutorial here:
📌 What You’ll Build
By the end of this blog, you’ll have a custom Odoo 19 module that:
✅ Displays an appointment form on your website
✅ Lets users pick dates and input details
✅ Saves appointments in the database
✅ Displays a thank you or success message
✅ Uses a clean URL route for public access
🛠 Step-by-Step Implementation
🔹 1. Create Module Structure
Create your custom module folder:
appointment_booking/ ├── __init__.py ├── __manifest__.py ├── models/ │ └── appointment.py ├── controllers/ │ └── main.py └── views/ └── templates.xml
Your __manifest__.py must include website support and any dependencies:
{ 'name': 'Appointment Booking', 'depends': ['base', 'website'], 'data': ['views/templates.xml'], }
🔹 2. Define the Appointment Model
In models/appointment.py, define a model to store user submissions:
from odoo import models, fields class Appointment(models.Model): _name = 'appointment.booking' _description = 'Website Appointment Booking' name = fields.Char(string="Name") email = fields.Char(string="Email") phone = fields.Char(string="Phone") date = fields.Datetime(string="Appointment Date")
This model holds basic appointment information.
🔹 3. Create the Website Controller
In controllers/main.py, add a controller to display and process the form:
from odoo import http from odoo.http import request class WebsiteAppointment(http.Controller): @http.route('/book/appointment', type='http', auth='public', website=True) def book_appointment(self, **kw): return request.render('appointment_booking.appointment_form') @http.route('/submit/appointment', type='http', auth='public', methods=['POST'], website=True) def submit_appointment(self, **post): request.env['appointment.booking'].sudo().create({ 'name': post.get('name'), 'email': post.get('email'), 'phone': post.get('phone'), 'date': post.get('date'), }) return request.render('appointment_booking.thank_you')
This controller defines:
🔹 /book/appointment – shows the booking form
🔹 /submit/appointment – processes form submission and saves data
🔹 4. Create Website Templates
In views/templates.xml, define website page templates:
<template id="appointment_form" name="Appointment Form"> <form action="/submit/appointment" method="post"> <input name="name" placeholder="Your Name"/> <input name="email" placeholder="Email"/> <input name="phone" placeholder="Phone"/> <input type="datetime-local" name="date"/> <button type="submit">Book Appointment</button> </form> </template> <template id="thank_you" name="Thank You"> <h1>Thank you for booking!</h1> <p>We will contact you soon.</p> </template>
🧠 How It Works
The user visits /book/appointment on your website
They fill the form with appointment details
On submit, the controller saves the record to appointment.booking
A thank you page is shown after successful submission
This pattern uses Odoo’s built-in website routing and templating system. YouTube
🔎 Tips & Extensions
✔ Add validation and error messages to improve UX.
✔ Send email confirmations to users after booking.
✔ Show a calendar of booked slots to avoid double bookings.
✔ Add Google calendar integration for automatic scheduling.
📌 Conclusion
With this guide, you now know how to build a complete appointment booking system in Odoo 19 that works seamlessly on your website. This module demonstrates how Odoo can be extended to support custom website features and improve user interactions. YouTube
If you found this helpful, don’t forget to watch the full video on Odooistic YouTube and subscribe for more development tutorials!