chore: whitespace (#27416)

This commit is contained in:
Ankush Menat
2021-09-09 19:16:21 +05:30
committed by GitHub
parent 0950e246c3
commit a6a564c43d
5 changed files with 17 additions and 12 deletions

View File

@@ -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):

View File

@@ -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': [

View File

@@ -4,5 +4,6 @@
# import frappe
from frappe.model.document import Document
class ProductTaxCategory(Document):
pass

View File

@@ -4,5 +4,6 @@
# import frappe
import unittest
class TestProductTaxCategory(unittest.TestCase):
pass

View File

@@ -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': [