From ea9ca67d1ecd48c934168d1ed6c657089e4fb8ab Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 14 Mar 2023 10:56:08 +0530 Subject: [PATCH] fix: delete using before_uninstall hook --- lms/hooks.py | 2 +- lms/install.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lms/hooks.py b/lms/hooks.py index b3b065dd..c9078ef3 100644 --- a/lms/hooks.py +++ b/lms/hooks.py @@ -60,7 +60,7 @@ web_include_js = ["website.bundle.js"] # before_install = "lms.install.before_install" after_install = "lms.install.after_install" after_sync = "lms.install.after_sync" -after_uninstall = "lms.install.after_uninstall" +before_uninstall = "lms.install.before_uninstall" setup_wizard_requires = "assets/lms/js/setup_wizard.js" diff --git a/lms/install.py b/lms/install.py index af58c9d7..b75b5518 100644 --- a/lms/install.py +++ b/lms/install.py @@ -44,7 +44,7 @@ def add_pages_to_nav(): ).save() -def after_uninstall(): +def before_uninstall(): delete_custom_fields() delete_lms_roles() @@ -59,7 +59,6 @@ def delete_lms_roles(): for role in roles: if frappe.db.exists("Role", role): frappe.db.delete("Role", role) - frappe.db.commit() def set_default_home(): @@ -135,4 +134,3 @@ def delete_custom_fields(): for field in fields: frappe.db.delete("Custom Field", {"fieldname": field}) - frappe.db.commit()