Пример #1
0
    def taxation_policy(self):
        taxation_policy = getattr(settings, 'INVOICING_TAXATION_POLICY', None)
        if taxation_policy is not None:
            return import_name(taxation_policy)

        # Check if supplier is from EU
        if self.supplier_country:
            if EUTaxationPolicy.is_in_EU(self.supplier_country.code):
                return EUTaxationPolicy

        return None
Пример #2
0
    def taxation_policy(self):
        taxation_policy = getattr(settings, 'INVOICING_TAXATION_POLICY', None)
        if taxation_policy is not None:
            return import_name(taxation_policy)

        # Check if supplier is from EU
        if self.supplier_country:
            if EUTaxationPolicy.is_in_EU(self.supplier_country.code):
                return EUTaxationPolicy

        return None
Пример #3
0
    def is_supplier_vat_id_visible(self):
        if self.vat is None and self.supplier_country == self.customer_country:
            return False

        # VAT is not 0
        if self.vat != 0 or self.item_set.filter(tax_rate__gt=0).exists():
            return True

        # VAT is 0, check if customer is from EU and from same country as supplier
        is_EU_customer = EUTaxationPolicy.is_in_EU(self.customer_country.code) if self.customer_country else False

        return is_EU_customer and self.supplier_country != self.customer_country
Пример #4
0
    def __call__(self, value):
        # check country code
        country_code = str(value[:2])
        country = Country(code=country_code.upper(), flag_url=None)
        if not country:
            raise ValidationError(_('{0} is not a valid country code.').format(country_code))

        if not vatnumber.check_vat(value):
            raise ValidationError(_('{0} is not a valid VAT number').format(value))

        if self.use_vies_validation and EUTaxationPolicy.is_in_EU(country_code):
            if not vatnumber.check_vies(value):
                raise ValidationError(_('{0} is not a valid VAT number').format(value))
Пример #5
0
    def is_supplier_vat_id_visible(self):
        is_supplier_vat_id_visible = getattr(settings, 'INVOICING_IS_SUPPLIER_VAT_ID_VISIBLE', None)

        if is_supplier_vat_id_visible is not None:
            return is_supplier_vat_id_visible(self)

        if self.vat is None and self.supplier_country == self.customer_country:
            return False

        # VAT is not 0
        if self.vat != 0 or self.item_set.filter(tax_rate__gt=0).exists():
            return True

        # VAT is 0, check if customer is from EU and from same country as supplier
        is_EU_customer = EUTaxationPolicy.is_in_EU(self.customer_country.code) if self.customer_country else False

        return is_EU_customer and self.supplier_country != self.customer_country
Пример #6
0
    def is_supplier_vat_id_visible(self):
        is_supplier_vat_id_visible = getattr(settings, 'INVOICING_IS_SUPPLIER_VAT_ID_VISIBLE', None)

        if is_supplier_vat_id_visible is not None:
            return is_supplier_vat_id_visible(self)

        if self.vat is None and self.supplier_country == self.customer_country:
            return False

        # VAT is not 0
        if self.vat != 0 or self.item_set.filter(tax_rate__gt=0).exists():
            return True

        # VAT is 0, check if customer is from EU and from same country as supplier
        is_EU_customer = EUTaxationPolicy.is_in_EU(self.customer_country.code) if self.customer_country else False

        return is_EU_customer and self.supplier_country != self.customer_country
Пример #7
0
    def __call__(self, value):
        # check country code
        country_code = str(value[:2])
        country = Country(code=country_code.upper(), flag_url=None)
        if not country:
            raise ValidationError(
                _('{0} is not a valid country code.').format(country_code))

        if not vatnumber.check_vat(value):
            raise ValidationError(
                _('{0} is not a valid VAT number').format(value))

        if self.use_vies_validation and EUTaxationPolicy.is_in_EU(
                country_code):
            if not vatnumber.check_vies(value):
                raise ValidationError(
                    _('{0} is not a valid VAT number').format(value))