(self)
return taxes_dict, not_in_amount_total
Get the taxes for sales invoices.

        :param self: Single invoice record.
Get the taxes for sales invoices.
Get the taxes for sales invoices .
def _get_sii_out_taxes(self):  # noqa: C901
        """Get the taxes for sales invoices.

        :param self: Single invoice record.
        """
        self.ensure_one()
        taxes_dict = {}
        taxes_sfesb = self._get_sii_taxes_map(["SFESB"])
        taxes_sfesbe = self._get_sii_taxes_map(["SFESBE"])
        taxes_sfesisp = self._get_sii_taxes_map(["SFESISP"])
        # taxes_sfesisps = self._get_taxes_map(['SFESISPS'])
        taxes_sfens = self._get_sii_taxes_map(["SFENS"])
        taxes_sfess = self._get_sii_taxes_map(["SFESS"])
        taxes_sfesse = self._get_sii_taxes_map(["SFESSE"])
        taxes_sfesns = self._get_sii_taxes_map(["SFESNS"])
        taxes_not_in_total = self._get_sii_taxes_map(["NotIncludedInTotal"])
        taxes_not_in_total_neg = self._get_sii_taxes_map(["NotIncludedInTotalNegative"])
        base_not_in_total = self._get_sii_taxes_map(["BaseNotIncludedInTotal"])
        not_in_amount_total = 0
        exempt_cause = self._get_sii_exempt_cause(taxes_sfesbe + taxes_sfesse)
        tax_lines = self._get_tax_info()
        for tax_line in tax_lines.values():
            tax = tax_line["tax"]
            breakdown_taxes = taxes_sfesb + taxes_sfesisp + taxes_sfens + taxes_sfesbe
            if tax in taxes_not_in_total:
                not_in_amount_total += tax_line["amount"]
            elif tax in taxes_not_in_total_neg:
                not_in_amount_total -= tax_line["amount"]
            elif tax in base_not_in_total:
                not_in_amount_total += tax_line["base"]
            if tax in breakdown_taxes:
                tax_breakdown = taxes_dict.setdefault("DesgloseFactura", {})
            if tax in (taxes_sfesb + taxes_sfesbe + taxes_sfesisp):
                sub_dict = tax_breakdown.setdefault("Sujeta", {})
                # TODO l10n_es no tiene impuesto exento de bienes
                # corrientes nacionales
                if tax in taxes_sfesbe:
                    exempt_dict = sub_dict.setdefault(
                        "Exenta",
                        {"DetalleExenta": [{"BaseImponible": 0}]},
                    )
                    det_dict = exempt_dict["DetalleExenta"][0]
                    if exempt_cause:
                        det_dict["CausaExencion"] = exempt_cause
                    det_dict["BaseImponible"] += tax_line["base"]
                else:
                    sub_dict.setdefault(
                        "NoExenta",
                        {
                            "TipoNoExenta": ("S2" if tax in taxes_sfesisp else "S1"),
                            "DesgloseIVA": {"DetalleIVA": []},
                        },
                    )
                    not_ex_type = sub_dict["NoExenta"]["TipoNoExenta"]
                    if tax in taxes_sfesisp:
                        is_s3 = not_ex_type == "S1"
                    else:
                        is_s3 = not_ex_type == "S2"
                    if is_s3:
                        sub_dict["NoExenta"]["TipoNoExenta"] = "S3"
                    sub_dict["NoExenta"]["DesgloseIVA"]["DetalleIVA"].append(
                        self._get_sii_tax_dict(tax_line, tax_lines),
                    )
            # No sujetas
            if tax in taxes_sfens:
                # ImporteTAIReglasLocalizacion or ImportePorArticulos7_14_Otros
                default_no_taxable_cause = self._get_no_taxable_cause()
                nsub_dict = tax_breakdown.setdefault(
                    "NoSujeta",
                    {default_no_taxable_cause: 0},
                )
                nsub_dict[default_no_taxable_cause] += tax_line["base"]
            if tax in (taxes_sfess + taxes_sfesse + taxes_sfesns):
                type_breakdown = taxes_dict.setdefault(
                    "DesgloseTipoOperacion",
                    {"PrestacionServicios": {}},
                )
                if tax in (taxes_sfesse + taxes_sfess):
                    type_breakdown["PrestacionServicios"].setdefault("Sujeta", {})
                service_dict = type_breakdown["PrestacionServicios"]
                if tax in taxes_sfesse:
                    exempt_dict = service_dict["Sujeta"].setdefault(
                        "Exenta",
                        {"DetalleExenta": [{"BaseImponible": 0}]},
                    )
                    det_dict = exempt_dict["DetalleExenta"][0]
                    if exempt_cause:
                        det_dict["CausaExencion"] = exempt_cause
                    det_dict["BaseImponible"] += tax_line["base"]
                if tax in taxes_sfess:
                    # TODO l10n_es_ no tiene impuesto ISP de servicios
                    # if tax in taxes_sfesisps:
                    #     TipoNoExenta = 'S2'
                    # else:
                    service_dict["Sujeta"].setdefault(
                        "NoExenta",
                        {"TipoNoExenta": "S1", "DesgloseIVA": {"DetalleIVA": []}},
                    )
                    sub = type_breakdown["PrestacionServicios"]["Sujeta"]["NoExenta"][
                        "DesgloseIVA"
                    ]["DetalleIVA"]
                    sub.append(self._get_sii_tax_dict(tax_line, tax_lines))
                if tax in taxes_sfesns:
                    nsub_dict = service_dict.setdefault(
                        "NoSujeta",
                        {"ImporteTAIReglasLocalizacion": 0},
                    )
                    nsub_dict["ImporteTAIReglasLocalizacion"] += tax_line["base"]
        # Ajustes finales breakdown
        # - DesgloseFactura y DesgloseTipoOperacion son excluyentes
        # - Ciertos condicionantes obligan DesgloseTipoOperacion
        if self._is_sii_type_breakdown_required(taxes_dict):
            taxes_dict.setdefault("DesgloseTipoOperacion", {})
            taxes_dict["DesgloseTipoOperacion"]["Entrega"] = taxes_dict[
                "DesgloseFactura"
            ]
            del taxes_dict["DesgloseFactura"]
        return taxes_dict, not_in_amount_total
def _get_sii_out_taxes ( self ) : # noqa: C901 self . ensure_one ( ) taxes_dict = { } taxes_sfesb = self . _get_sii_taxes_map ( [ "SFESB" ] ) taxes_sfesbe = self . _get_sii_taxes_map ( [ "SFESBE" ] ) taxes_sfesisp = self . _get_sii_taxes_map ( [ "SFESISP" ] ) # taxes_sfesisps = self._get_taxes_map(['SFESISPS']) taxes_sfens = self . _get_sii_taxes_map ( [ "SFENS" ] ) taxes_sfess = self . _get_sii_taxes_map ( [ "SFESS" ] ) taxes_sfesse = self . _get_sii_taxes_map ( [ "SFESSE" ] ) taxes_sfesns = self . _get_sii_taxes_map ( [ "SFESNS" ] ) taxes_not_in_total = self . _get_sii_taxes_map ( [ "NotIncludedInTotal" ] ) taxes_not_in_total_neg = self . _get_sii_taxes_map ( [ "NotIncludedInTotalNegative" ] ) base_not_in_total = self . _get_sii_taxes_map ( [ "BaseNotIncludedInTotal" ] ) not_in_amount_total = 0 exempt_cause = self . _get_sii_exempt_cause ( taxes_sfesbe + taxes_sfesse ) tax_lines = self . _get_tax_info ( ) for tax_line in tax_lines . values ( ) : tax = tax_line [ "tax" ] breakdown_taxes = taxes_sfesb + taxes_sfesisp + taxes_sfens + taxes_sfesbe if tax in taxes_not_in_total : not_in_amount_total += tax_line [ "amount" ] elif tax in taxes_not_in_total_neg : not_in_amount_total -= tax_line [ "amount" ] elif tax in base_not_in_total : not_in_amount_total += tax_line [ "base" ] if tax in breakdown_taxes : tax_breakdown = taxes_dict . setdefault ( "DesgloseFactura" , { } ) if tax in ( taxes_sfesb + taxes_sfesbe + taxes_sfesisp ) : sub_dict = tax_breakdown . setdefault ( "Sujeta" , { } ) # TODO l10n_es no tiene impuesto exento de bienes # corrientes nacionales if tax in taxes_sfesbe : exempt_dict = sub_dict . setdefault ( "Exenta" , { "DetalleExenta" : [ { "BaseImponible" : 0 } ] } , ) det_dict = exempt_dict [ "DetalleExenta" ] [ 0 ] if exempt_cause : det_dict [ "CausaExencion" ] = exempt_cause det_dict [ "BaseImponible" ] += tax_line [ "base" ] else : sub_dict . setdefault ( "NoExenta" , { "TipoNoExenta" : ( "S2" if tax in taxes_sfesisp else "S1" ) , "DesgloseIVA" : { "DetalleIVA" : [ ] } , } , ) not_ex_type = sub_dict [ "NoExenta" ] [ "TipoNoExenta" ] if tax in taxes_sfesisp : is_s3 = not_ex_type == "S1" else : is_s3 = not_ex_type == "S2" if is_s3 : sub_dict [ "NoExenta" ] [ "TipoNoExenta" ] = "S3" sub_dict [ "NoExenta" ] [ "DesgloseIVA" ] [ "DetalleIVA" ] . append ( self . _get_sii_tax_dict ( tax_line , tax_lines ) , ) # No sujetas if tax in taxes_sfens : # ImporteTAIReglasLocalizacion or ImportePorArticulos7_14_Otros default_no_taxable_cause = self . _get_no_taxable_cause ( ) nsub_dict = tax_breakdown . setdefault ( "NoSujeta" , { default_no_taxable_cause : 0 } , ) nsub_dict [ default_no_taxable_cause ] += tax_line [ "base" ] if tax in ( taxes_sfess + taxes_sfesse + taxes_sfesns ) : type_breakdown = taxes_dict . setdefault ( "DesgloseTipoOperacion" , { "PrestacionServicios" : { } } , ) if tax in ( taxes_sfesse + taxes_sfess ) : type_breakdown [ "PrestacionServicios" ] . setdefault ( "Sujeta" , { } ) service_dict = type_breakdown [ "PrestacionServicios" ] if tax in taxes_sfesse : exempt_dict = service_dict [ "Sujeta" ] . setdefault ( "Exenta" , { "DetalleExenta" : [ { "BaseImponible" : 0 } ] } , ) det_dict = exempt_dict [ "DetalleExenta" ] [ 0 ] if exempt_cause : det_dict [ "CausaExencion" ] = exempt_cause det_dict [ "BaseImponible" ] += tax_line [ "base" ] if tax in taxes_sfess : # TODO l10n_es_ no tiene impuesto ISP de servicios # if tax in taxes_sfesisps: #     TipoNoExenta = 'S2' # else: service_dict [ "Sujeta" ] . setdefault ( "NoExenta" , { "TipoNoExenta" : "S1" , "DesgloseIVA" : { "DetalleIVA" : [ ] } } , ) sub = type_breakdown [ "PrestacionServicios" ] [ "Sujeta" ] [ "NoExenta" ] [ "DesgloseIVA" ] [ "DetalleIVA" ] sub . append ( self . _get_sii_tax_dict ( tax_line , tax_lines ) ) if tax in taxes_sfesns : nsub_dict = service_dict . setdefault ( "NoSujeta" , { "ImporteTAIReglasLocalizacion" : 0 } , ) nsub_dict [ "ImporteTAIReglasLocalizacion" ] += tax_line [ "base" ] # Ajustes finales breakdown # - DesgloseFactura y DesgloseTipoOperacion son excluyentes # - Ciertos condicionantes obligan DesgloseTipoOperacion if self . _is_sii_type_breakdown_required ( taxes_dict ) : taxes_dict . setdefault ( "DesgloseTipoOperacion" , { } ) taxes_dict [ "DesgloseTipoOperacion" ] [ "Entrega" ] = taxes_dict [ "DesgloseFactura" ] del taxes_dict [ "DesgloseFactura" ] return taxes_dict , not_in_amount_total