title: openERP function for validate date range
body: <p>I have two fields in my module,(start_date and end_date). I want to validate the date range as end_date must be greater than start_date and display error message like "End Date Should be greater than Start Date" This is mu cord.</p>
  
  <pre><code>from openerp.osv import osv, fields
  
  
  class op_batch(osv.Model):
  
      _name = 'op.batch'
      _columns = {
          'name': fields.char(size=25, string='Name', required=True),
          'code': fields.char(size=15, string='Code', required=True),
          'start_date': fields.date(size=15, string='Start Date', required=True),
          'end_date': fields.date(size=15, string='End Date', required=True, onchange="validate_date_range"),
          'state': fields.selection(
          [('planned', 'Planned'), ('running', 'Running'), ('cancel', 'Cancel'), ('finished', 'finished')],
          string='State'),
          'course_id': fields.many2one('op.course', string='Course', ondelete='restrict', required=True),
  }
  
      def validate_date_range(self, cr, uid, vals, context=None):
          en_date = date.start_date.value
          st_date = date.end_date.value
          if en_date &lt; st_date:
              raise Warning(_("End Date Should be greater than Start Date"))
      return True
  
      _sql_constraints = [('code', 'UNIQUE (code)', 'The CODE of the Batch must be unique!')]
  
      _defaults = {
      'state': 'planned',
      }
  </code></pre>
  
  <p>how should I do that? Please Help me to do this...</p>