From 69a3ee54f2262df71bbe59193363124cdb7e12cb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 25 Sep 2013 13:00:22 +0530 Subject: [PATCH] [fix] [minor] create default warehouse on saving of company if not exists --- setup/doctype/company/company.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index 1fd97bed9d..220c48051c 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -59,12 +59,13 @@ class DocType: def create_default_warehouses(self): for whname in ("Stores", "Work In Progress", "Finished Goods"): - webnotes.bean({ - "doctype":"Warehouse", - "warehouse_name": whname, - "company": self.doc.name, - "create_account_under": "Stock Assets - " + self.doc.abbr - }).insert() + if not webnotes.conn.exists("Warehouse", whname + " - " + self.doc.abbr): + webnotes.bean({ + "doctype":"Warehouse", + "warehouse_name": whname, + "company": self.doc.name, + "create_account_under": "Stock Assets - " + self.doc.abbr + }).insert() def create_default_web_page(self): if not webnotes.conn.get_value("Website Settings", None, "home_page"):