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 2acc66db2c
commit 50997709d5
2 changed files with 34 additions and 22 deletions

View File

@ -820,12 +820,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": ""
},
@ -1046,16 +1046,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",
@ -1063,10 +1066,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": [
@ -1077,17 +1082,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",
@ -1096,10 +1104,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

@ -80,6 +80,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)
@ -92,10 +96,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
@ -154,8 +154,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):
"""
@ -167,12 +168,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
}
)