Exemple #1
0
    def _calcTaxRateForCustomer(self):
        """Calculates the special tax for a given product and customer.
        """

        # If the customer has a VAT registration and the shop has a VAT
        # registration, and his country ID is different to the shop's
        # country ID, then don't apply customer taxes (default taxes
        # still apply)
        customer = ICustomerManagement(
            self.shop).getAuthenticatedCustomer(createIfNotExist=False)
        if customer is not None:
            vatreg = customer.getVATRegistration()
        else:
            vatreg = None
        if not self.shop.__dict__.has_key(
                'VATCountry'
        ) or self.shop.VATCountry == "None" or not vatreg or vatreg[:
                                                                    2] == self.shop.VATCountry:

            # 1. Try to find a Tax for actual Customer
            tm = ITaxManagement(self.shop)
            for tax in tm.getCustomerTaxes():
                if IValidity(tax).isValid(self.context) == True:
                    return tax.getRate()

        # 2. If nothing is found, returns the default tax for the product.
        return self._calcTaxRateForProduct()
Exemple #2
0
    def _calcTaxRateForCustomer(self):
        """Calculates the special tax for a given product and customer.
        """
        
        # If the customer has a VAT registration and the shop has a VAT
        # registration, and his country ID is different to the shop's
        # country ID, then don't apply customer taxes (default taxes
        # still apply)
        customer = ICustomerManagement(self.shop).getAuthenticatedCustomer(createIfNotExist=False)
        if customer is not None:
            vatreg = customer.getVATRegistration()
        else:
            vatreg = None
        if not self.shop.__dict__.has_key('VATCountry') or self.shop.VATCountry == "None" or not vatreg or vatreg[:2] == self.shop.VATCountry:

            # 1. Try to find a Tax for actual Customer
            tm = ITaxManagement(self.shop)
            for tax in tm.getCustomerTaxes():
                if IValidity(tax).isValid(self.context) == True:
                    return tax.getRate()

        # 2. If nothing is found, returns the default tax for the product.
        return self._calcTaxRateForProduct()
Exemple #3
0
 def getVATRegistration(self):
     """Returns the VAT registration (if any) of the current customer.
     """
     customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
     vatreg = customer.getVATRegistration()
     return vatreg
Exemple #4
0
 def getVATRegistration(self):
     """Returns the VAT registration (if any) of the current customer.
     """
     customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
     vatreg = customer.getVATRegistration()
     return vatreg