fix: Vehicle Master - Last carbon check accepting future date.(#17821)

This commit is contained in:
abhijitkumbharIND 2019-05-31 12:17:17 +05:30
parent bd3c60254a
commit 302bce355f

View File

@ -5,10 +5,12 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import getdate
from frappe.utils import getdate, nowdate
from frappe.model.document import Document
class Vehicle(Document):
def validate(self):
if getdate(self.start_date) > getdate(self.end_date):
frappe.throw(_("Insurance Start date should be less than Insurance End date"))
frappe.throw(_("Insurance Start date should be less than Insurance End date"))
if getdate(self.carbon_check_date) > getdate(nowdate()):
frappe.throw(_("Last carbon check date cannot be a future date"))