[minor] Added batch item in the demo data

This commit is contained in:
Rohit Waghchaure
2017-09-28 11:51:03 +05:30
parent 946e182564
commit c4ee77a3cc
3 changed files with 32 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ def setup(domain):
setup_user()
setup_employee()
setup_user_roles()
setup_role_permissions()
employees = frappe.get_all('Employee', fields=['name', 'date_of_joining'])
@@ -91,7 +92,8 @@ def setup_fiscal_year():
pass
# set the last fiscal year (current year) as default
fiscal_year.set_as_default()
if fiscal_year:
fiscal_year.set_as_default()
def setup_holiday_list():
"""Setup Holiday List for the current year"""
@@ -374,6 +376,22 @@ def setup_pos_profile():
pos.insert()
def setup_role_permissions():
role_permissions = {'Batch': ['Accounts User', 'Item Manager']}
for doctype, roles in role_permissions.items():
for role in roles:
if not frappe.db.get_value('Custom DocPerm',
{'parent': doctype, 'role': role}):
frappe.get_doc({
'doctype': 'Custom DocPerm',
'role': role,
'read': 1,
'write': 1,
'create': 1,
'delete': 1,
'parent': doctype
}).insert(ignore_permissions=True)
def import_json(doctype, submit=False, values=None):
frappe.flags.in_import = True
data = json.loads(open(frappe.get_app_path('erpnext', 'demo', 'data',