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

Conflicts:
	accounts/doctype/gl_control/gl_control.py
This commit is contained in:
Anand Doshi
2013-01-17 20:31:41 +05:30
92 changed files with 1234 additions and 1924 deletions

View File

@@ -162,7 +162,6 @@ class DocType:
ac = Document('Account')
for d in self.fld_dict.keys():
ac.fields[d] = (d == 'parent_account' and lst[self.fld_dict[d]]) and lst[self.fld_dict[d]] +' - '+ self.doc.abbr or lst[self.fld_dict[d]]
ac.old_parent = ''
ac_obj = get_obj(doc=ac)
ac_obj.doc.freeze_account='No'
ac_obj.doc.master_type = ''
@@ -199,7 +198,7 @@ class DocType:
# ---------------------------------------------------
def create_default_cost_center(self):
glc = get_obj('GL Control')
cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':'','old_parent':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr,'old_parent':''}]
cc_list = [{'cost_center_name':'Root','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Group','parent_cost_center':''}, {'cost_center_name':'Default CC Ledger','company_name':self.doc.name,'company_abbr':self.doc.abbr,'group_or_ledger':'Ledger','parent_cost_center':'Root - ' + self.doc.abbr}]
for c in cc_list:
glc.add_cc(str(c))

View File

@@ -2,35 +2,24 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-03-27 14:36:19",
"creation": "2013-01-17 17:02:24",
"modified_by": "Administrator",
"modified": "2012-03-27 14:36:19"
"modified": "2013-01-17 17:04:08"
},
{
"section_style": "Simple",
"in_create": 0,
"module": "Setup",
"server_code_error": " ",
"document_type": "Master",
"read_only": 0,
"autoname": "field:country_name",
"name": "__common__",
"colour": "White:FFF",
"in_create": 0,
"doctype": "DocType",
"show_in_menu": 0,
"version": 11
"module": "Setup",
"document_type": "Master",
"name": "__common__"
},
{
"parent": "Country",
"oldfieldtype": "Data",
"oldfieldname": "country_name",
"reqd": 1,
"name": "__common__",
"parent": "Country",
"doctype": "DocField",
"label": "Country Name",
"parenttype": "DocType",
"fieldname": "country_name",
"fieldtype": "Data",
"permlevel": 0,
"parentfield": "fields"
},
@@ -49,12 +38,33 @@
"name": "Country",
"doctype": "DocType"
},
{
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Country Name",
"oldfieldname": "country_name",
"fieldname": "country_name",
"fieldtype": "Data",
"reqd": 1
},
{
"doctype": "DocField",
"label": "Date Format",
"fieldname": "date_format",
"fieldtype": "Data"
},
{
"doctype": "DocField",
"label": "Time Zones",
"fieldname": "time_zones",
"fieldtype": "Text"
},
{
"amend": 0,
"cancel": 0,
"role": "Sales Master Manager",
"doctype": "DocPerm",
"submit": 0
"submit": 0,
"role": "Sales Master Manager",
"cancel": 0
},
{
"role": "Purchase Master Manager",
@@ -67,8 +77,5 @@
{
"role": "HR Manager",
"doctype": "DocPerm"
},
{
"doctype": "DocField"
}
]

View File

@@ -2,36 +2,24 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-07-03 13:30:55",
"creation": "2013-01-17 12:30:28",
"modified_by": "Administrator",
"modified": "2012-07-11 16:11:45"
"modified": "2013-01-17 16:24:59"
},
{
"section_style": "Simple",
"description": "**Currency** Master",
"module": "Setup",
"allow_trash": 1,
"server_code_error": " ",
"in_create": 0,
"read_only": 0,
"autoname": "field:currency_name",
"name": "__common__",
"colour": "White:FFF",
"in_create": 0,
"description": "**Currency** Master",
"doctype": "DocType",
"show_in_menu": 0,
"version": 1
"module": "Setup",
"name": "__common__"
},
{
"parent": "Currency",
"oldfieldtype": "Data",
"oldfieldname": "currency_name",
"reqd": 1,
"name": "__common__",
"parent": "Currency",
"doctype": "DocField",
"label": "Currency Name",
"parenttype": "DocType",
"fieldname": "currency_name",
"fieldtype": "Data",
"permlevel": 0,
"parentfield": "fields"
},
@@ -39,9 +27,7 @@
"name": "__common__",
"parent": "Currency",
"read": 1,
"create": 1,
"doctype": "DocPerm",
"write": 1,
"parenttype": "DocType",
"permlevel": 0,
"parentfield": "permissions"
@@ -51,25 +37,44 @@
"doctype": "DocType"
},
{
"cancel": 1,
"role": "Accounts Manager",
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Currency Name",
"oldfieldname": "currency_name",
"fieldname": "currency_name",
"fieldtype": "Data",
"reqd": 1
},
{
"doctype": "DocField",
"label": "Fraction",
"fieldname": "fraction",
"fieldtype": "Data"
},
{
"doctype": "DocField",
"label": "Fraction Units",
"fieldname": "fraction_units",
"fieldtype": "Int"
},
{
"doctype": "DocField",
"label": "Symbol",
"fieldname": "symbol",
"fieldtype": "Data"
},
{
"amend": 0,
"create": 1,
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"report": 1,
"role": "System Manager",
"cancel": 1
},
{
"role": "All",
"doctype": "DocPerm"
},
{
"amend": 0,
"cancel": 1,
"role": "Sales Master Manager",
"doctype": "DocPerm",
"submit": 0
},
{
"amend": 0,
"cancel": 0,
"role": "Purchase Master Manager",
"doctype": "DocPerm",
"submit": 0
},
{
"doctype": "DocField"
}
]

View File

@@ -50,33 +50,37 @@ class DocType:
master_dict = {'Fiscal Year':{
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
'company': args.get('company_name')}}
}}
self.create_records(master_dict)
# Company
master_dict = {'Company':{'company_name':args.get('company_name'),
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency')
}}
master_dict = {'Company': {
'company_name':args.get('company_name'),
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency')
}}
self.create_records(master_dict)
def_args = {'current_fiscal_year':curr_fiscal_year,
'default_currency': args.get('currency'),
'default_company':args.get('company_name'),
'default_valuation_method':'FIFO',
'default_stock_uom':'Nos',
'date_format':'dd-mm-yyyy',
'default_currency_format':'Lacs',
'so_required':'No',
'dn_required':'No',
'po_required':'No',
'pr_required':'No',
'emp_created_by':'Naming Series',
'cust_master_name':'Customer Name',
'supp_master_name':'Supplier Name',
'default_currency_format': \
(args.get('currency')=='INR') and 'Lacs' or 'Millions'
}
def_args = {
'current_fiscal_year':curr_fiscal_year,
'default_currency': args.get('currency'),
"default_fraction_currency": webnotes.conn.get_value("Currency",
args.get("currency"), "fraction"),
'default_company':args.get('company_name'),
'default_valuation_method':'FIFO',
'default_stock_uom':'Nos',
'date_format': webnotes.conn.get_value("Country",
args.get("country"), "date_format"),
'so_required':'No',
'dn_required':'No',
'po_required':'No',
'pr_required':'No',
'emp_created_by':'Naming Series',
'cust_master_name':'Customer Name',
'supp_master_name':'Supplier Name',
'default_currency_format': \
(args.get('currency')=='INR') and 'Lacs' or 'Millions'
}
# Set
self.set_defaults(def_args)
@@ -185,8 +189,6 @@ class DocType:
return fy, stdt, abbr
# Create Company and Fiscal Year
# -------------------------------
def create_records(self, master_dict):
for d in master_dict.keys():
rec = Document(d)
@@ -234,18 +236,12 @@ class DocType:
on duplicate key update `password`=password(%s)""",
(user_email, pwd, pwd))
self.add_roles(pr)
def add_roles(self, pr):
roles_list = ['Accounts Manager', 'Accounts User', 'Blogger', 'HR Manager', 'HR User', 'Maintenance User', 'Maintenance Manager', 'Material Manager', 'Material User', 'Material Master Manager', 'Manufacturing Manager', 'Manufacturing User', 'Projects User', 'Purchase Manager', 'Purchase User', 'Purchase Master Manager', 'Quality Manager', 'Sales Manager', 'Sales User', 'Sales Master Manager', 'Support Manager', 'Support Team', 'System Manager', 'Website Manager']
for r in roles_list:
d = addchild(pr, 'userroles', 'UserRole')
d.role = r
d.save(1)
# Add roles to Administrator profile
pr = Document('Profile','Administrator')
for r in roles_list:
d = addchild(pr,'userroles', 'UserRole')
d.role = r
d.save(1)
self.add_all_roles_to(pr.name)
def add_all_roles_to(name):
profile = webnotes.doc("Profile", name)
for role in webnotes.conn.sql("""select name from tabRole"""):
if role[0] not in ["Administrator", "Guest", "All", "Customer", "Supplier", "Partner"]:
d = profile.addchild("userroles", "UserRole")
d.role = role[0]
d.insert()