'Prevents the user to create an order in the past'

@api.one
@api.constrains('date')
def _check_date(self):

    date_order = datetime.datetime.strptime(self.date, '%Y-%m-%d')
    date_today = datetime.datetime.strptime(fields.Date.context_today(self), '%Y-%m-%d')
    if (date_order < date_today):
        raise ValidationError(_('The    date    of    your    order    is    in    the    past.'))
