fix: Update country-wise-tax JSON and tax setup

This commit is contained in:
Deepesh Garg 2021-04-21 20:41:57 +05:30
parent 3031535a24
commit e166c264b4
2 changed files with 34 additions and 22 deletions

View File

@ -1168,12 +1168,12 @@
"*": {
"tax_categories": [
{
"title": "In-Sate",
"title": "In-State",
"is_inter_state": 0,
"gst_state": ""
},
{
"title": "Out-Sate",
"title": "Out-State",
"is_inter_state": 1,
"gst_state": ""
},
@ -1394,16 +1394,19 @@
{
"account_head": {
"account_name": "Output Tax SGST",
"tax_rate": 9.00
"tax_rate": 9.00,
"account_type": "Tax"
}
},
{
"account_head": {
"account_name": "Output Tax CGST",
"tax_rate": 9.00
"tax_rate": 9.00,
"account_type": "Tax"
}
}
]
],
"tax_category": "In-State"
},
{
"title": "Output GST Out-state",
@ -1411,10 +1414,12 @@
{
"account_head": {
"account_name": "Output Tax IGST",
"tax_rate": 18.00
"tax_rate": 18.00,
"account_type": "Tax"
}
}
]
],
"tax_category": "Out-State"
}
],
"purchase_tax_templates": [
@ -1425,17 +1430,20 @@
"account_head": {
"account_name": "Input Tax SGST",
"tax_rate": 9.00,
"root_type": "Asset"
"root_type": "Asset",
"account_type": "Tax"
}
},
{
"account_head": {
"account_name": "Input Tax CGST",
"tax_rate": 9.00,
"root_type": "Asset"
"root_type": "Asset",
"account_type": "Tax"
}
}
]
],
"tax_category": "In-State"
},
{
"title": "Input GST Out-state",
@ -1444,10 +1452,12 @@
"account_head": {
"account_name": "Input Tax IGST",
"tax_rate": 18.00,
"root_type": "Asset"
"root_type": "Asset",
"account_type": "Tax"
}
}
]
],
"tax_category": "Out-State"
}
],
"*": [

View File

@ -83,6 +83,10 @@ def from_detailed_data(company_name, data):
item_tax_templates = tax_templates.get('item_tax_templates') or tax_templates.get('*')
tax_categories = tax_templates.get('tax_categories')
if tax_categories:
for tax_category in tax_categories:
make_tax_category(tax_category)
if sales_tax_templates:
for template in sales_tax_templates:
make_taxes_and_charges_template(company_name, 'Sales Taxes and Charges Template', template)
@ -95,10 +99,6 @@ def from_detailed_data(company_name, data):
for template in item_tax_templates:
make_item_tax_template(company_name, template)
if tax_categories:
for tax_category in tax_categories:
make_tax_category(tax_category)
def make_taxes_and_charges_template(company_name, doctype, template):
template['company'] = company_name
@ -160,8 +160,9 @@ def make_item_tax_template(company_name, template):
def make_tax_category(tax_category):
""" Make tax category based on title if not already created """
doctype = 'Tax Category'
if not frappe.db.exists(doctype, tax_category)
frappe.get_doc(tax_category).insert(ignore_permissions=True)
if not frappe.db.exists(doctype, tax_category):
tax_category['doctype'] = doctype
frappe.get_doc(tax_category).insert(ignore_permissions=True)
def get_or_create_account(company_name, account):
"""
@ -173,12 +174,13 @@ def get_or_create_account(company_name, account):
existing_accounts = frappe.get_list('Account',
filters={
'company': company_name,
'root_type': root_type
'account_name': account.get('account_name'),
'account_number': account.get('account_number', '')
},
or_filters={
'account_name': account.get('account_name'),
'account_number': account.get('account_number')
'company': company_name,
'root_type': root_type,
'is_group': 0
}
)