def _check_date(self, cr, uid, vals, context=None):
    for obj in self.browse(cr, uid, ids):
        start_date = obj.start_date
end_date = obj.end_date
if start_date and end_date:
    DATETIME_FORMAT = '%Y-%m-%d'
from_dt = datetime.datetime.strptime(start_date, DATETIME_FORMAT)
to_dt = datetime.datetime.strptime(end_date, DATETIME_FORMAT)
if to_dt < from_dt:
    return False
return True
Функция openERP для проверки диапазона дат