validate criteria name
This commit is contained in:
parent
d4dcd2dfd7
commit
923a1e5447
3 changed files with 21 additions and 5 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
*.pyc
|
||||
*.comp.js
|
||||
*.DS_Store
|
||||
|
|
@ -26,6 +26,9 @@ class DocType:
|
|||
doctype_module = sql("select module from tabDocType where name = '%s'" % (self.doc.doc_type))
|
||||
webnotes.conn.set(self.doc,'module',doctype_module and doctype_module[0][0] or 'NULL')
|
||||
|
||||
def validate(self):
|
||||
sql("select name from `tabSearch Criteria` where criteria_name=%s and name!=%s", (self.doc.criteria_name, self.doc.name))
|
||||
|
||||
def on_update(self):
|
||||
self.set_module()
|
||||
self.export_doc()
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ class Installer:
|
|||
|
||||
import_module('core')
|
||||
|
||||
def create_users(self):
|
||||
"""
|
||||
Create Administrator / Guest
|
||||
"""
|
||||
webnotes.conn.begin()
|
||||
|
||||
from webnotes.model.doc import Document
|
||||
|
|
@ -96,10 +100,6 @@ class Installer:
|
|||
a very simplified version, just for the time being..will eventually be deprecated once the framework stabilizes.
|
||||
"""
|
||||
|
||||
# get the path of the sql file to import
|
||||
if not source_path:
|
||||
source_path = os.path.join(os.path.sep.join(os.path.abspath(webnotes.__file__).split(os.path.sep)[:-3]), 'data', 'Framework.sql')
|
||||
|
||||
# delete user (if exists)
|
||||
self.dbman.delete_user(target)
|
||||
|
||||
|
|
@ -122,10 +122,20 @@ class Installer:
|
|||
|
||||
# import in target
|
||||
if verbose: print "Starting database import..."
|
||||
|
||||
# get the path of the sql file to import
|
||||
source_given = True
|
||||
if not source_path:
|
||||
source_given = False
|
||||
source_path = os.path.join(os.path.sep.join(os.path.abspath(webnotes.__file__).split(os.path.sep)[:-3]), 'data', 'Framework.sql')
|
||||
|
||||
self.dbman.restore_database(target, source_path, self.root_password)
|
||||
if verbose: print "Imported from database %s" % source_path
|
||||
|
||||
self.import_core_module()
|
||||
if not source_given:
|
||||
if verbose: print "Importing core module..."
|
||||
self.import_core_module()
|
||||
self.create_users()
|
||||
|
||||
# framework cleanups
|
||||
self.framework_cleanups(target)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue