def action_draft(self):
        """Set a change request as draft"""
        for rec in self:
            if not rec.state == 'cancelled':
                raise UserError(
                    _('You need to cancel it before reopening.'))
            if not (rec.am_i_owner or rec.am_i_approver):
                raise UserError(
                    _('You are not authorized to do this.\r\n'
                      'Only owners or approvers can reopen Change Requests.'))
            rec.write({'state': 'draft'})
Set a change request as draft