fix: use correct parent field in rebuild_tree() (#24107)
* fix: use correct parent field in rebuild tree * refactor!: ignore parent_field parameter to rebuild_tree
This commit is contained in:
parent
92c4d291c9
commit
dd690c79d1
2 changed files with 6 additions and 4 deletions
|
|
@ -235,7 +235,6 @@ frappe.views.TreeView = class TreeView {
|
|||
method: "frappe.utils.nestedset.rebuild_tree",
|
||||
args: {
|
||||
doctype: me.doctype,
|
||||
parent_field: "parent_" + me.doctype.toLowerCase().replace(/ /g, "_"),
|
||||
},
|
||||
callback: function (r) {
|
||||
if (!r.exc) {
|
||||
|
|
|
|||
|
|
@ -168,9 +168,10 @@ def update_move_node(doc: Document, parent_field: str):
|
|||
|
||||
|
||||
@frappe.whitelist()
|
||||
def rebuild_tree(doctype, parent_field):
|
||||
"""
|
||||
call rebuild_node for all root nodes
|
||||
def rebuild_tree(doctype, parent_field=None):
|
||||
"""Call rebuild_node for all root nodes.
|
||||
|
||||
The `parent_field` parameter is ignored and will be removed in v16+ (kept for backward compatibility).
|
||||
"""
|
||||
|
||||
# Check for perm if called from client-side
|
||||
|
|
@ -184,6 +185,8 @@ def rebuild_tree(doctype, parent_field):
|
|||
title=_("Invalid Action"),
|
||||
)
|
||||
|
||||
parent_field = meta.nsm_parent_field or f"parent_{frappe.scrub(doctype)}"
|
||||
|
||||
# get all roots
|
||||
right = 1
|
||||
table = DocType(doctype)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue