Fix bug: use country startswith instead of exact matching

Countries like FR are represented as FR
MC
This commit is contained in:
PCoder 2019-11-15 13:20:14 +05:30
parent 3599f0bff4
commit f5372ecd1e

View file

@ -154,7 +154,7 @@ def get_vat_rate_for_country(country):
vat_rate = None vat_rate = None
try: try:
vat_rate = VATRates.objects.get( vat_rate = VATRates.objects.get(
territory_codes=country, start_date__isnull=False, stop_date=None territory_codes__startswith=country, start_date__isnull=False, stop_date=None
) )
logger.debug("VAT rate for %s is %s" % (country, vat_rate.rate)) logger.debug("VAT rate for %s is %s" % (country, vat_rate.rate))
return vat_rate.rate return vat_rate.rate
@ -164,7 +164,6 @@ def get_vat_rate_for_country(country):
return 0 return 0
class HostingUtils: class HostingUtils:
@staticmethod @staticmethod
def clear_items_from_list(from_list, items_list): def clear_items_from_list(from_list, items_list):