[nested set] [minor] Added validation to test loop in hierarchy
This commit is contained in:
parent
d056e1b453
commit
a1d668a6e3
@ -24,6 +24,7 @@ class DocType(DocTypeNestedSet):
|
||||
def on_update(self):
|
||||
self.validate_name_with_customer()
|
||||
super(DocType, self).on_update()
|
||||
self.validate_one_root()
|
||||
|
||||
def validate_name_with_customer(self):
|
||||
if webnotes.conn.exists("Customer", self.doc.name):
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:23",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:34:20",
|
||||
"modified": "2013-08-05 18:12:57",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -69,7 +69,7 @@
|
||||
"oldfieldname": "parent_customer_group",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Customer Group",
|
||||
"reqd": 1
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"description": "Only leaf nodes are allowed in transaction",
|
||||
|
@ -20,7 +20,6 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
from website.helpers.product import invalidate_cache_for
|
||||
|
||||
|
||||
if self.doc.show_in_website:
|
||||
from webnotes.webutils import update_page_name
|
||||
# webpage updates
|
||||
@ -38,6 +37,8 @@ class DocType(DocTypeNestedSet):
|
||||
|
||||
webnotes.conn.set(self.doc, "page_name", None)
|
||||
|
||||
self.validate_one_root()
|
||||
|
||||
def validate_name_with_item(self):
|
||||
if webnotes.conn.exists("Item", self.doc.name):
|
||||
webnotes.msgprint("An item exists with same name (%s), please change the \
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-28 10:35:29",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-23 12:00:14",
|
||||
"modified": "2013-08-05 17:21:14",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -75,7 +75,7 @@
|
||||
"oldfieldname": "parent_item_group",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item Group",
|
||||
"reqd": 1,
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
|
@ -21,6 +21,10 @@ class DocType(DocTypeNestedSet):
|
||||
webnotes.msgprint("Either target qty or target amount is mandatory.")
|
||||
raise Exception
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
self.validate_one_root()
|
||||
|
||||
def get_email_id(self):
|
||||
profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id")
|
||||
if not profile:
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:24",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-10 12:51:58",
|
||||
"modified": "2013-08-05 18:11:22",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -69,7 +69,7 @@
|
||||
"oldfieldname": "parent_sales_person",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Sales Person",
|
||||
"reqd": 1
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
|
@ -21,3 +21,6 @@ class DocType(DocTypeNestedSet):
|
||||
msgprint("Either target qty or target amount is mandatory.")
|
||||
raise Exception
|
||||
|
||||
def on_update(self):
|
||||
super(DocType, self).on_update()
|
||||
self.validate_one_root()
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:24",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:58:15",
|
||||
"modified": "2013-08-05 18:12:29",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -71,7 +71,7 @@
|
||||
"oldfieldname": "parent_territory",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Territory",
|
||||
"reqd": 1
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"description": "Only leaf nodes are allowed in transaction",
|
||||
|
Loading…
x
Reference in New Issue
Block a user