From dcb462f3058266fbf9b73955ff964787b4cca7e4 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 1 Aug 2020 13:47:09 +0530 Subject: [PATCH] fix: Import pycountry and taxjar only if taxjar is enabled --- erpnext/erpnext_integrations/taxjar_integration.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py index 633692dd24..24fc3d44b9 100644 --- a/erpnext/erpnext_integrations/taxjar_integration.py +++ b/erpnext/erpnext_integrations/taxjar_integration.py @@ -1,8 +1,5 @@ import traceback -import pycountry -import taxjar - import frappe from erpnext import get_default_company from frappe import _ @@ -32,6 +29,7 @@ def get_client(): def create_transaction(doc, method): + import taxjar """Create an order transaction in TaxJar""" if not TAXJAR_CREATE_TRANSACTIONS: @@ -208,6 +206,7 @@ def get_shipping_address_details(doc): def get_iso_3166_2_state_code(address): + import pycountry country_code = frappe.db.get_value("Country", address.get("country"), "code") error_message = _("""{0} is not a valid state! Check for typos or enter the ISO code for your state.""").format(address.get("state"))