We are using export fixtures to move our modifications of client script to our app on multisite
but we realiZe this when we remove a client script that client script does not delted from sites
is this a known bug or do we miss something?
as far as I know, uninstall-app will not auto remove the docs created via fixtures, my temp fix is to run the following python code in bench console
import os
def get_custom_fields(app = "your-app"):
from frappe.modules.import_file import read_doc_from_file
if not app in frappe.get_installed_apps():
path = frappe.get_app_path(app, "fixtures")
files = [os.path.join(path, f) for f in os.listdir(path)]
docs = []
for f in files:
if os.path.exists(f):
fields = read_doc_from_file(f)
docs.extend(fields)
return docs
else:
print("please uninstall app before run this code")
custom_fields = get_custom_fields()
for idx, field in enumerate(custom_fields or []):
doctype, name = field.get('doctype'), field.get('name')
frappe.delete_doc(doctype, name)
print(f'{idx+1} deleted {doctype} {name}')
frappe.db.commit()
3 Likes
You have to write a patch to delete client script from db
1 Like
actually my problem is with client script and also uninstall app drop all the tables created by my doctype
does I miss something?
I think this is a greate answer I will let the team try this and give you a feedback