[fixes] [__islocal] use doc.fields.get('__islocal') instead of doc.__islocal

This commit is contained in:
Anand Doshi 2013-05-01 12:00:44 +05:30
parent fe9c1eb5df
commit 91e4c14470
2 changed files with 2 additions and 2 deletions

View File

@ -81,7 +81,7 @@ class DocType(DocTypeNestedSet):
"""
Cost Center name must be unique
"""
if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
self.validate_mandatory()

View File

@ -55,7 +55,7 @@ class DocType(DocListController):
ch.conversion_factor = 1
def check_stock_uom_with_bin(self):
if not self.doc.__islocal:
if not self.doc.fields.get("__islocal"):
bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
self.doc.name)
if self.doc.stock_uom and bin and cstr(bin[0][0]) \