date issue fixed serial no

This commit is contained in:
Nabin Hait 2015-05-11 11:17:16 +05:30
parent 8f5b8c658a
commit d1a64d89be

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, cstr, flt, add_days, nowdate
from frappe.utils import cint, cstr, flt, add_days, nowdate, getdate
from frappe import _, ValidationError
from erpnext.controllers.stock_controller import StockController
@ -38,16 +38,16 @@ class SerialNo(StockController):
if not self.warranty_expiry_date and not self.amc_expiry_date:
self.maintenance_status = None
if self.warranty_expiry_date and self.warranty_expiry_date < nowdate():
if self.warranty_expiry_date and getdate(self.warranty_expiry_date) < getdate(nowdate()):
self.maintenance_status = "Out of Warranty"
if self.amc_expiry_date and self.amc_expiry_date < nowdate():
if self.amc_expiry_date and getdate(self.amc_expiry_date) < getdate(nowdate()):
self.maintenance_status = "Out of AMC"
if self.amc_expiry_date and self.amc_expiry_date >= nowdate():
if self.amc_expiry_date and getdate(self.amc_expiry_date) >= getdate(nowdate()):
self.maintenance_status = "Under AMC"
if self.warranty_expiry_date and self.warranty_expiry_date >= nowdate():
if self.warranty_expiry_date and getdate(self.warranty_expiry_date) >= getdate(nowdate()):
self.maintenance_status = "Under Warranty"
def validate_warehouse(self):