appointment_capacity_extend/static/src/js/appointment_capacity_extend.js

25 lines
896 B
JavaScript

/** @odoo-module **/
import publicWidget from "@web/legacy/js/public/public_widget";
publicWidget.registry.appointmentSlotSelect.include({
/**
* Override to allow higher capacity values
*/
_onRefresh: async function (ev) {
// Call the original method
this._super.apply(this, arguments);
// Additional logic for capacity extension
if (ev.target.id === 'resourceCapacity') {
const selectedCapacity = parseInt($(ev.target).val());
const maxCapacity = parseInt($(ev.target).data('max_capacity') || 12);
// Allow higher capacity values based on resource total capacity
if (selectedCapacity > 12 && selectedCapacity <= maxCapacity) {
// The selection is valid, proceed with refresh
return;
}
}
},
});