[bean] [mandatory] fixes in test cases

This commit is contained in:
Anand Doshi
2013-07-08 18:50:45 +05:30
parent 2862c9e1df
commit 4ee647e84c
20 changed files with 75 additions and 33 deletions

View File

@@ -169,7 +169,14 @@ def import_defaults():
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
]
from webnotes.modules import scrub
for r in records:
if not webnotes.conn.exists(r['doctype'], r['name']):
bean = webnotes.bean(r)
# ignore mandatory for root
parent_link_field = ("parent_" + scrub(bean.doc.doctype))
if parent_link_field in bean.doc.fields and not bean.doc.fields.get(parent_link_field):
bean.ignore_mandatory = True
bean.insert()