'Close Registration'

@api.one
def button_reg_close(self):

    today = fields.Datetime.now()
    if (self.event_id.date_begin <= today):
        self.write({'state': 'done', 'date_closed': today})
    else:
        raise UserError(_('You    must    wait    for    the    starting    day    of    the    event    to    do    this    action.'))
