Merge branch 'develop' into custom-rating
This commit is contained in:
commit
b54aa00a9f
7 changed files with 17 additions and 13 deletions
|
|
@ -1203,7 +1203,7 @@ def read_file(path, raise_not_found=False):
|
|||
def get_attr(method_string):
|
||||
"""Get python method object from its name."""
|
||||
app_name = method_string.split(".")[0]
|
||||
if not local.flags.in_install and app_name not in get_installed_apps():
|
||||
if not local.flags.in_uninstall and not local.flags.in_install and app_name not in get_installed_apps():
|
||||
throw(_("App {0} is not installed").format(app_name), AppNotInstalledError)
|
||||
|
||||
modulename = '.'.join(method_string.split('.')[:-1])
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False)
|
|||
import click
|
||||
|
||||
site = frappe.local.site
|
||||
app_hooks = frappe.get_hooks(app_name=app_name)
|
||||
|
||||
# dont allow uninstall app if not installed unless forced
|
||||
if not force:
|
||||
|
|
@ -233,6 +234,9 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False)
|
|||
|
||||
frappe.flags.in_uninstall = True
|
||||
|
||||
for before_uninstall in app_hooks.before_uninstall or []:
|
||||
frappe.get_attr(before_uninstall)()
|
||||
|
||||
modules = frappe.get_all("Module Def", filters={"app_name": app_name}, pluck="name")
|
||||
|
||||
drop_doctypes = _delete_modules(modules, dry_run=dry_run)
|
||||
|
|
@ -243,6 +247,9 @@ def remove_app(app_name, dry_run=False, yes=False, no_backup=False, force=False)
|
|||
frappe.get_single('Installed Applications').update_versions()
|
||||
frappe.db.commit()
|
||||
|
||||
for after_uninstall in app_hooks.after_uninstall or []:
|
||||
frappe.get_attr(after_uninstall)()
|
||||
|
||||
click.secho(f"Uninstalled App {app_name} from Site {site}", fg="green")
|
||||
frappe.flags.in_uninstall = False
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@ def execute():
|
|||
name, script = server_script["name"], server_script["script"]
|
||||
|
||||
for agg in ["avg", "max", "min", "sum"]:
|
||||
script = re.sub(f"frappe.db.{agg}(", f"frappe.qb.{agg}(", script)
|
||||
script = re.sub(f"frappe.db.{agg}\(", f"frappe.qb.{agg}(", script)
|
||||
|
||||
frappe.db.update("Server Script", name, "script", script)
|
||||
|
|
|
|||
|
|
@ -1972,12 +1972,6 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
|
|||
if (!doctype) return;
|
||||
frappe.provide("frappe.views.trees");
|
||||
|
||||
// refresh tree view
|
||||
if (frappe.views.trees[doctype]) {
|
||||
frappe.views.trees[doctype].tree.refresh();
|
||||
return;
|
||||
}
|
||||
|
||||
// refresh list view
|
||||
const page_name = frappe.get_route_str();
|
||||
const list_view = frappe.views.list_view[page_name];
|
||||
|
|
|
|||
|
|
@ -299,7 +299,6 @@ frappe.ui.Tree = class {
|
|||
.appendTo($toolbar);
|
||||
$link.on('click', () => {
|
||||
obj.click(node);
|
||||
this.refresh();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -242,6 +242,7 @@ frappe.views.TreeView = class TreeView {
|
|||
frappe.model.rename_doc(me.doctype, node.label, function(new_name) {
|
||||
node.$tree_link.find('a').text(new_name);
|
||||
node.label = new_name;
|
||||
me.tree.refresh();
|
||||
});
|
||||
},
|
||||
btnClass: "hidden-xs"
|
||||
|
|
@ -317,10 +318,7 @@ frappe.views.TreeView = class TreeView {
|
|||
args: args,
|
||||
callback: function(r) {
|
||||
if(!r.exc) {
|
||||
if(node.expanded) {
|
||||
me.tree.toggle_node(node);
|
||||
}
|
||||
me.tree.load_children(node, true);
|
||||
me.tree.load_children(node);
|
||||
}
|
||||
},
|
||||
always: function() {
|
||||
|
|
|
|||
|
|
@ -203,6 +203,12 @@ app_license = "{app_license}"
|
|||
# before_install = "{app_name}.install.before_install"
|
||||
# after_install = "{app_name}.install.after_install"
|
||||
|
||||
# Uninstallation
|
||||
# ------------
|
||||
|
||||
# before_uninstall = "{app_name}.uninstall.before_uninstall"
|
||||
# after_uninstall = "{app_name}.uninstall.after_uninstall"
|
||||
|
||||
# Desk Notifications
|
||||
# ------------------
|
||||
# See frappe.core.notifications.get_notification_config
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue