(self)
Get the SII structure for a partner identifier depending on the
        conditions of the invoice.
Get the SII structure for a partner identifier depending on the
        conditions of the invoice.
Get the SII structure for a partner identifier depending on the conditions of the invoice .
def _get_sii_identifier(self):
        """Get the SII structure for a partner identifier depending on the
        conditions of the invoice.
        """
        self.ensure_one()
        gen_type = self._get_sii_gen_type()
        partner = self._sii_get_partner()
        # Limpiar alfanum
        if partner.vat:
            vat = "".join(e for e in partner.vat if e.isalnum()).upper()
        else:
            vat = "NO_DISPONIBLE"
        country_code = self._get_sii_country_code()
        if gen_type == 1:
            if "1117" in (self.sii_send_error or ""):
                return {
                    "IDOtro": {
                        "CodigoPais": country_code,
                        "IDType": "07",
                        "ID": vat[2:],
                    }
                }
            else:
                if country_code != "ES":
                    id_type = "06" if vat == "NO_DISPONIBLE" else "04"
                    return {
                        "IDOtro": {
                            "CodigoPais": country_code,
                            "IDType": id_type,
                            "ID": vat,
                        },
                    }
                else:
                    return {"NIF": vat[2:]}
        elif gen_type == 2:
            return {"IDOtro": {"IDType": "02", "ID": vat}}
        elif gen_type == 3 and country_code != "ES":
            id_type = "06" if vat == "NO_DISPONIBLE" else "04"
            return {
                "IDOtro": {"CodigoPais": country_code, "IDType": id_type, "ID": vat},
            }
        elif gen_type == 3:
            return {"NIF": vat[2:]}
def _get_sii_identifier ( self ) : self . ensure_one ( ) gen_type = self . _get_sii_gen_type ( ) partner = self . _sii_get_partner ( ) # Limpiar alfanum if partner . vat : vat = "" . join ( e for e in partner . vat if e . isalnum ( ) ) . upper ( ) else : vat = "NO_DISPONIBLE" country_code = self . _get_sii_country_code ( ) if gen_type == 1 : if "1117" in ( self . sii_send_error or "" ) : return { "IDOtro" : { "CodigoPais" : country_code , "IDType" : "07" , "ID" : vat [ 2 : ] , } } else : if country_code != "ES" : id_type = "06" if vat == "NO_DISPONIBLE" else "04" return { "IDOtro" : { "CodigoPais" : country_code , "IDType" : id_type , "ID" : vat , } , } else : return { "NIF" : vat [ 2 : ] } elif gen_type == 2 : return { "IDOtro" : { "IDType" : "02" , "ID" : vat } } elif gen_type == 3 and country_code != "ES" : id_type = "06" if vat == "NO_DISPONIBLE" else "04" return { "IDOtro" : { "CodigoPais" : country_code , "IDType" : id_type , "ID" : vat } , } elif gen_type == 3 : return { "NIF" : vat [ 2 : ] }