mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 11:39:18 +00:00
[minor] fix date comparisons
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
from frappe.utils import get_datetime, get_datetime_str
|
from frappe.utils import get_datetime
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
|
||||||
class AcademicTerm(Document):
|
class AcademicTerm(Document):
|
||||||
@@ -24,10 +24,10 @@ class AcademicTerm(Document):
|
|||||||
"""Check that the start of the term is not before the start of the academic year and end of term is not after
|
"""Check that the start of the term is not before the start of the academic year and end of term is not after
|
||||||
the end of the academic year"""
|
the end of the academic year"""
|
||||||
year = frappe.get_doc("Academic Year",self.academic_year)
|
year = frappe.get_doc("Academic Year",self.academic_year)
|
||||||
if self.term_start_date and get_datetime_str(year.year_start_date) and (self.term_start_date < get_datetime_str(year.year_start_date)):
|
if self.term_start_date and get_datetime(year.year_start_date) and (self.term_start_date < get_datetime(year.year_start_date)):
|
||||||
frappe.throw(_("The Term Start Date cannot be earlier than the Year Start Date of the Academic Year to which the term is linked (Academic Year {}). Please correct the dates and try again.").format(self.academic_year))
|
frappe.throw(_("The Term Start Date cannot be earlier than the Year Start Date of the Academic Year to which the term is linked (Academic Year {}). Please correct the dates and try again.").format(self.academic_year))
|
||||||
|
|
||||||
if self.term_end_date and get_datetime_str(year.year_end_date) and (self.term_end_date > get_datetime_str(year.year_end_date)):
|
if self.term_end_date and get_datetime_(year.year_end_date) and (self.term_end_date > get_datetime(year.year_end_date)):
|
||||||
frappe.throw(_("The Term End Date cannot be later than the Year End Date of the Academic Year to which the term is linked (Academic Year {}). Please correct the dates and try again.").format(self.academic_year))
|
frappe.throw(_("The Term End Date cannot be later than the Year End Date of the Academic Year to which the term is linked (Academic Year {}). Please correct the dates and try again.").format(self.academic_year))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user