mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
fix: Add tax categories on company setup
This commit is contained in:
@@ -1166,6 +1166,28 @@
|
|||||||
"India": {
|
"India": {
|
||||||
"chart_of_accounts": {
|
"chart_of_accounts": {
|
||||||
"*": {
|
"*": {
|
||||||
|
"tax_categories": [
|
||||||
|
{
|
||||||
|
"title": "In-Sate",
|
||||||
|
"is_inter_state": 0,
|
||||||
|
"gst_state": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Out-Sate",
|
||||||
|
"is_inter_state": 1,
|
||||||
|
"gst_state": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Reverse Charge",
|
||||||
|
"is_inter_state": 0,
|
||||||
|
"gst_state": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Registered Composition",
|
||||||
|
"is_inter_state": 0,
|
||||||
|
"gst_state": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
"item_tax_templates": [
|
"item_tax_templates": [
|
||||||
{
|
{
|
||||||
"title": "GST 9%",
|
"title": "GST 9%",
|
||||||
|
|||||||
@@ -77,16 +77,11 @@ def simple_to_detailed(templates):
|
|||||||
def from_detailed_data(company_name, data):
|
def from_detailed_data(company_name, data):
|
||||||
"""Create Taxes and Charges Templates from detailed data."""
|
"""Create Taxes and Charges Templates from detailed data."""
|
||||||
coa_name = frappe.db.get_value('Company', company_name, 'chart_of_accounts')
|
coa_name = frappe.db.get_value('Company', company_name, 'chart_of_accounts')
|
||||||
coa_data = data.get('chart_of_accounts', {})
|
tax_templates = data.get(coa_name) or data.get('*')
|
||||||
tax_templates = coa_data.get(coa_name) or coa_data.get('*', {})
|
sales_tax_templates = tax_templates.get('sales_tax_templates') or tax_templates.get('*')
|
||||||
tax_categories = data.get('tax_categories')
|
purchase_tax_templates = tax_templates.get('purchase_tax_templates') or tax_templates.get('*')
|
||||||
sales_tax_templates = tax_templates.get('sales_tax_templates') or tax_templates.get('*', {})
|
item_tax_templates = tax_templates.get('item_tax_templates') or tax_templates.get('*')
|
||||||
purchase_tax_templates = tax_templates.get('purchase_tax_templates') or tax_templates.get('*', {})
|
tax_categories = tax_templates.get('tax_categories')
|
||||||
item_tax_templates = tax_templates.get('item_tax_templates') or tax_templates.get('*', {})
|
|
||||||
|
|
||||||
if tax_categories:
|
|
||||||
for tax_category in tax_categories:
|
|
||||||
make_tax_catgory(tax_category)
|
|
||||||
|
|
||||||
if sales_tax_templates:
|
if sales_tax_templates:
|
||||||
for template in sales_tax_templates:
|
for template in sales_tax_templates:
|
||||||
@@ -100,6 +95,10 @@ def from_detailed_data(company_name, data):
|
|||||||
for template in item_tax_templates:
|
for template in item_tax_templates:
|
||||||
make_item_tax_template(company_name, template)
|
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):
|
def make_taxes_and_charges_template(company_name, doctype, template):
|
||||||
template['company'] = company_name
|
template['company'] = company_name
|
||||||
@@ -158,6 +157,11 @@ def make_item_tax_template(company_name, template):
|
|||||||
|
|
||||||
return frappe.get_doc(template).insert(ignore_permissions=True)
|
return frappe.get_doc(template).insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
def get_or_create_account(company_name, account):
|
def get_or_create_account(company_name, account):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user