[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

@ -278,5 +278,16 @@
"item_code": "Autocad",
"item_name": "Autocad",
"item_group": "All Item Groups"
},
{
"is_stock_item": 1,
"has_batch_no": 1,
"create_new_batch": 1,
"valuation_rate": 200,
"default_warehouse": "Stores",
"description": "Corrugated Box",
"item_code": "Corrugated Box",
"item_name": "Corrugated Box",
"item_group": "All Item Groups"
}
]

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',

View File

@ -7,6 +7,7 @@ import frappe, random
from frappe.desk import query_report
from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.serial_no.serial_no import SerialNoRequiredError, SerialNoQtyError
from erpnext.stock.doctype.batch.batch import UnableToSelectBatchError
from erpnext.stock.doctype.delivery_note.delivery_note import make_sales_return
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_return
@ -59,7 +60,7 @@ def make_delivery_note():
try:
dn.submit()
frappe.db.commit()
except (NegativeStockError, SerialNoRequiredError, SerialNoQtyError):
except (NegativeStockError, SerialNoRequiredError, SerialNoQtyError, UnableToSelectBatchError):
frappe.db.rollback()
def make_stock_reconciliation():