Merge branch 'master' of github.com:webnotes/erpnext into responsive
diff --git a/accounts/utils.py b/accounts/utils.py
index 31e6221..eb240e7 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -125,7 +125,6 @@
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 @@
cc = webnotes.bean(args)
cc.doc.doctype = "Cost Center"
cc.doc.old_parent = ""
- cc.ignore_permissions = 1
cc.insert()
return cc.doc.name
diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py
index 0c3c2b0..a03ba33 100644
--- a/buying/doctype/supplier/supplier.py
+++ b/buying/doctype/supplier/supplier.py
@@ -24,7 +24,6 @@
sql = webnotes.conn.sql
-from accounts.utils import add_ac
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
@@ -68,14 +67,16 @@
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 @@
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 @@
'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 :
diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py
index 72e12b7..65ac865 100644
--- a/selling/doctype/customer/customer.py
+++ b/selling/doctype/customer/customer.py
@@ -115,18 +115,20 @@
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({
- 'account_name':self.doc.name,
+ 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")
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index 9863d7d..2564503 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -222,7 +222,6 @@
# 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 @@
}
]
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)