From c0c9b50a5f7f13f4953859d0e678ddd5caa20083 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 6 Oct 2022 18:08:27 +0530 Subject: [PATCH] fix: delete custom fields after app in uninstalled --- lms/hooks.py | 3 ++- lms/install.py | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 lms/install.py diff --git a/lms/hooks.py b/lms/hooks.py index 630ae045..57865f76 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -60,7 +60,8 @@ web_include_js = ["website.bundle.js", "controls.bundle.js"] # ------------ # before_install = "lms.install.before_install" -# after_install = "lms.install.after_install" +after_uninstall = "lms.install.after_uninstall" + # Desk Notifications # ------------------ diff --git a/lms/install.py b/lms/install.py new file mode 100644 index 00000000..1f25e20c --- /dev/null +++ b/lms/install.py @@ -0,0 +1,17 @@ +import frappe + +def after_uninstall(): + delete_custom_fields() + +def delete_custom_fields(): + fields = [ "user_category", "headline", "college", "city", "verify_terms", "country", "preferred_location", + "preferred_functions", "preferred_industries", "work_environment_column", "time", "role", "carrer_preference_details", + "skill", "certification_details", "internship", "branch", "github", "medium", "linkedin", "profession", "looking_for_job", + "work_environment", "dream_companies", "career_preference_column", "attire", "collaboration", "location_preference", + "company_type", "skill_details", "certification", "education", "work_experience", "education_details", "hide_private", + "work_experience_details", "profile_complete", "cover_image" + ] + + for field in fields: + frappe.db.delete("Custom Field", {"fieldname": field}) + frappe.db.commit()