Infer number_of_agents from agent_list in apppointment booking settings

This commit is contained in:
0Pranav 2019-11-20 10:27:59 +05:30
parent 539ea2cefb
commit c8e66a0f71
2 changed files with 9 additions and 1 deletions

View File

@ -29,8 +29,10 @@
"default": "1",
"fieldname": "number_of_agents",
"fieldtype": "Int",
"hidden": 1,
"in_list_view": 1,
"label": "Number of Concurrent Appointments",
"read_only": 1,
"reqd": 1
},
{
@ -99,7 +101,7 @@
}
],
"issingle": 1,
"modified": "2019-11-19 10:53:26.935061",
"modified": "2019-11-20 10:23:37.393363",
"modified_by": "Administrator",
"module": "CRM",
"name": "Appointment Booking Settings",

View File

@ -16,6 +16,12 @@ class AppointmentBookingSettings(Document):
def validate(self):
self.validate_availability_of_slots()
def save(self):
self.infer_number_of_agents()
def infer_number_of_agents():
self.number_of_agents = len(self.agent_list)
def validate_availability_of_slots(self):
for record in self.availability_of_slots:
from_time = datetime.datetime.strptime(