fix: set flag in_uninstall to not delete controller code
when bench command is executed to uninstall-app from site, controller code should not be deleted
This commit is contained in:
parent
e5a87aa421
commit
009c994d2d
2 changed files with 5 additions and 2 deletions
|
|
@ -119,7 +119,7 @@ def remove_from_installed_apps(app_name):
|
|||
post_install()
|
||||
|
||||
def remove_app(app_name, dry_run=False, yes=False, no_backup=False):
|
||||
"""Delete app and all linked to the app's module with the app."""
|
||||
"""Remove app and all linked to the app's module with the app from a site."""
|
||||
|
||||
if not dry_run and not yes:
|
||||
confirm = input("All doctypes (including custom), modules related to this app will be deleted. Are you sure you want to continue (y/n) ? ")
|
||||
|
|
@ -131,6 +131,7 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False):
|
|||
print("Backing up...")
|
||||
scheduled_backup(ignore_files=True)
|
||||
|
||||
frappe.flags.in_uninstall = True
|
||||
drop_doctypes = []
|
||||
|
||||
# remove modules, doctypes, roles
|
||||
|
|
@ -165,6 +166,8 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False):
|
|||
for doctype in set(drop_doctypes):
|
||||
frappe.db.sql("drop table `tab{0}`".format(doctype))
|
||||
|
||||
frappe.flags.in_uninstall = False
|
||||
|
||||
def post_install(rebuild_website=False):
|
||||
if rebuild_website:
|
||||
render.clear_cache()
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ def delete_doc(doctype=None, name=None, force=0, ignore_doctypes=None, for_reloa
|
|||
|
||||
delete_from_table(doctype, name, ignore_doctypes, None)
|
||||
|
||||
if not (for_reload or frappe.flags.in_migrate or frappe.flags.in_install or frappe.flags.in_test):
|
||||
if not (for_reload or frappe.flags.in_migrate or frappe.flags.in_install or frappe.flags.in_uninstall or frappe.flags.in_test):
|
||||
try:
|
||||
delete_controllers(name, doc.module)
|
||||
except (FileNotFoundError, OSError, KeyError):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue