fix: unavailability validations

This commit is contained in:
Jannat Patel
2024-04-22 16:56:07 +05:30
parent f41eb30f3c
commit b3c76e311c
2 changed files with 5 additions and 3563 deletions

View File

@@ -21,7 +21,11 @@ class CourseEvaluator(Document):
if self.unavailable_to and not self.unavailable_from:
frappe.throw(_("Unavailable From Date is mandatory if Unavailable To Date is set"))
if self.unavailable_from >= self.unavailable_to:
if (
self.unavailable_from
and self.unavailable_to
and self.unavailable_from >= self.unavailable_to
):
frappe.throw(_("Unavailable From Date cannot be greater than Unavailable To Date"))
def validate_time_slots(self):