From 91e4c144705e1c2417e77100ac9678120c20dc97 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 1 May 2013 12:00:44 +0530 Subject: [PATCH] [fixes] [__islocal] use doc.fields.get('__islocal') instead of doc.__islocal --- accounts/doctype/cost_center/cost_center.py | 2 +- stock/doctype/item/item.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py index e57b6a3758..a7672452aa 100644 --- a/accounts/doctype/cost_center/cost_center.py +++ b/accounts/doctype/cost_center/cost_center.py @@ -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() diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py index fce6f32543..6b6dfb3700 100644 --- a/stock/doctype/item/item.py +++ b/stock/doctype/item/item.py @@ -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]) \