From cbff07ef4485ffc331d0d8df711b7ca4097b17fd Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 14 Jul 2023 19:35:57 +0200 Subject: [PATCH] feat: remove custom records on uninstall --- erpnext_germany/uninstall.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext_germany/uninstall.py b/erpnext_germany/uninstall.py index dbbe8eb..6ba5a73 100644 --- a/erpnext_germany/uninstall.py +++ b/erpnext_germany/uninstall.py @@ -4,6 +4,7 @@ def before_uninstall(): remove_custom_fields() remove_property_setters() + remove_custom_records() def remove_custom_fields(): @@ -35,3 +36,10 @@ def remove_property_setters(): "value": ps[-2] } ) + + +def remove_custom_records(): + print("* removing custom records...") + for record in frappe.get_hooks("germany_custom_records"): + doctype = record.pop("doctype") + frappe.db.delete(doctype, record)