fix: unlink custom fields in patch

This commit is contained in:
Sagar Vora 2022-07-14 15:02:17 +05:30
parent be4a44fccd
commit 70c4117c22
3 changed files with 28 additions and 9 deletions

View File

@ -346,4 +346,4 @@ erpnext.patches.v13_0.job_card_status_on_hold
erpnext.patches.v14_0.copy_is_subcontracted_value_to_is_old_subcontracting_flow
erpnext.patches.v14_0.migrate_gl_to_payment_ledger
erpnext.patches.v14_0.crm_ux_cleanup
erpnext.patches.v14_0.remove_india_localisation # 07-07-2022
erpnext.patches.v14_0.remove_india_localisation # 14-07-2022

View File

@ -3,7 +3,10 @@ import frappe
def execute():
if not frappe.db.exists("Company", {"country": "India"}):
if (
not frappe.db.exists("Company", {"country": "India"})
or "india_compliance" in frappe.get_installed_apps()
):
return
click.secho(

View File

@ -3,6 +3,24 @@ import frappe
def execute():
if "india_compliance" in frappe.get_installed_apps():
return
delete_docs()
unlink_custom_fields()
if not frappe.db.exists("Company", {"country": "India"}):
return
click.secho(
"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",
)
def delete_docs():
to_delete = {
"DocType": [
"C-Form",
@ -44,12 +62,10 @@ def execute():
ignore_missing=True,
)
if not frappe.db.exists("Company", {"country": "India"}):
return
click.secho(
"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",
def unlink_custom_fields():
frappe.db.set_value(
"Custom Field",
{"dt": "Item", "fieldname": "gst_hsn_code"},
{"fieldtype": "Data", "options": ""},
)