add condition for zero appointment slots

This commit is contained in:
0Pranav 2019-11-26 10:55:28 +05:30
parent b84e56ebb5
commit 2515022377

View File

@ -28,6 +28,7 @@ class Appointment(Document):
number_of_appointments_in_same_slot = frappe.db.count(
'Appointment', filters={'scheduled_time': self.scheduled_time})
number_of_agents = frappe.db.get_single_value('Appointment Booking Settings', 'number_of_agents')
if not number_of_agents == 0:
if (number_of_appointments_in_same_slot >= number_of_agents):
frappe.throw('Time slot is not available')
# Link lead