exactonline/elements/invoice.py
def get_vatcode_for_ledger_line(self, ledger_line):
        """
        Get VATCode (up to three digit number) for the specified ledger line.

        Can be as simple as:

            return '0  '  # one VAT category only

        Or more complicated, like:

            if ledger_line['vat_percentage'] == 21:
                return '2  '  # high VAT
            assert ledger_line['vat_percentage'] == 0
            customer = self._bosso_invoice.customer
            assert customer.has_vat_number()
            if customer.is_in_nl():
                return '0  '  # no VAT
            elif customer.is_in_eu():
                return '7  '  # inside EU, no VAT
            return '6  '  # outside EU, no VAT
        """
        # Exact accepts receiving 'VATPercentage', but only when it is
        # higher than 0. Possibly because we have more than one match
        # for 0%? So, we'll have to fetch the right VATCode instead.
        vat_percentage = ledger_line['vat_percentage']

        if vat_percentage == 0:
            vatcode = '0  '  # FIXME: hardcoded.. fetch from API?
        elif vat_percentage == 21:
            vatcode = '2  '  # FIXME: hardcoded.. fetch from API?
        else:
            raise NotImplementedError('Unknown VAT: %s' % (vat_percentage,))

        return vatcode
def get_vatcode_for_ledger_line(self, ledger_line):
        """
        Get VATCode (up to three digit number) for the specified ledger line.

        Can be as simple as:

            return '0  '  # one VAT category only

        Or more complicated, like:

            if ledger_line['vat_percentage'] == 21:
                return '2  '  # high VAT
            assert ledger_line['vat_percentage'] == 0
            customer = self._bosso_invoice.customer
            assert customer.has_vat_number()
            if customer.is_in_nl():
                return '0  '  # no VAT
            elif customer.is_in_eu():
                return '7  '  # inside EU, no VAT
            return '6  '  # outside EU, no VAT
        """
        # Exact accepts receiving 'VATPercentage', but only when it is
        # higher than 0. Possibly because we have more than one match
        # for 0%? So, we'll have to fetch the right VATCode instead.
        vat_percentage = ledger_line['vat_percentage']

        if vat_percentage == 0:
            vatcode = '0  '  # FIXME: hardcoded.. fetch from API?
        elif vat_percentage == 21:
            vatcode = '2  '  # FIXME: hardcoded.. fetch from API?
        else:
            raise NotImplementedError('Unknown VAT: %s' % (vat_percentage,))

        return vatcode
def get_vatcode_for_ledger_line ( self , ledger_line ) : # Exact accepts receiving 'VATPercentage', but only when it is # higher than 0. Possibly because we have more than one match # for 0%? So, we'll have to fetch the right VATCode instead. vat_percentage = ledger_line [ 'vat_percentage' ] if vat_percentage == 0 : vatcode = '0  ' # FIXME: hardcoded.. fetch from API? elif vat_percentage == 21 : vatcode = '2  ' # FIXME: hardcoded.. fetch from API? else : raise NotImplementedError ( 'Unknown VAT: %s' % ( vat_percentage , ) ) return vatcode
Get VATCode (up to three digit number) for the specified ledger line.

        Can be as simple as:

            return '0  '  # one VAT category only

        Or more complicated, like:

            if ledger_line['vat_percentage'] == 21:
                return '2  '  # high VAT
            assert ledger_line['vat_percentage'] == 0
            customer = self._bosso_invoice.customer
            assert customer.has_vat_number()
            if customer.is_in_nl():
                return '0  '  # no VAT
            elif customer.is_in_eu():
                return '7  '  # inside EU, no VAT
            return '6  '  # outside EU, no VAT
Get VATCode ( up to three digit number ) for the specified ledger line .