[Fix]Root element from tree cannot be deleted.

This commit is contained in:
Akhilesh Darjee 2013-07-04 19:17:55 +05:30
parent e02de9e2c5
commit d850786cf7

View file

@ -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)