aii: patches and default values fetching

This commit is contained in:
Nabin Hait
2013-03-25 18:28:16 +05:30
parent 57916252d9
commit 557d858d89
13 changed files with 166 additions and 95 deletions

View File

@@ -249,15 +249,17 @@ class DocType:
def on_update(self):
self.set_letter_head()
ac = sql("select name from tabAccount where company=%s and docstatus<2 limit 1",
self.doc.name)
if not ac:
if not webnotes.conn.sql("""select name from tabAccount
where company=%s and docstatus<2 limit 1""", self.doc.name):
self.create_default_accounts()
self.set_default_accounts()
cc = sql("select name from `tabCost Center` where cost_center_name = 'Root' and company_name = '%s'"%(self.doc.name))
if not cc:
if not webnotes.conn.sql("""select name from `tabCost Center`
where cost_center_name = 'Root' and company_name = %s""", self.doc.name):
self.create_default_cost_center()
self.set_default_accounts()
if self.doc.default_currency:
webnotes.conn.set_value("Currency", self.doc.default_currency, "enabled", 1)

View File

@@ -1,4 +1,4 @@
test_ignore = ["Account"]
test_ignore = ["Account", "Cost Center"]
test_records = [
[{