fix(setup): scope regional-tax-settings rollback to a savepoint (review)

from_detailed_data inserts tax templates/accounts before update_regional_tax_settings in the same transaction; a full frappe.db.rollback() on regional-setup failure discarded those templates while the wizard continued. Take a savepoint before the regional call and roll back only to it.
This commit is contained in:
Mihir Kandoi
2026-06-30 12:17:38 +05:30
parent 16a6a4913e
commit bd57e43446

View File

@@ -120,6 +120,7 @@ def from_detailed_data(company_name, data):
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")):
frappe.db.savepoint("regional_tax_settings")
try:
module_name = f"erpnext.regional.{frappe.scrub(country)}.setup.update_regional_tax_settings"
frappe.get_attr(module_name)(country, company)
@@ -127,7 +128,7 @@ def update_regional_tax_settings(country, company):
pass
except Exception:
# Log error and ignore if failed to setup regional tax settings
frappe.db.rollback()
frappe.db.rollback(save_point="regional_tax_settings")
frappe.log_error("Unable to setup regional tax settings")