From a6a564c43d38e9ce9dd4c3838a2e8282364c25bc Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Thu, 9 Sep 2021 19:16:21 +0530 Subject: [PATCH] chore: whitespace (#27416) --- .../erpnext_integrations/taxjar_integration.py | 16 ++++++++-------- .../custom_fields_for_taxjar_integration.py | 7 +++++-- .../product_tax_category/product_tax_category.py | 1 + .../test_product_tax_category.py | 1 + erpnext/regional/united_states/setup.py | 4 ++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py index 3af4ff4c08d..870a4ef54cc 100644 --- a/erpnext/erpnext_integrations/taxjar_integration.py +++ b/erpnext/erpnext_integrations/taxjar_integration.py @@ -17,7 +17,7 @@ SUPPORTED_COUNTRY_CODES = ["AT", "AU", "BE", "BG", "CA", "CY", "CZ", "DE", "DK", "SE", "SI", "SK", "US"] SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', - 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', + 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR', 'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'] @@ -68,7 +68,7 @@ def create_transaction(doc, method): try: if doc.is_return: client.create_refund(tax_dict) - else: + else: client.create_order(tax_dict) except taxjar.exceptions.TaxJarResponseError as err: frappe.throw(_(sanitize_error_response(err))) @@ -110,7 +110,7 @@ def get_tax_data(doc): if to_shipping_state not in SUPPORTED_STATE_CODES: to_shipping_state = get_state_code(to_address, 'Shipping') - + tax_dict = { 'from_country': from_country_code, 'from_zip': from_address.pincode, @@ -127,7 +127,7 @@ def get_tax_data(doc): 'plugin': 'erpnext', 'line_items': line_items } - return tax_dict + return tax_dict def get_state_code(address, location): if address is not None: @@ -136,16 +136,16 @@ def get_state_code(address, location): frappe.throw(_("Please enter a valid State in the {0} Address").format(location)) else: frappe.throw(_("Please enter a valid State in the {0} Address").format(location)) - + return state_code def get_line_item_dict(item): - return dict( + return dict( id = item.get('idx'), quantity = item.get('qty'), unit_price = item.get('rate'), product_tax_code = item.get('product_tax_category') - ) + ) def set_sales_tax(doc, method): if not TAXJAR_CALCULATE_TAX: @@ -204,7 +204,7 @@ def check_sales_tax_exemption(doc): break doc.run_method("calculate_taxes_and_totals") return True - else: + else: return False def validate_tax_request(tax_dict): diff --git a/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py b/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py index 1d57550d37e..43a9aeb6fe6 100644 --- a/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py +++ b/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py @@ -1,8 +1,11 @@ from __future__ import unicode_literals + import frappe from frappe.custom.doctype.custom_field.custom_field import create_custom_fields + from erpnext.regional.united_states.setup import add_permissions + def execute(): company = frappe.get_all('Company', filters = {'country': 'United States'}, fields=['name']) if not company: @@ -14,9 +17,9 @@ def execute(): 'Sales Invoice Item': [ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category', label='Product Tax Category', fetch_from='item_code.product_tax_category'), - dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', + dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', label='Tax Collectable', read_only=1), - dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', + dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', label='Taxable Amount', read_only=1) ], 'Item': [ diff --git a/erpnext/regional/doctype/product_tax_category/product_tax_category.py b/erpnext/regional/doctype/product_tax_category/product_tax_category.py index e476361eb20..b6be9e0920b 100644 --- a/erpnext/regional/doctype/product_tax_category/product_tax_category.py +++ b/erpnext/regional/doctype/product_tax_category/product_tax_category.py @@ -4,5 +4,6 @@ # import frappe from frappe.model.document import Document + class ProductTaxCategory(Document): pass diff --git a/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py b/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py index 53a5624e63e..2668f2391af 100644 --- a/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py +++ b/erpnext/regional/doctype/product_tax_category/test_product_tax_category.py @@ -4,5 +4,6 @@ # import frappe import unittest + class TestProductTaxCategory(unittest.TestCase): pass diff --git a/erpnext/regional/united_states/setup.py b/erpnext/regional/united_states/setup.py index 03791f31753..25982b81227 100644 --- a/erpnext/regional/united_states/setup.py +++ b/erpnext/regional/united_states/setup.py @@ -65,9 +65,9 @@ def make_custom_fields(update=True): 'Sales Invoice Item': [ dict(fieldname='product_tax_category', fieldtype='Link', insert_after='description', options='Product Tax Category', label='Product Tax Category', fetch_from='item_code.product_tax_category'), - dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', + dict(fieldname='tax_collectable', fieldtype='Currency', insert_after='net_amount', label='Tax Collectable', read_only=1), - dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', + dict(fieldname='taxable_amount', fieldtype='Currency', insert_after='tax_collectable', label='Taxable Amount', read_only=1) ], 'Item': [