[merge master

]
This commit is contained in:
Rushabh Mehta
2013-04-18 10:37:16 +05:30
38 changed files with 616 additions and 373 deletions

View File

@@ -153,7 +153,7 @@ class DocType:
for d in acc_list_common:
self.add_acc(d)
country = sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
country = webnotes.conn.sql("select value from tabSingles where field = 'country' and doctype = 'Control Panel'")
country = country and cstr(country[0][0]) or ''
# load taxes (only for India)
@@ -245,6 +245,9 @@ class DocType:
for cc in cc_list:
add_cc(cc)
webnotes.conn.set_value("Company", self.doc.name, "cost_center",
"Default CC Ledger - " + self.doc.abbr)
def on_update(self):
self.set_letter_head()
@@ -265,26 +268,31 @@ class DocType:
"""
Trash accounts and cost centers for this company if no gl entry exists
"""
rec = sql("SELECT name from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' and company = %s", self.doc.name)
rec = webnotes.conn.sql("SELECT name from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'No' and company = %s", self.doc.name)
if not rec:
# delete gl entry
sql("delete from `tabGL Entry` where company = %s", self.doc.name)
webnotes.conn.sql("delete from `tabGL Entry` where company = %s", self.doc.name)
#delete tabAccount
sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
webnotes.conn.sql("delete from `tabAccount` where company = %s order by lft desc, rgt desc", self.doc.name)
#delete cost center child table - budget detail
sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company_name = %s", self.doc.name)
webnotes.conn.sql("delete bd.* from `tabBudget Detail` bd, `tabCost Center` cc where bd.parent = cc.name and cc.company_name = %s", self.doc.name)
#delete cost center
sql("delete from `tabCost Center` WHERE company_name = %s order by lft desc, rgt desc", self.doc.name)
webnotes.conn.sql("delete from `tabCost Center` WHERE company_name = %s order by lft desc, rgt desc", self.doc.name)
webnotes.defaults.clear_default("company", value=self.doc.name)
webnotes.defaults.clear_default("company", value=self.doc.name)
webnotes.conn.sql("""update `tabSingles` set value=""
where doctype='Global Defaults' and field='default_company'
and value=%s""", self.doc.name)
#update value as blank for tabSingles Global Defaults
sql("update `tabSingles` set value = '' where doctype='Global Defaults' and field = 'default_company' and value = %s", self.doc.name)
def on_rename(self,newdn,olddn):
sql("update `tabCompany` set company_name = '%s' where name = '%s'" %(newdn,olddn))
sql("update `tabSingles` set value = %s where doctype='Global Defaults' and field = 'default_company' and value = %s", (newdn, olddn))
if webnotes.defaults.get_global_default('company') == olddn:
webnotes.defaults.set_global_default('company', newdn)
webnotes.conn.sql("""update `tabCompany` set company_name=%s
where name=%s""", (newdn, olddn))
webnotes.conn.sql("""update `tabSingles` set value=%s
where doctype='Global Defaults' and field='default_company'
and value=%s""", (newdn, olddn))
webnotes.defaults.clear_default("company", value=olddn)

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-26 11:03:08",
"creation": "2013-04-10 08:35:39",
"docstatus": 0,
"modified": "2013-03-28 16:04:27",
"modified": "2013-04-17 14:07:46",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -141,6 +141,15 @@
"options": "Account",
"read_only": 0
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"no_copy": 1,
"options": "Cost Center"
},
{
"doctype": "DocField",
"fieldname": "column_break0",

View File

@@ -94,8 +94,7 @@ class DocType(DocListController):
msg_for_this_receipient = self.get_msg_html(self.get_user_specific_content(user_id) + \
common_msg)
from webnotes.utils.email_lib import sendmail
sendmail(recipients=user_id, subject=(self.doc.frequency + " Digest"),
sender="ERPNext Notifications <notifications+email_digest@erpnext.com>",
sendmail(recipients=user_id, subject="[ERPNext] " + (self.doc.frequency + " Digest"),
msg=msg_for_this_receipient)
def get_digest_msg(self):