Merge branch 'master' of github.com:webnotes/erpnext into responsive

This commit is contained in:
Anand Doshi 2013-06-11 17:34:18 +05:30
commit 3daf45fcd8
4 changed files with 25 additions and 18 deletions

View File

@ -125,7 +125,6 @@ def add_ac(args=None):
ac.doc.doctype = "Account"
ac.doc.old_parent = ""
ac.doc.freeze_account = "No"
ac.ignore_permissions = 1
ac.insert()
return ac.doc.name
@ -138,7 +137,6 @@ def add_cc(args=None):
cc = webnotes.bean(args)
cc.doc.doctype = "Cost Center"
cc.doc.old_parent = ""
cc.ignore_permissions = 1
cc.insert()
return cc.doc.name

View File

@ -24,7 +24,6 @@ from webnotes.model.doc import make_autoname
sql = webnotes.conn.sql
from accounts.utils import add_ac
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
@ -68,14 +67,16 @@ class DocType(TransactionBase):
return g
def add_account(self, ac, par, abbr):
ac = add_ac({
ac_bean = webnotes.bean({
"doctype": "Account",
'account_name':ac,
'parent_account':par,
'group_or_ledger':'Group',
'company':self.doc.company,
'account_type':'',
'tax_rate':'0'
"freeze_account": "No",
})
ac_bean.ignore_permissions = True
ac_bean.insert()
msgprint(_("Created Group ") + ac)
@ -106,8 +107,8 @@ class DocType(TransactionBase):
parent_account = self.get_parent_account(abbr)
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
ac = add_ac({
ac_bean = webnotes.bean({
"doctype": "Account",
'account_name': self.doc.name,
'parent_account': parent_account,
'group_or_ledger':'Ledger',
@ -116,8 +117,12 @@ class DocType(TransactionBase):
'tax_rate': '0',
'master_type': 'Supplier',
'master_name': self.doc.name,
"freeze_account": "No"
})
msgprint(_("Created Account Head: ") + ac)
ac_bean.ignore_permissions = True
ac_bean.insert()
msgprint(_("Created Account Head: ") + ac_bean.doc.name)
else:
self.check_parent_account(parent_account, abbr)
else :

View File

@ -115,18 +115,20 @@ class DocType(TransactionBase):
if not webnotes.conn.exists("Account", (self.doc.name + " - " + abbr)):
parent_account = self.get_receivables_group()
# create
from accounts.utils import add_ac
ac = add_ac({
ac_bean = webnotes.bean({
"doctype": "Account",
'account_name': self.doc.name,
'parent_account': parent_account,
'group_or_ledger':'Ledger',
'company':self.doc.company,
'account_type':'',
'tax_rate':'0',
'master_type':'Customer',
'master_name':self.doc.name
'master_name':self.doc.name,
"freeze_account": "No"
})
msgprint("Account Head: %s created" % ac)
ac_bean.ignore_permissions = True
ac_bean.insert()
msgprint("Account Head: %s created" % ac_bean.doc.name)
else :
msgprint("Please Select Company under which you want to create account head")

View File

@ -222,7 +222,6 @@ class DocType:
# Create default cost center
# ---------------------------------------------------
def create_default_cost_center(self):
from accounts.utils import add_cc
cc_list = [
{
'cost_center_name':'Root',
@ -244,7 +243,10 @@ class DocType:
}
]
for cc in cc_list:
add_cc(cc)
cc.update({"doctype": "Cost Center"})
cc_bean = webnotes.bean(cc)
cc_bean.ignore_permissions = True
cc_bean.insert()
webnotes.conn.set_value("Company", self.doc.name, "cost_center",
"Default CC Ledger - " + self.doc.abbr)