fix: Regional settings setup
This commit is contained in:
parent
a72589cb7e
commit
269510b98f
@ -15,7 +15,6 @@ def setup(company=None, patch=True):
|
|||||||
setup_company_independent_fixtures(patch=patch)
|
setup_company_independent_fixtures(patch=patch)
|
||||||
if not patch:
|
if not patch:
|
||||||
make_fixtures(company)
|
make_fixtures(company)
|
||||||
setup_gst_settings(company)
|
|
||||||
|
|
||||||
# TODO: for all countries
|
# TODO: for all countries
|
||||||
def setup_company_independent_fixtures(patch=False):
|
def setup_company_independent_fixtures(patch=False):
|
||||||
@ -700,7 +699,7 @@ def make_fixtures(company=None):
|
|||||||
# create records for Tax Withholding Category
|
# create records for Tax Withholding Category
|
||||||
set_tax_withholding_category(company)
|
set_tax_withholding_category(company)
|
||||||
|
|
||||||
def setup_gst_settings(company):
|
def update_regional_tax_settings(country, company):
|
||||||
# Will only add default GST accounts if present
|
# Will only add default GST accounts if present
|
||||||
input_account_names = ['Input Tax CGST', 'Input Tax SGST', 'Input Tax IGST']
|
input_account_names = ['Input Tax CGST', 'Input Tax SGST', 'Input Tax IGST']
|
||||||
output_account_names = ['Output Tax CGST', 'Output Tax SGST', 'Output Tax IGST']
|
output_account_names = ['Output Tax CGST', 'Output Tax SGST', 'Output Tax IGST']
|
||||||
|
@ -110,8 +110,8 @@ class Company(NestedSet):
|
|||||||
self.create_default_warehouses()
|
self.create_default_warehouses()
|
||||||
|
|
||||||
if frappe.flags.country_change:
|
if frappe.flags.country_change:
|
||||||
self.create_default_tax_template()
|
|
||||||
install_country_fixtures(self.name, self.country)
|
install_country_fixtures(self.name, self.country)
|
||||||
|
self.create_default_tax_template()
|
||||||
|
|
||||||
if not frappe.db.get_value("Department", {"company": self.name}):
|
if not frappe.db.get_value("Department", {"company": self.name}):
|
||||||
from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
|
from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
|
||||||
|
@ -26,7 +26,8 @@ def setup_taxes_and_charges(company_name: str, country: str):
|
|||||||
if 'chart_of_accounts' not in country_wise_tax:
|
if 'chart_of_accounts' not in country_wise_tax:
|
||||||
country_wise_tax = simple_to_detailed(country_wise_tax)
|
country_wise_tax = simple_to_detailed(country_wise_tax)
|
||||||
|
|
||||||
from_detailed_data(company_name, country_wise_tax)
|
from_detailed_data(company_name, country_wise_tax.get('chart_of_accounts'))
|
||||||
|
update_regional_tax_settings(country, company_name)
|
||||||
|
|
||||||
|
|
||||||
def simple_to_detailed(templates):
|
def simple_to_detailed(templates):
|
||||||
@ -100,6 +101,17 @@ def from_detailed_data(company_name, data):
|
|||||||
make_item_tax_template(company_name, template)
|
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):
|
def make_taxes_and_charges_template(company_name, doctype, template):
|
||||||
template['company'] = company_name
|
template['company'] = company_name
|
||||||
template['doctype'] = doctype
|
template['doctype'] = doctype
|
||||||
|
Loading…
Reference in New Issue
Block a user