mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 22:48:27 +00:00
fix: merge conflict
This commit is contained in:
@@ -1164,33 +1164,292 @@
|
||||
},
|
||||
|
||||
"India": {
|
||||
"tax_categories": [
|
||||
{
|
||||
"title": "In-State",
|
||||
"is_inter_state": 0,
|
||||
"gst_state": ""
|
||||
},
|
||||
{
|
||||
"title": "Out-State",
|
||||
"is_inter_state": 1,
|
||||
"gst_state": ""
|
||||
},
|
||||
{
|
||||
"title": "Reverse Charge In-State",
|
||||
"is_inter_state": 0,
|
||||
"gst_state": ""
|
||||
},
|
||||
{
|
||||
"title": "Reverse Charge Out-State",
|
||||
"is_inter_state": 1,
|
||||
"gst_state": ""
|
||||
},
|
||||
{
|
||||
"title": "Registered Composition",
|
||||
"is_inter_state": 0,
|
||||
"gst_state": ""
|
||||
}
|
||||
],
|
||||
"chart_of_accounts": {
|
||||
"*": {
|
||||
"item_tax_templates": [
|
||||
{
|
||||
"title": "In State GST",
|
||||
"title": "GST 9%",
|
||||
"taxes": [
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "SGST",
|
||||
"account_name": "Output Tax SGST",
|
||||
"tax_rate": 9.00
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "CGST",
|
||||
"account_name": "Output Tax CGST",
|
||||
"tax_rate": 9.00
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax IGST",
|
||||
"tax_rate": 18.00
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST",
|
||||
"tax_rate": 18.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST RCM",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST RCM",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST RCM",
|
||||
"tax_rate": 18.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Out of State GST",
|
||||
"title": "GST 5%",
|
||||
"taxes": [
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "IGST",
|
||||
"tax_rate": 18.00
|
||||
"account_name": "Output Tax SGST",
|
||||
"tax_rate": 2.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax CGST",
|
||||
"tax_rate": 2.5
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax IGST",
|
||||
"tax_rate": 5.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST",
|
||||
"tax_rate": 2.5,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST",
|
||||
"tax_rate": 2.5,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST",
|
||||
"tax_rate": 5.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST RCM",
|
||||
"tax_rate": 2.50,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST RCM",
|
||||
"tax_rate": 2.50,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST RCM",
|
||||
"tax_rate": 5.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "GST 12%",
|
||||
"taxes": [
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax SGST",
|
||||
"tax_rate": 6.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax CGST",
|
||||
"tax_rate": 6.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax IGST",
|
||||
"tax_rate": 12.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST",
|
||||
"tax_rate": 6.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST",
|
||||
"tax_rate": 6.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST",
|
||||
"tax_rate": 12.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST RCM",
|
||||
"tax_rate": 6.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST RCM",
|
||||
"tax_rate": 6.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST RCM",
|
||||
"tax_rate": 12.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "GST 28%",
|
||||
"taxes": [
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax SGST",
|
||||
"tax_rate": 14.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax CGST",
|
||||
"tax_rate": 14.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Output Tax IGST",
|
||||
"tax_rate": 28.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST",
|
||||
"tax_rate": 14.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST",
|
||||
"tax_rate": 14.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST",
|
||||
"tax_rate": 28.0,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax SGST RCM",
|
||||
"tax_rate": 14.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax CGST RCM",
|
||||
"tax_rate": 14.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
},
|
||||
{
|
||||
"tax_type": {
|
||||
"account_name": "Input Tax IGST RCM",
|
||||
"tax_rate": 28.00,
|
||||
"root_type": "Asset"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1229,35 +1488,116 @@
|
||||
]
|
||||
}
|
||||
],
|
||||
"*": [
|
||||
"sales_tax_templates": [
|
||||
{
|
||||
"title": "In State GST",
|
||||
"title": "Output GST In-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "SGST",
|
||||
"tax_rate": 9.00
|
||||
"account_name": "Output Tax SGST",
|
||||
"tax_rate": 9.00,
|
||||
"account_type": "Tax"
|
||||
}
|
||||
},
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "CGST",
|
||||
"tax_rate": 9.00
|
||||
"account_name": "Output Tax CGST",
|
||||
"tax_rate": 9.00,
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"tax_category": "In-State"
|
||||
},
|
||||
{
|
||||
"title": "Out of State GST",
|
||||
"title": "Output GST Out-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "IGST",
|
||||
"tax_rate": 18.00
|
||||
"account_name": "Output Tax IGST",
|
||||
"tax_rate": 18.00,
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"tax_category": "Out-State"
|
||||
}
|
||||
],
|
||||
"purchase_tax_templates": [
|
||||
{
|
||||
"title": "Input GST In-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax SGST",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
},
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax CGST",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tax_category": "In-State"
|
||||
},
|
||||
{
|
||||
"title": "Input GST Out-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax IGST",
|
||||
"tax_rate": 18.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tax_category": "Out-State"
|
||||
},
|
||||
{
|
||||
"title": "Input GST RCM In-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax SGST RCM",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
},
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax CGST RCM",
|
||||
"tax_rate": 9.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tax_category": "Reverse Charge In-State"
|
||||
},
|
||||
{
|
||||
"title": "Input GST RCM Out-state",
|
||||
"taxes": [
|
||||
{
|
||||
"account_head": {
|
||||
"account_name": "Input Tax IGST RCM",
|
||||
"tax_rate": 18.00,
|
||||
"root_type": "Asset",
|
||||
"account_type": "Tax"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tax_category": "Reverse Charge Out-State"
|
||||
}
|
||||
],
|
||||
"*": [
|
||||
{
|
||||
"title": "VAT 5%",
|
||||
"taxes": [
|
||||
@@ -1349,7 +1689,7 @@
|
||||
"Italy VAT 4%":{
|
||||
"account_name": "IVA 4%",
|
||||
"tax_rate": 4.00
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"Ivory Coast": {
|
||||
|
||||
@@ -42,29 +42,6 @@ def enable_shopping_cart(args):
|
||||
'quotation_series': "QTN-",
|
||||
}).insert()
|
||||
|
||||
def create_bank_account(args):
|
||||
if args.get("bank_account"):
|
||||
company_name = args.get('company_name')
|
||||
bank_account_group = frappe.db.get_value("Account",
|
||||
{"account_type": "Bank", "is_group": 1, "root_type": "Asset",
|
||||
"company": company_name})
|
||||
if bank_account_group:
|
||||
bank_account = frappe.get_doc({
|
||||
"doctype": "Account",
|
||||
'account_name': args.get("bank_account"),
|
||||
'parent_account': bank_account_group,
|
||||
'is_group':0,
|
||||
'company': company_name,
|
||||
"account_type": "Bank",
|
||||
})
|
||||
try:
|
||||
return bank_account.insert()
|
||||
except RootNotEditable:
|
||||
frappe.throw(_("Bank account cannot be named as {0}").format(args.get("bank_account")))
|
||||
except frappe.DuplicateEntryError:
|
||||
# bank account same as a CoA entry
|
||||
pass
|
||||
|
||||
def create_email_digest():
|
||||
from frappe.utils.user import get_system_managers
|
||||
system_managers = get_system_managers(only_name=True)
|
||||
|
||||
@@ -448,6 +448,8 @@ def install_defaults(args=None):
|
||||
set_active_domains(args)
|
||||
update_stock_settings()
|
||||
update_shopping_cart_settings(args)
|
||||
|
||||
args.update({"set_default": 1})
|
||||
create_bank_account(args)
|
||||
|
||||
def set_global_defaults(args):
|
||||
@@ -479,17 +481,17 @@ def update_stock_settings():
|
||||
stock_settings.save()
|
||||
|
||||
def create_bank_account(args):
|
||||
if not args.bank_account:
|
||||
if not args.get('bank_account'):
|
||||
return
|
||||
|
||||
company_name = args.company_name
|
||||
company_name = args.get('company_name')
|
||||
bank_account_group = frappe.db.get_value("Account",
|
||||
{"account_type": "Bank", "is_group": 1, "root_type": "Asset",
|
||||
"company": company_name})
|
||||
if bank_account_group:
|
||||
bank_account = frappe.get_doc({
|
||||
"doctype": "Account",
|
||||
'account_name': args.bank_account,
|
||||
'account_name': args.get('bank_account'),
|
||||
'parent_account': bank_account_group,
|
||||
'is_group':0,
|
||||
'company': company_name,
|
||||
@@ -498,10 +500,13 @@ def create_bank_account(args):
|
||||
try:
|
||||
doc = bank_account.insert()
|
||||
|
||||
frappe.db.set_value("Company", args.company_name, "default_bank_account", bank_account.name, update_modified=False)
|
||||
if args.get('set_default'):
|
||||
frappe.db.set_value("Company", args.get('company_name'), "default_bank_account", bank_account.name, update_modified=False)
|
||||
|
||||
return doc
|
||||
|
||||
except RootNotEditable:
|
||||
frappe.throw(_("Bank account cannot be named as {0}").format(args.bank_account))
|
||||
frappe.throw(_("Bank account cannot be named as {0}").format(args.get('bank_account')))
|
||||
except frappe.DuplicateEntryError:
|
||||
# bank account same as a CoA entry
|
||||
pass
|
||||
|
||||
@@ -27,6 +27,7 @@ def setup_taxes_and_charges(company_name: str, country: str):
|
||||
country_wise_tax = simple_to_detailed(country_wise_tax)
|
||||
|
||||
from_detailed_data(company_name, country_wise_tax)
|
||||
update_regional_tax_settings(country, company_name)
|
||||
|
||||
|
||||
def simple_to_detailed(templates):
|
||||
@@ -101,6 +102,17 @@ def from_detailed_data(company_name, data):
|
||||
make_item_tax_template(company_name, template)
|
||||
|
||||
|
||||
def update_regional_tax_settings(country, company):
|
||||
path = frappe.get_app_path('erpnext', 'regional', frappe.scrub(country))
|
||||
if os.path.exists(path.encode("utf-8")):
|
||||
try:
|
||||
module_name = "erpnext.regional.{0}.setup.update_regional_tax_settings".format(frappe.scrub(country))
|
||||
frappe.get_attr(module_name)(country, company)
|
||||
except Exception as e:
|
||||
# Log error and ignore if failed to setup regional tax settings
|
||||
frappe.log_error()
|
||||
pass
|
||||
|
||||
def make_taxes_and_charges_template(company_name, doctype, template):
|
||||
template['company'] = company_name
|
||||
template['doctype'] = doctype
|
||||
@@ -130,8 +142,14 @@ def make_taxes_and_charges_template(company_name, doctype, template):
|
||||
if fieldname not in tax_row:
|
||||
tax_row[fieldname] = default_value
|
||||
|
||||
return frappe.get_doc(template).insert(ignore_permissions=True)
|
||||
doc = frappe.get_doc(template)
|
||||
|
||||
# Data in country wise json is already pre validated, hence validations can be ignored
|
||||
# Ingone validations to make doctypes faster
|
||||
doc.flags.ignore_links = True
|
||||
doc.flags.ignore_validate = True
|
||||
doc.insert(ignore_permissions=True)
|
||||
return doc
|
||||
|
||||
def make_item_tax_template(company_name, template):
|
||||
"""Create an Item Tax Template.
|
||||
@@ -156,8 +174,24 @@ def make_item_tax_template(company_name, template):
|
||||
if 'tax_rate' not in tax_row:
|
||||
tax_row['tax_rate'] = account_data.get('tax_rate')
|
||||
|
||||
return frappe.get_doc(template).insert(ignore_permissions=True)
|
||||
doc = frappe.get_doc(template)
|
||||
|
||||
# Data in country wise json is already pre validated, hence validations can be ignored
|
||||
# Ingone validations to make doctypes faster
|
||||
doc.flags.ignore_links = True
|
||||
doc.flags.ignore_validate = True
|
||||
doc.insert(ignore_permissions=True)
|
||||
return doc
|
||||
|
||||
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['title']):
|
||||
tax_category['doctype'] = doctype
|
||||
doc = frappe.get_doc(tax_category)
|
||||
doc.flags.ignore_links = True
|
||||
doc.flags.ignore_validate = True
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
def get_or_create_account(company_name, account):
|
||||
"""
|
||||
@@ -175,8 +209,7 @@ def get_or_create_account(company_name, account):
|
||||
or_filters={
|
||||
'account_name': account.get('account_name'),
|
||||
'account_number': account.get('account_number')
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
if existing_accounts:
|
||||
return frappe.get_doc('Account', existing_accounts[0].name)
|
||||
@@ -191,8 +224,11 @@ def get_or_create_account(company_name, account):
|
||||
account['root_type'] = root_type
|
||||
account['is_group'] = 0
|
||||
|
||||
return frappe.get_doc(account).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
|
||||
doc = frappe.get_doc(account)
|
||||
doc.flags.ignore_links = True
|
||||
doc.flags.ignore_validate = True
|
||||
doc.insert(ignore_permissions=True, ignore_mandatory=True)
|
||||
return doc
|
||||
|
||||
def get_or_create_tax_group(company_name, root_type):
|
||||
# Look for a group account of type 'Tax'
|
||||
@@ -237,7 +273,11 @@ def get_or_create_tax_group(company_name, root_type):
|
||||
'account_type': 'Tax',
|
||||
'account_name': account_name,
|
||||
'parent_account': root_account.name
|
||||
}).insert(ignore_permissions=True)
|
||||
})
|
||||
|
||||
tax_group_account.flags.ignore_links = True
|
||||
tax_group_account.flags.ignore_validate = True
|
||||
tax_group_account.insert(ignore_permissions=True)
|
||||
|
||||
tax_group_name = tax_group_account.name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user