# -*- coding: utf-8 -*- import json from odoo import http from odoo.http import request from odoo.addons.appointment.controllers.appointment import AppointmentController class AppointmentCapacityExtendController(AppointmentController): def _prepare_appointment_type_page_values(self, appointment_type, staff_user_id=False, resource_selected_id=False, **kwargs): """ Override to extend the max capacity based on total resource capacity """ values = super()._prepare_appointment_type_page_values(appointment_type, staff_user_id, resource_selected_id, **kwargs) # For resource-based appointments, use the total capacity of all resources if appointment_type.schedule_based_on == 'resources': # Get the total capacity of all resources assigned to this appointment type total_capacity = appointment_type.resource_total_capacity # Override the max_capacity to use the total resource capacity instead of the hardcoded 12 values['max_capacity'] = max(1, total_capacity) # Ensure at least 1 # For user-based appointments, keep the default behavior or implement a different logic if needed return values