Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Nabin Hait
2012-09-19 16:06:21 +05:30
6 changed files with 13 additions and 12 deletions

View File

@@ -83,7 +83,7 @@ class DocType:
# Account name must be unique
def validate_duplicate_account(self):
if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
if (self.doc.fields.get('__islocal') or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
msgprint("Account Name already exists, please rename", raise_exception=1)
# validate root details

View File

@@ -39,7 +39,7 @@ class DocType:
self.doc, self.doclist = d,dl
def validate(self):
if self.doc.__islocal and len(self.doc.abbr) > 5:
if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5:
webnotes.msgprint("Abbreviation cannot have more than 5 characters",
raise_exception=1)

View File

@@ -136,6 +136,7 @@ class DocType(TransactionBase):
def check_if_last_visit(self):
"""check if last maintenance visit against same sales order/ customer issue"""
check_for_docname = check_for_doctype = None
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_docname:
check_for_docname = d.prevdoc_docname