(self, applied_taxes)
Código de la causa de exención según 3.6 y 3.7 de la FAQ del SII.

        :param applied_taxes: Taxes that are exempt for filtering the lines.
Código de la causa de exención según 3.6 y 3.7 de la FAQ del SII.
Código de la causa de exención según 3 . 6 y 3 . 7 de la FAQ del SII .
def _get_sii_exempt_cause(self, applied_taxes):
        """Código de la causa de exención según 3.6 y 3.7 de la FAQ del SII.

        :param applied_taxes: Taxes that are exempt for filtering the lines.
        """
        self.ensure_one()
        gen_type = self._get_sii_gen_type()
        if gen_type == 2:
            return "E5"
        elif gen_type == 3:
            return "E2"
        else:
            product_exempt_causes = (
                self.mapped("invoice_line_ids")
                .filtered(
                    lambda x: (
                        any(tax in x.tax_ids for tax in applied_taxes)
                        and x.product_id.sii_exempt_cause
                        and x.product_id.sii_exempt_cause != "none"
                    )
                )
                .mapped("product_id.sii_exempt_cause")
            )
            product_exempt_causes = set(product_exempt_causes)
            if len(product_exempt_causes) > 1:
                raise exceptions.UserError(
                    _("Currently there's no support for multiple exempt " "causes.")
                )
            if product_exempt_causes:
                return product_exempt_causes.pop()
            elif (
                self.fiscal_position_id.sii_exempt_cause
                and self.fiscal_position_id.sii_exempt_cause != "none"
            ):
                return self.fiscal_position_id.sii_exempt_cause
def _get_sii_exempt_cause ( self , applied_taxes ) : self . ensure_one ( ) gen_type = self . _get_sii_gen_type ( ) if gen_type == 2 : return "E5" elif gen_type == 3 : return "E2" else : product_exempt_causes = ( self . mapped ( "invoice_line_ids" ) . filtered ( lambda x : ( any ( tax in x . tax_ids for tax in applied_taxes ) and x . product_id . sii_exempt_cause and x . product_id . sii_exempt_cause != "none" ) ) . mapped ( "product_id.sii_exempt_cause" ) ) product_exempt_causes = set ( product_exempt_causes ) if len ( product_exempt_causes ) > 1 : raise exceptions . UserError ( _ ( "Currently there's no support for multiple exempt " "causes." ) ) if product_exempt_causes : return product_exempt_causes . pop ( ) elif ( self . fiscal_position_id . sii_exempt_cause and self . fiscal_position_id . sii_exempt_cause != "none" ) : return self . fiscal_position_id . sii_exempt_cause