fix: Added company field, filtered account heads

This commit is contained in:
Subin Tom
2021-11-08 15:16:20 +05:30
parent 904010ab64
commit 902c03cd37
4 changed files with 44 additions and 5 deletions

View File

@@ -19,6 +19,8 @@ SUPPORTED_STATE_CODES = ['AL', 'AK', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', '
'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')
def get_client():
@@ -158,6 +160,10 @@ def set_sales_tax(doc, method):
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:
return
if not doc.items:
return