[Fix]Root element from tree cannot be deleted.
This commit is contained in:
parent
e02de9e2c5
commit
d850786cf7
1 changed files with 6 additions and 2 deletions
|
|
@ -32,7 +32,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import webnotes, unittest
|
||||
from webnotes import msgprint
|
||||
from webnotes import msgprint, _
|
||||
from webnotes.model.bean import Bean
|
||||
from webnotes.model.doc import Document
|
||||
|
||||
|
|
@ -325,5 +325,9 @@ class DocTypeNestedSet(object):
|
|||
update_nsm(self)
|
||||
|
||||
def on_trash(self):
|
||||
self.doc.fields[self.nsm_parent_field] = ""
|
||||
parent = self.doc.fields[self.nsm_parent_field]
|
||||
if not parent:
|
||||
msgprint(_("Root ") + self.doc.doctype + _(" cannot be deleted."), raise_exception=1)
|
||||
|
||||
parent = ""
|
||||
update_nsm(self)
|
||||
Loading…
Add table
Reference in a new issue