fix: improve patches
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index e9f39c9..aef80bc 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -301,7 +301,7 @@
erpnext.patches.v13_0.enable_provisional_accounting
erpnext.patches.v13_0.non_profit_deprecation_warning
erpnext.patches.v13_0.enable_ksa_vat_docs #1
-erpnext.patches.v13_0.remove_india_deprecation_warning
+erpnext.patches.v13_0.show_india_localisation_deprecation_warning
[post_model_sync]
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
@@ -345,4 +345,4 @@
erpnext.patches.v13_0.job_card_status_on_hold
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
erpnext.patches.v14_0.crm_ux_cleanup
-erpnext.patches.v14_0.delete_regional_india_doctypes
+erpnext.patches.v14_0.remove_india_localisation
diff --git a/erpnext/patches/v13_0/remove_india_deprecation_warning.py b/erpnext/patches/v13_0/remove_india_deprecation_warning.py
deleted file mode 100644
index 006587f..0000000
--- a/erpnext/patches/v13_0/remove_india_deprecation_warning.py
+++ /dev/null
@@ -1,10 +0,0 @@
-import click
-
-
-def execute():
-
- click.secho(
- "Regional India is moved to a separate app and will be removed from ERPNext in version-14.\n"
- "Please install the app to continue using the module after upgrading to version-14: https://github.com/resilient-tech/india-compliance",
- fg="yellow",
- )
diff --git a/erpnext/patches/v13_0/show_india_localisation_deprecation_warning.py b/erpnext/patches/v13_0/show_india_localisation_deprecation_warning.py
new file mode 100644
index 0000000..1d76b25
--- /dev/null
+++ b/erpnext/patches/v13_0/show_india_localisation_deprecation_warning.py
@@ -0,0 +1,15 @@
+import click
+import frappe
+
+
+def execute():
+ if not frappe.db.exists("Company", {"country": "India"}):
+ return
+
+ click.secho(
+ "India-specific regional features have been moved to a separate app"
+ " and will be removed from ERPNext in Version 14."
+ " Please install India Compliance after upgrading to Version 14:\n"
+ "https://github.com/resilient-tech/india-compliance",
+ fg="yellow",
+ )
diff --git a/erpnext/patches/v14_0/delete_regional_india_doctypes.py b/erpnext/patches/v14_0/remove_india_localisation.py
similarity index 64%
rename from erpnext/patches/v14_0/delete_regional_india_doctypes.py
rename to erpnext/patches/v14_0/remove_india_localisation.py
index f3e7020..e7bfe6b 100644
--- a/erpnext/patches/v14_0/delete_regional_india_doctypes.py
+++ b/erpnext/patches/v14_0/remove_india_localisation.py
@@ -34,10 +34,20 @@
}
for doctype, names in to_delete.items():
- frappe.delete_doc(doctype, names, ignore_missing=True, force=True)
+ frappe.delete_doc(
+ doctype,
+ names,
+ force=True,
+ ignore_permissions=True,
+ ignore_missing=True,
+ )
+
+ if not frappe.db.exists("Company", {"country": "India"}):
+ return
click.secho(
- "Regional India is moved to a separate app and is removed from ERPNext.\n"
- "Please install the app to continue using the module: https://github.com/resilient-tech/india-compliance",
+ "India-specific regional features have been moved to a separate app."
+ " Please install India Compliance to continue using these features:"
+ " https://github.com/resilient-tech/india-compliance",
fg="yellow",
)