Merge branch 'master' of github.com:webnotes/erpnext into responsive
This commit is contained in:
commit
3daf45fcd8
@ -125,7 +125,6 @@ def add_ac(args=None):
|
|||||||
ac.doc.doctype = "Account"
|
ac.doc.doctype = "Account"
|
||||||
ac.doc.old_parent = ""
|
ac.doc.old_parent = ""
|
||||||
ac.doc.freeze_account = "No"
|
ac.doc.freeze_account = "No"
|
||||||
ac.ignore_permissions = 1
|
|
||||||
ac.insert()
|
ac.insert()
|
||||||
return ac.doc.name
|
return ac.doc.name
|
||||||
|
|
||||||
@ -138,7 +137,6 @@ def add_cc(args=None):
|
|||||||
cc = webnotes.bean(args)
|
cc = webnotes.bean(args)
|
||||||
cc.doc.doctype = "Cost Center"
|
cc.doc.doctype = "Cost Center"
|
||||||
cc.doc.old_parent = ""
|
cc.doc.old_parent = ""
|
||||||
cc.ignore_permissions = 1
|
|
||||||
cc.insert()
|
cc.insert()
|
||||||
return cc.doc.name
|
return cc.doc.name
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ from webnotes.model.doc import make_autoname
|
|||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
from accounts.utils import add_ac
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class DocType(TransactionBase):
|
class DocType(TransactionBase):
|
||||||
@ -68,14 +67,16 @@ class DocType(TransactionBase):
|
|||||||
return g
|
return g
|
||||||
|
|
||||||
def add_account(self, ac, par, abbr):
|
def add_account(self, ac, par, abbr):
|
||||||
ac = add_ac({
|
ac_bean = webnotes.bean({
|
||||||
|
"doctype": "Account",
|
||||||
'account_name':ac,
|
'account_name':ac,
|
||||||
'parent_account':par,
|
'parent_account':par,
|
||||||
'group_or_ledger':'Group',
|
'group_or_ledger':'Group',
|
||||||
'company':self.doc.company,
|
'company':self.doc.company,
|
||||||
'account_type':'',
|
"freeze_account": "No",
|
||||||
'tax_rate':'0'
|
|
||||||
})
|
})
|
||||||
|
ac_bean.ignore_permissions = True
|
||||||
|
ac_bean.insert()
|
||||||
|
|
||||||
msgprint(_("Created Group ") + ac)
|
msgprint(_("Created Group ") + ac)
|
||||||
|
|
||||||
@ -106,8 +107,8 @@ class DocType(TransactionBase):
|
|||||||
parent_account = self.get_parent_account(abbr)
|
parent_account = self.get_parent_account(abbr)
|
||||||
|
|
||||||
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
||||||
|
ac_bean = webnotes.bean({
|
||||||
ac = add_ac({
|
"doctype": "Account",
|
||||||
'account_name': self.doc.name,
|
'account_name': self.doc.name,
|
||||||
'parent_account': parent_account,
|
'parent_account': parent_account,
|
||||||
'group_or_ledger':'Ledger',
|
'group_or_ledger':'Ledger',
|
||||||
@ -116,8 +117,12 @@ class DocType(TransactionBase):
|
|||||||
'tax_rate': '0',
|
'tax_rate': '0',
|
||||||
'master_type': 'Supplier',
|
'master_type': 'Supplier',
|
||||||
'master_name': self.doc.name,
|
'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:
|
else:
|
||||||
self.check_parent_account(parent_account, abbr)
|
self.check_parent_account(parent_account, abbr)
|
||||||
else :
|
else :
|
||||||
|
@ -115,18 +115,20 @@ class DocType(TransactionBase):
|
|||||||
if not webnotes.conn.exists("Account", (self.doc.name + " - " + abbr)):
|
if not webnotes.conn.exists("Account", (self.doc.name + " - " + abbr)):
|
||||||
parent_account = self.get_receivables_group()
|
parent_account = self.get_receivables_group()
|
||||||
# create
|
# create
|
||||||
from accounts.utils import add_ac
|
ac_bean = webnotes.bean({
|
||||||
ac = add_ac({
|
"doctype": "Account",
|
||||||
'account_name': self.doc.name,
|
'account_name': self.doc.name,
|
||||||
'parent_account': parent_account,
|
'parent_account': parent_account,
|
||||||
'group_or_ledger':'Ledger',
|
'group_or_ledger':'Ledger',
|
||||||
'company':self.doc.company,
|
'company':self.doc.company,
|
||||||
'account_type':'',
|
|
||||||
'tax_rate':'0',
|
|
||||||
'master_type':'Customer',
|
'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 :
|
else :
|
||||||
msgprint("Please Select Company under which you want to create account head")
|
msgprint("Please Select Company under which you want to create account head")
|
||||||
|
|
||||||
|
@ -222,7 +222,6 @@ class DocType:
|
|||||||
# Create default cost center
|
# Create default cost center
|
||||||
# ---------------------------------------------------
|
# ---------------------------------------------------
|
||||||
def create_default_cost_center(self):
|
def create_default_cost_center(self):
|
||||||
from accounts.utils import add_cc
|
|
||||||
cc_list = [
|
cc_list = [
|
||||||
{
|
{
|
||||||
'cost_center_name':'Root',
|
'cost_center_name':'Root',
|
||||||
@ -244,7 +243,10 @@ class DocType:
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
for cc in cc_list:
|
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",
|
webnotes.conn.set_value("Company", self.doc.name, "cost_center",
|
||||||
"Default CC Ledger - " + self.doc.abbr)
|
"Default CC Ledger - " + self.doc.abbr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user