def METHOD_NAME(self):
    headers = {
        "User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 "
        "Build/MRA58N) AppleWebKit/537.36 (KHTML, like "
        "Gecko) Chrome/90.0.4430.93 Mobile Safari/537.36",
    }
    for record in self:
        if (
            record.institution == "guardia_civil"
            and record.institution_property_id
            and record.institution_user
            and record.institution_password
        ):
            url = "https://hospederias.guardiacivil.es/"
            login_route = "/hospederias/login.do"
            logout_route = "/hospederias/logout.do"
            session = requests.session()
            login_payload = {
                "usuario": record.institution_user,
                "pswd": record.institution_password,
            }
            # login
            response_login = session.post(
                url + login_route,
                headers=headers,
                data=login_payload,
                verify=get_module_resource("pms_l10n_es", "static", "cert.pem"),
            )
            time.sleep(0.1)
            # logout
            session.get(
                url + logout_route,
                headers=headers,
                verify=get_module_resource("pms_l10n_es", "static", "cert.pem"),
            )
            session.close()
            # check if authentication was successful / unsuccessful or the
            # resource cannot be accessed
            soup = bs(response_login.text, "html.parser")
            errors = soup.select("#txterror > ul > li")
            if errors:
                raise ValidationError(errors[0].text)
            else:
                login_correct = soup.select(".cabecera2")
                if login_correct:
                    message = {
                        "type": "ir.actions.client",
                        "tag": "display_notification",
                        "params": {
                            "title": _("Connection Established!"),
                            "message": _("Connection established succesfully"),
                            "sticky": False,
                        },
                    }
                    return message
                else:
                    raise ValidationError(_("Connection could not be established"))
        elif (
            record.institution == "policia_nacional"
            and record.institution_property_id
            and record.institution_user
            and record.institution_password
        ):
            url = "https://webpol.policia.es/e-hotel"
            pre_login_route = "/login"
            login_route = "/execute_login"
            home_route = "/inicio"
            logout_route = "/execute_logout"
            session = requests.session()
            response_pre_login = session.post(
                url + pre_login_route,
                headers=headers,
                verify=False,
            )
            soup = bs(response_pre_login.text, "html.parser")
            token = soup.select("input[name='_csrf']")[0]["value"]
            time.sleep(0.1)
            login_payload = {
                "username": record.institution_user,
                "password": record.institution_password,
                "_csrf": token,
            }
            session.post(
                url + login_route,
                headers=headers,
                data=login_payload,
                verify=False,
            )
            time.sleep(0.1)
            response_home = session.get(
                url + home_route,
                headers=headers,
                verify=False,
            )
            soup = bs(response_home.text, "html.parser")
            login_correct = soup.select("#datosUsuarioBanner")
            if login_correct:
                session.post(
                    url + logout_route,
                    headers=headers,
                    verify=False,
                    data={"_csrf": token},
                )
                message = {
                    "type": "ir.actions.client",
                    "tag": "display_notification",
                    "params": {
                        "title": _("Connection Established!"),
                        "message": _("Connection established succesfully"),
                        "sticky": False,
                    },
                }
                return message
            else:
                raise ValidationError(_("Connection could not be established"))