def METHOD_NAME(self):
    self.ensure_one()
    if self.state not in ["confirm", "done", "invoiced"]:
        raise ValidationError(
            _(
                "You may only create RMAs from a "
                "confirmed or done delivery order."
            )
        )
    wizard_obj = self.env["stock.delivery.note.rma.wizard"]
    line_vals = [
        (0, 0, self._prepare_rma_wizard_line_vals(data))
        for data in self.get_delivery_rma_data()
    ]
    wizard = wizard_obj.with_context(active_id=self.id).create(
        {"line_ids": line_vals, "location_id": self.warehouse_id.rma_loc_id.id}
    )
    return {
        "name": _("Create RMA"),
        "type": "ir.actions.act_window",
        "view_mode": "form",
        "res_model": "stock.delivery.note.rma.wizard",
        "res_id": wizard.id,
        "target": "new",
    }