diff --git a/erpnext_taxjar/api.py b/erpnext_taxjar/api.py index 1540753..7a3d055 100644 --- a/erpnext_taxjar/api.py +++ b/erpnext_taxjar/api.py @@ -34,7 +34,8 @@ def create_transaction(doc, method): return tax_dict['transaction_id'] = doc.name - tax_dict['transaction_date'] = frappe.utils.today() + tax_dict['transaction_date'] = doc.posting_date if doc.posting_date else frappe.utils.today() + # frappe.utils.today() won't calculate correctly in back dated transactions, used as fallback tax_dict['sales_tax'] = sales_tax tax_dict['amount'] = doc.total + tax_dict['shipping'] @@ -64,7 +65,10 @@ def get_client(): def get_shipping_address(doc): - company_address = get_company_address(get_default_company()).company_address + company = get_default_company() if not doc.company else doc.company + company_address = get_company_address(company).company_address + if not company_address: + frappe.throw(_("Please set up your company's shipping address"), frappe.AuthenticationError) company_address = frappe.get_doc("Address", company_address) shipping_address = None @@ -78,19 +82,25 @@ def get_shipping_address(doc): def get_tax_data(doc): - shipping_address = get_shipping_address(doc) - - if not shipping_address: + if not doc.customer_address: return + customer_address = frappe.get_doc("Address", doc.customer_address) + + shipping_address = get_shipping_address(doc) if shipping_address.country: - country_code = frappe.db.get_value("Country", shipping_address.country, "code") - country_code = country_code.upper() + from_country_code = frappe.db.get_value("Country", shipping_address.country, "code") + from_country_code = from_country_code.upper() + if from_country_code != "US": + return else: - frappe.throw(_("Please select a country!")) + frappe.throw(_("Country is required")) - if country_code != "US": - return + if customer_address.country: + to_country_code = frappe.db.get_value("Country", customer_address.country, "code") + to_country_code = to_country_code.upper() + else: + frappe.throw(_("Country is required")) shipping = 0 @@ -101,21 +111,33 @@ def get_tax_data(doc): shipping_state = shipping_address.get("state") if shipping_state is not None: + shipping_state = validate_state(shipping_address) + + shipping_state = shipping_address.get("state") + + customer_state = customer_address.get("state") + + if customer_state is not None: # Handle shipments to military addresses - if shipping_state.upper() in ("AE", "AA", "AP"): + if customer_state.upper() in ("AE", "AA", "AP"): frappe.throw(_("""For shipping to overseas US bases, please contact us with your order details.""")) else: - shipping_state = validate_state(shipping_address) + customer_state = validate_state(customer_address) + line_items = get_item_tax_code(doc.items) tax_dict = { - 'to_country': country_code, - 'to_zip': shipping_address.pincode, - 'to_city': shipping_address.city, - 'to_state': shipping_state, + 'to_country': to_country_code, + 'to_zip': customer_address.pincode, + 'to_city': customer_address.city, + 'to_state': customer_state, + 'from_country': from_country_code, + 'from_zip': shipping_address.pincode, + 'from_city': shipping_address.city, + 'from_state': shipping_state, 'shipping': shipping, - 'amount': doc.net_total - } + 'amount': doc.net_total, + 'line_items': line_items} return tax_dict @@ -147,7 +169,9 @@ def set_sales_tax(doc, method): if not frappe.local.conf.get("taxjar_calculate_tax", 1): return - if doc.exempt_from_sales_tax or frappe.db.get_value("Customer", doc.customer, "exempt_from_sales_tax"): + customer_exempt = frappe.db.get_value("Customer", doc.customer, "exempt_from_sales_tax") + customer_exempt = customer_exempt if customer_exempt else 0 + if doc.get("exempt_from_sales_tax") == 1 or customer_exempt: for tax in doc.taxes: if tax.account_head == TAX_ACCOUNT_HEAD: tax.tax_amount = 0 @@ -163,6 +187,8 @@ def set_sales_tax(doc, method): tax_data = validate_tax_request(tax_dict) + cost_center = frappe.db.get_value("Company", doc.company, "cost_center") + if tax_data is not None: if not tax_data.amount_to_collect: taxes_list = [] @@ -186,6 +212,7 @@ def set_sales_tax(doc, method): "charge_type": "Actual", "description": "Sales Tax", "account_head": TAX_ACCOUNT_HEAD, + "cost_center": cost_center, "tax_amount": tax_data.amount_to_collect }) @@ -236,3 +263,52 @@ def validate_state(address): frappe.throw(error_message) else: return lookup_state.code.split('-')[1] + + +def get_item_tax_code(items): + item_code_list = [] + if not items: + return + for item in items: + item_tax_category = frappe.db.get_value("Item", item.item_code, "item_tax_category") + if not item_tax_category: + continue + item_code_list.append({ + "quantity": item.qty, + "unit_price": item.rate, + "product_tax_code": get_product_code(item_tax_category) + }) + return item_code_list + + +def get_product_code(category): + product_codes = {'Magazines & Subscriptions': '81300', + 'Clothing - Swimwear': '20041', + 'General Services': '19000', + 'Other Exempt': '99999', + 'Software as a Service': '30070', + 'Soft Drinks': '40050', + 'Digital Goods': '31000', + 'Religious Books': '81120', + 'Prepared Foods': '41000', + 'Installation Services': '10040', + 'Dry Cleaning Services': '19006', + 'Books': '81100', + 'Prescription': '51020', + 'Textbooks': '81110', + 'Candy': '40010', + 'Magazine': '81310', + 'Supplements': '40020', + 'Printing Services': '19009', + 'Admission Services': '19003', + 'Hairdressing Services': '19008', + 'Clothing': '20010', + 'Food & Groceries': '40030', + 'Parking Services': '19002', + 'Advertising Services': '19001', + 'Training Services': '19004', + 'Non-Prescription': '51010', + 'Professional Services': '19005', + 'Bottled Water': '40060', + 'Repair Services': '19007'} + return product_codes.get(category) diff --git a/erpnext_taxjar/erpnext_taxjar/custom/customer.json b/erpnext_taxjar/erpnext_taxjar/custom/customer.json new file mode 100644 index 0000000..e2ff74a --- /dev/null +++ b/erpnext_taxjar/erpnext_taxjar/custom/customer.json @@ -0,0 +1,128 @@ +{ + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2019-01-03 09:48:12.053555", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Customer", + "fetch_from": null, + "fieldname": "exempt_from_sales_tax", + "fieldtype": "Check", + "hidden": 0, + "idx": 13, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "insert_after": "tax_id", + "label": "Is Customer Exempt From Sales Tax?", + "modified": "2019-01-03 09:48:12.053555", + "modified_by": "Administrator", + "name": "Customer-exempt_from_sales_tax", + "no_copy": 0, + "options": null, + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Customer", + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2019-01-03 11:39:51.665500", + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype_or_field": "DocType", + "field_name": null, + "idx": 0, + "modified": "2019-01-03 11:39:51.665500", + "modified_by": "Administrator", + "name": "Customer-read_only_onload", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only_onload", + "property_type": "Check", + "value": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.142402", + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "modified": "2018-12-27 21:12:40.142402", + "modified_by": "Administrator", + "name": "Customer-naming_series-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.070682", + "default_value": null, + "doc_type": "Customer", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "modified": "2018-12-27 21:12:40.070682", + "modified_by": "Administrator", + "name": "Customer-naming_series-reqd", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "reqd", + "property_type": "Check", + "value": "0" + } + ], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/erpnext_taxjar/erpnext_taxjar/custom/item.json b/erpnext_taxjar/erpnext_taxjar/custom/item.json new file mode 100644 index 0000000..356eece --- /dev/null +++ b/erpnext_taxjar/erpnext_taxjar/custom/item.json @@ -0,0 +1,220 @@ +{ + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2019-01-02 20:56:16.815517", + "default": "Other Exempt", + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Item", + "fetch_from": null, + "fieldname": "item_tax_code", + "fieldtype": "Select", + "hidden": 0, + "idx": 95, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "insert_after": "item_tax_section_break", + "label": "TaxJar Item Tax Code", + "modified": "2019-01-02 20:56:16.815517", + "modified_by": "Administrator", + "name": "Item-item_tax_code", + "no_copy": 0, + "options": "Other Exempt\nMagazines & Subscriptions\nClothing - Swimwear\nGeneral Services\nSoftware as a Service\nSoft Drinks\nDigital Goods\nReligious Books\nPrepared Foods\nInstallation Services\nDry Cleaning Services\nBooks\nPrescription\nTextbooks\nCandy\nMagazine\nSupplements\nPrinting Services\nAdmission Services\nHairdressing Services\nClothing\nFood & Groceries\nParking Services\nAdvertising Services\nTraining Services\nNon-Prescription\nProfessional Services\nBottled Water\nRepair Services", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 1, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Item", + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2019-01-02 20:59:09.481436", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocType", + "field_name": null, + "idx": 0, + "modified": "2019-01-02 20:59:09.481436", + "modified_by": "Administrator", + "name": "Item-read_only_onload", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only_onload", + "property_type": "Check", + "value": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:54.106740", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "barcodes", + "idx": 0, + "modified": "2018-12-27 21:12:54.106740", + "modified_by": "Administrator", + "name": "Item-barcodes-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:53.933496", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "barcode", + "idx": 0, + "modified": "2018-12-27 21:12:53.933496", + "modified_by": "Administrator", + "name": "Item-barcode-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:53.509663", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "item_code", + "idx": 0, + "modified": "2018-12-27 21:12:53.509663", + "modified_by": "Administrator", + "name": "Item-item_code-reqd", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "reqd", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:53.409490", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "item_code", + "idx": 0, + "modified": "2018-12-27 21:12:53.409490", + "modified_by": "Administrator", + "name": "Item-item_code-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:53.308750", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "modified": "2018-12-27 21:12:53.308750", + "modified_by": "Administrator", + "name": "Item-naming_series-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:53.199491", + "default_value": null, + "doc_type": "Item", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "naming_series", + "idx": 0, + "modified": "2018-12-27 21:12:53.199491", + "modified_by": "Administrator", + "name": "Item-naming_series-reqd", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "reqd", + "property_type": "Check", + "value": "0" + } + ], + "sync_on_migrate": 1 +} diff --git a/erpnext_taxjar/erpnext_taxjar/custom/sales_invoice.json b/erpnext_taxjar/erpnext_taxjar/custom/sales_invoice.json new file mode 100644 index 0000000..a73f7d9 --- /dev/null +++ b/erpnext_taxjar/erpnext_taxjar/custom/sales_invoice.json @@ -0,0 +1,358 @@ +{ + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2019-01-03 11:42:32.344081", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Sales Invoice", + "fetch_from": null, + "fieldname": "exempt_from_sales_tax", + "fieldtype": "Check", + "hidden": 0, + "idx": 7, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "insert_after": "tax_id", + "label": "Is Customer Exempt from Sales Tax", + "modified": "2019-01-03 11:42:32.344081", + "modified_by": "Administrator", + "name": "Sales Invoice-exempt_from_sales_tax", + "no_copy": 0, + "options": null, + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Sales Invoice", + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2019-01-03 11:43:48.011702", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocType", + "field_name": null, + "idx": 0, + "modified": "2019-01-03 11:43:48.011702", + "modified_by": "Administrator", + "name": "Sales Invoice-read_only_onload", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only_onload", + "property_type": "Check", + "value": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-28 06:22:11.168032", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "cost_center", + "idx": 0, + "modified": "2018-12-28 06:22:11.168032", + "modified_by": "Administrator", + "name": "Sales Invoice-cost_center-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-28 06:22:10.475937", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "payment_schedule", + "idx": 0, + "modified": "2018-12-28 06:22:10.475937", + "modified_by": "Administrator", + "name": "Sales Invoice-payment_schedule-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-28 06:22:10.284350", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "due_date", + "idx": 0, + "modified": "2018-12-28 06:22:10.284350", + "modified_by": "Administrator", + "name": "Sales Invoice-due_date-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:54.864771", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "scan_barcode", + "idx": 0, + "modified": "2018-12-27 21:12:54.864771", + "modified_by": "Administrator", + "name": "Sales Invoice-scan_barcode-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:44.489762", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "in_words", + "idx": 0, + "modified": "2018-12-27 21:12:44.489762", + "modified_by": "Administrator", + "name": "Sales Invoice-in_words-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:44.351772", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "in_words", + "idx": 0, + "modified": "2018-12-27 21:12:44.351772", + "modified_by": "Administrator", + "name": "Sales Invoice-in_words-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:42.602285", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:42.602285", + "modified_by": "Administrator", + "name": "Sales Invoice-rounded_total-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:42.466760", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:42.466760", + "modified_by": "Administrator", + "name": "Sales Invoice-rounded_total-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:42.152895", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "base_rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:42.152895", + "modified_by": "Administrator", + "name": "Sales Invoice-base_rounded_total-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:42.021126", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "base_rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:42.021126", + "modified_by": "Administrator", + "name": "Sales Invoice-base_rounded_total-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.556215", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "tax_id", + "idx": 0, + "modified": "2018-12-27 21:12:40.556215", + "modified_by": "Administrator", + "name": "Sales Invoice-tax_id-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.423844", + "default_value": null, + "doc_type": "Sales Invoice", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "tax_id", + "idx": 0, + "modified": "2018-12-27 21:12:40.423844", + "modified_by": "Administrator", + "name": "Sales Invoice-tax_id-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + } + ], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/erpnext_taxjar/erpnext_taxjar/custom/sales_order.json b/erpnext_taxjar/erpnext_taxjar/custom/sales_order.json new file mode 100644 index 0000000..f3744e8 --- /dev/null +++ b/erpnext_taxjar/erpnext_taxjar/custom/sales_order.json @@ -0,0 +1,335 @@ +{ + "custom_fields": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": null, + "columns": 0, + "creation": "2019-01-03 11:41:33.500976", + "default": null, + "depends_on": null, + "description": null, + "docstatus": 0, + "dt": "Sales Order", + "fetch_from": null, + "fieldname": "exempt_from_sales_tax", + "fieldtype": "Check", + "hidden": 0, + "idx": 16, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "insert_after": "tax_id", + "label": "Is Customer Exempt from Sales Tax?", + "modified": "2019-01-03 11:41:33.500976", + "modified_by": "Administrator", + "name": "Sales Order-exempt_from_sales_tax", + "no_copy": 0, + "options": null, + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "print_width": null, + "read_only": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "translatable": 0, + "unique": 0, + "width": null + } + ], + "custom_perms": [], + "doctype": "Sales Order", + "property_setters": [ + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2019-01-03 11:41:53.041366", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocType", + "field_name": null, + "idx": 0, + "modified": "2019-01-03 11:41:53.041366", + "modified_by": "Administrator", + "name": "Sales Order-read_only_onload", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "read_only_onload", + "property_type": "Check", + "value": null + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-28 06:22:10.184819", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "payment_schedule", + "idx": 0, + "modified": "2018-12-28 06:22:10.184819", + "modified_by": "Administrator", + "name": "Sales Order-payment_schedule-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-28 06:22:10.082173", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "due_date", + "idx": 0, + "modified": "2018-12-28 06:22:10.082173", + "modified_by": "Administrator", + "name": "Sales Order-due_date-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:54.422121", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "scan_barcode", + "idx": 0, + "modified": "2018-12-27 21:12:54.422121", + "modified_by": "Administrator", + "name": "Sales Order-scan_barcode-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:44.245927", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "in_words", + "idx": 0, + "modified": "2018-12-27 21:12:44.245927", + "modified_by": "Administrator", + "name": "Sales Order-in_words-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:44.099031", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "in_words", + "idx": 0, + "modified": "2018-12-27 21:12:44.099031", + "modified_by": "Administrator", + "name": "Sales Order-in_words-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:41.924629", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:41.924629", + "modified_by": "Administrator", + "name": "Sales Order-rounded_total-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:41.826850", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:41.826850", + "modified_by": "Administrator", + "name": "Sales Order-rounded_total-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:41.728672", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "base_rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:41.728672", + "modified_by": "Administrator", + "name": "Sales Order-base_rounded_total-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "1" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:41.628654", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "base_rounded_total", + "idx": 0, + "modified": "2018-12-27 21:12:41.628654", + "modified_by": "Administrator", + "name": "Sales Order-base_rounded_total-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.312049", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "tax_id", + "idx": 0, + "modified": "2018-12-27 21:12:40.312049", + "modified_by": "Administrator", + "name": "Sales Order-tax_id-print_hide", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "print_hide", + "property_type": "Check", + "value": "0" + }, + { + "_assign": null, + "_comments": null, + "_liked_by": null, + "_user_tags": null, + "creation": "2018-12-27 21:12:40.212042", + "default_value": null, + "doc_type": "Sales Order", + "docstatus": 0, + "doctype_or_field": "DocField", + "field_name": "tax_id", + "idx": 0, + "modified": "2018-12-27 21:12:40.212042", + "modified_by": "Administrator", + "name": "Sales Order-tax_id-hidden", + "owner": "Administrator", + "parent": null, + "parentfield": null, + "parenttype": null, + "property": "hidden", + "property_type": "Check", + "value": "0" + } + ], + "sync_on_migrate": 1 +} \ No newline at end of file diff --git a/erpnext_taxjar/erpnext_taxjar/doctype/taxjar_settings/taxjar_settings.json b/erpnext_taxjar/erpnext_taxjar/doctype/taxjar_settings/taxjar_settings.json index d0570da..d5db68f 100644 --- a/erpnext_taxjar/erpnext_taxjar/doctype/taxjar_settings/taxjar_settings.json +++ b/erpnext_taxjar/erpnext_taxjar/doctype/taxjar_settings/taxjar_settings.json @@ -1,214 +1,256 @@ { - "allow_copy": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "beta": 0, - "creation": "2017-06-15 08:21:24.624315", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "Setup", - "editable_grid": 1, - "engine": "InnoDB", + "allow_copy": 0, + "allow_events_in_timeline": 0, + "allow_guest_to_view": 0, + "allow_import": 0, + "allow_rename": 0, + "beta": 0, + "creation": "2017-06-15 08:21:24.624315", + "custom": 0, + "docstatus": 0, + "doctype": "DocType", + "document_type": "Setup", + "editable_grid": 1, + "engine": "InnoDB", "fields": [ { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "credentials", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Credentials", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "credentials", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Credentials", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "api_key", - "fieldtype": "Password", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "API Key", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "api_key", + "fieldtype": "Password", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "API Key", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "configuration", - "fieldtype": "Section Break", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 0, - "in_standard_filter": 0, - "label": "Configuration", - "length": 0, - "no_copy": 0, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "configuration", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Configuration", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "tax_account_head", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Tax Account Head", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "tax_account_head", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Tax Account Head", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 - }, + }, { - "allow_bulk_edit": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "shipping_account_head", - "fieldtype": "Link", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Shipping Account Head", - "length": 0, - "no_copy": 0, - "options": "Account", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 1, - "search_index": 0, - "set_only_once": 0, + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "shipping_account_head", + "fieldtype": "Link", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Shipping Account Head", + "length": 0, + "no_copy": 0, + "options": "Account", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 1, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "column_break_6", + "fieldtype": "Column Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 0, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, "unique": 0 } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 1, - "istable": 0, - "max_attachments": 0, - "modified": "2018-02-21 03:05:02.516201", - "modified_by": "Administrator", - "module": "Erpnext Taxjar", - "name": "TaxJar Settings", - "name_case": "", - "owner": "Administrator", + ], + "has_web_view": 0, + "hide_heading": 0, + "hide_toolbar": 0, + "idx": 0, + "image_view": 0, + "in_create": 0, + "is_submittable": 0, + "issingle": 1, + "istable": 0, + "max_attachments": 0, + "modified": "2019-01-03 09:38:56.195306", + "modified_by": "Administrator", + "module": "Erpnext Taxjar", + "name": "TaxJar Settings", + "name_case": "", + "owner": "Administrator", "permissions": [ { - "amend": 0, - "apply_user_permissions": 0, - "cancel": 0, - "create": 1, - "delete": 1, - "email": 1, - "export": 0, - "if_owner": 0, - "import": 0, - "permlevel": 0, - "print": 1, - "read": 1, - "report": 0, - "role": "System Manager", - "set_user_permissions": 0, - "share": 1, - "submit": 0, + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 0, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 0, + "role": "System Manager", + "set_user_permissions": 0, + "share": 1, + "submit": 0, "write": 1 } - ], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0 + ], + "quick_entry": 1, + "read_only": 0, + "read_only_onload": 0, + "show_name_in_global_search": 0, + "sort_field": "modified", + "sort_order": "DESC", + "track_changes": 1, + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext_taxjar/hooks.py b/erpnext_taxjar/hooks.py index 0e38dd0..e018c93 100644 --- a/erpnext_taxjar/hooks.py +++ b/erpnext_taxjar/hooks.py @@ -3,7 +3,7 @@ from . import __version__ as app_version app_name = "erpnext_taxjar" -app_title = "Erpnext Taxjar" +app_title = "ERPNext TaxJar" app_publisher = "DigiThinkIT Inc" app_description = "TaxJar Integration with ERPNext" app_icon = "octicon octicon-file-directory" @@ -129,4 +129,3 @@ # override_whitelisted_methods = { # "frappe.desk.doctype.event.event.get_events": "erpnext_taxjar.event.get_events" # } - diff --git a/setup.py b/setup.py index 53874b3..bb29ffc 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,15 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages -from pip.req import parse_requirements import re, ast # get version from __version__ variable in erpnext_taxjar/__init__.py _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('erpnext_taxjar/__init__.py', 'rb') as f: - version = str(ast.literal_eval(_version_re.search( - f.read().decode('utf-8')).group(1))) + version = str(ast.literal_eval(_version_re.search(f.read().decode('utf-8')).group(1))) -requirements = parse_requirements("requirements.txt", session="") +with open('requirements.txt') as f: + install_requires = f.read().strip().split('\n') setup( name='erpnext_taxjar', @@ -21,6 +20,5 @@ packages=find_packages(), zip_safe=False, include_package_data=True, - install_requires=[str(ir.req) for ir in requirements], - dependency_links=[str(ir._link) for ir in requirements if ir._link] + install_requires=install_requires )