fix: fixed company field, updated patch
(cherry picked from commit 7f2d304f32fdf580a354c1dbba58189cdd4f35f2)
# Conflicts:
# erpnext/patches.txt
diff --git a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.js b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.js
index a362ba1..2925db8 100644
--- a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.js
+++ b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.js
@@ -11,14 +11,14 @@
frm.set_query('shipping_account_head', function() {
return {
filters: {
- 'company': frm.doc.current_company
+ 'company': frm.doc.company
}
};
});
frm.set_query('tax_account_head', function() {
return {
filters: {
- 'company': frm.doc.current_company
+ 'company': frm.doc.company
}
};
});
diff --git a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.json b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.json
index 1fda892..d9ae5b6 100644
--- a/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.json
+++ b/erpnext/erpnext_integrations/doctype/taxjar_settings/taxjar_settings.json
@@ -14,7 +14,6 @@
"cb_keys",
"sandbox_api_key",
"configuration",
- "current_company",
"column_break_10",
"tax_account_head",
"configuration_cb",
@@ -104,12 +103,6 @@
"read_only": 1
},
{
- "fieldname": "current_company",
- "fieldtype": "Link",
- "label": "Company",
- "options": "Company"
- },
- {
"fieldname": "configuration_cb",
"fieldtype": "Column Break"
},
@@ -120,7 +113,7 @@
],
"issingle": 1,
"links": [],
- "modified": "2021-11-08 14:40:15.684224",
+ "modified": "2021-11-08 17:57:17.323275",
"modified_by": "Administrator",
"module": "ERPNext Integrations",
"name": "TaxJar Settings",
diff --git a/erpnext/erpnext_integrations/taxjar_integration.py b/erpnext/erpnext_integrations/taxjar_integration.py
index 794b281..1adc1dd 100644
--- a/erpnext/erpnext_integrations/taxjar_integration.py
+++ b/erpnext/erpnext_integrations/taxjar_integration.py
@@ -6,7 +6,7 @@
from frappe.contacts.doctype.address.address import get_company_address
from frappe.utils import cint, flt
-from erpnext import get_default_company
+from erpnext import get_default_company, get_region
TAX_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "tax_account_head")
SHIP_ACCOUNT_HEAD = frappe.db.get_single_value("TaxJar Settings", "shipping_account_head")
@@ -19,7 +19,6 @@
'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',
'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY']
-USA_COMPANIES = frappe.get_all('Company', filters = {'country': 'United States'}, fields=['name'], pluck='name')
@@ -160,8 +159,7 @@
if not TAXJAR_CALCULATE_TAX:
return
- taxjar_settings_company = frappe.db.get_single_value('TaxJar Settings','current_company')
- if taxjar_settings_company not in USA_COMPANIES:
+ if get_region(doc.company):
return
if not doc.items:
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index a60b851..0dcd3b7 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -283,8 +283,12 @@
erpnext.patches.v13_0.einvoicing_deprecation_warning
execute:frappe.reload_doc("erpnext_integrations", "doctype", "TaxJar Settings")
execute:frappe.reload_doc("erpnext_integrations", "doctype", "Product Tax Category")
+<<<<<<< HEAD
erpnext.patches.v13_0.custom_fields_for_taxjar_integration
erpnext.patches.v14_0.delete_einvoicing_doctypes
+=======
+erpnext.patches.v13_0.custom_fields_for_taxjar_integration #08-11-2021
+>>>>>>> 7f2d304f32 (fix: fixed company field, updated patch)
erpnext.patches.v13_0.set_operation_time_based_on_operating_cost
erpnext.patches.v13_0.validate_options_for_data_field
erpnext.patches.v13_0.create_gst_payment_entry_fields
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 775e4d8..078c558 100644
--- a/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py
+++ b/erpnext/patches/v13_0/custom_fields_for_taxjar_integration.py
@@ -30,7 +30,7 @@
label='Product Tax Category')
],
'TaxJar Settings': [
- dict(fieldname='current_company', fieldtype='Link', insert_after='configuration', options='Company',
+ dict(fieldname='company', fieldtype='Link', insert_after='configuration', options='Company',
label='Company')
]
}