def METHOD_NAME(self):
    self.ensure_one()
    Import = self.env["xlsx.import"]
    res_ids = []
    if self.import_file:
        record = Import.import_xlsx(
            self.import_file, self.template_id, self.res_model, self.res_id
        )
        res_ids = [record.id]
    elif self.attachment_ids:
        for attach in self.attachment_ids:
            record = Import.import_xlsx(attach.datas, self.template_id)
            res_ids.append(record.id)
    else:
        raise ValidationError(_("Please select Excel file to import"))
    # If redirect_action is specified, do redirection
    if self.template_id.redirect_action:
        vals = self.template_id.redirect_action.read()[0]
        vals["domain"] = [("id", "in", res_ids)]
        return vals
    self.write({"state": "get"})
    return {
        "type": "ir.actions.act_window",
        "res_model": self._name,
        "view_mode": "form",
        "res_id": self.id,
        "views": [(False, "form")],
        "target": "new",
    }