Explorar el Código

Merge pull request #4779 from Zlash65/fix-root-node-delete

[Fix] Allow deletion of root node with no parent
version-14
Prateeksha Singh hace 7 años
committed by GitHub
padre
commit
d3c65983f7
No se encontró ninguna clave conocida en la base de datos para esta firma ID de clave GPG: 4AEE18F83AFDEB23
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. +2
    -2
      frappe/utils/nestedset.py

+ 2
- 2
frappe/utils/nestedset.py Ver fichero

@@ -185,12 +185,12 @@ class NestedSet(Document):
update_nsm(self)
self.validate_ledger()

def on_trash(self):
def on_trash(self, allow_root_deletion=False):
if not getattr(self, 'nsm_parent_field', None):
self.nsm_parent_field = frappe.scrub(self.doctype) + "_parent"

parent = self.get(self.nsm_parent_field)
if not parent:
if not parent and not allow_root_deletion:
frappe.throw(_("Root {0} cannot be deleted").format(_(self.doctype)))

# cannot delete non-empty group


Cargando…
Cancelar
Guardar