From d3af63bd22068096ae9cb14a08c8b40e592ee53c Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Fri, 26 Jan 2018 23:18:50 +0530 Subject: [PATCH 1/2] [fix] fix issue where taxjar would break from non-us addresses --- erpnext_taxjar/api.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext_taxjar/api.py b/erpnext_taxjar/api.py index b8d58fb..2b59d54 100644 --- a/erpnext_taxjar/api.py +++ b/erpnext_taxjar/api.py @@ -87,10 +87,15 @@ def get_tax_data(doc): if tax.account_head == "Freight and Forwarding Charges - JA": shipping = tax.tax_amount - shipping_state = validate_state(shipping_address) - country_code = frappe.db.get_value("Country", shipping_address.country, "code") + country_code = frappe.db.get_value( + "Country", shipping_address.country, "code") country_code = country_code.upper() + if country_code != "US": + return + + shipping_state = validate_state(shipping_address) + tax_dict = { 'to_country': country_code, 'to_zip': shipping_address.pincode, @@ -142,6 +147,9 @@ def set_sales_tax(doc, method): tax_account_head = frappe.db.get_single_value("TaxJar Settings", "tax_account_head") tax_dict = get_tax_data(doc) + if not tax_dict: + return + tax_data = validate_tax_request(tax_dict) if not tax_data.amount_to_collect: taxes_list = [] From a267671da94e9590ee18f293b7161baff422caeb Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Sat, 27 Jan 2018 00:27:31 +0600 Subject: [PATCH 2/2] bumped to version 3.0.4 --- erpnext_taxjar/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext_taxjar/__init__.py b/erpnext_taxjar/__init__.py index 5b099d2..aaf495a 100644 --- a/erpnext_taxjar/__init__.py +++ b/erpnext_taxjar/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -__version__ = '3.0.3' +__version__ = '3.0.4'