Merge https://github.com/frappe/erpnext into item_group
diff --git a/erpnext/setup/doctype/item_group/item_group.json b/erpnext/setup/doctype/item_group/item_group.json
index 45176aa..af5a5c3 100644
--- a/erpnext/setup/doctype/item_group/item_group.json
+++ b/erpnext/setup/doctype/item_group/item_group.json
@@ -21,9 +21,10 @@
"search_index": 0
},
{
- "fieldname": "cb0",
- "fieldtype": "Column Break",
+ "fieldname": "gs",
+ "fieldtype": "Section Break",
"in_list_view": 0,
+ "label": "General Settings",
"permlevel": 0
},
{
@@ -56,6 +57,32 @@
"search_index": 0
},
{
+ "fieldname": "column_break_5",
+ "fieldtype": "Column Break",
+ "permlevel": 0
+ },
+ {
+ "fieldname": "default_income_account",
+ "fieldtype": "Link",
+ "label": "Default Income Account",
+ "options": "Account",
+ "permlevel": 0
+ },
+ {
+ "fieldname": "default_expense_account",
+ "fieldtype": "Link",
+ "label": "Default Expense Account",
+ "options": "Account",
+ "permlevel": 0
+ },
+ {
+ "fieldname": "default_cost_center",
+ "fieldtype": "Link",
+ "label": "Default Cost Center",
+ "options": "Cost Center",
+ "permlevel": 0
+ },
+ {
"fieldname": "sb9",
"fieldtype": "Section Break",
"label": "Website Settings",
@@ -163,7 +190,7 @@
"in_create": 1,
"issingle": 0,
"max_attachments": 3,
- "modified": "2014-08-19 06:42:03.262273",
+ "modified": "2014-08-20 17:48:34.489750",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 82b396f..efb793d 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -35,6 +35,7 @@
item_doc = frappe.get_doc("Item", args.item_code)
item = item_doc
+
validate_item_details(args, item)
out = get_basic_details(args, item_doc)
@@ -135,16 +136,22 @@
if len(user_default_warehouse_list)==1 else ""
out = frappe._dict({
+
"item_code": item.name,
"item_name": item.item_name,
"description": item.description_html or item.description,
"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
- "income_account": item.income_account or args.income_account \
- or frappe.db.get_value("Company", args.company, "default_income_account"),
- "expense_account": item.expense_account or args.expense_account \
- or frappe.db.get_value("Company", args.company, "default_expense_account"),
- "cost_center": item.selling_cost_center \
- if args.transaction_type == "selling" else item.buying_cost_center,
+ "income_account": (item.income_account
+ or args.income_account
+ or frappe.db.get_value("Item Group", item.item_group, "default_income_account")
+ or frappe.db.get_value("Company", args.company, "default_income_account")),
+ "expense_account": (item.expense_account
+ or args.expense_account
+ or frappe.db.get_value("Item Group", item.item_group, "default_expense_account")
+ or frappe.db.get_value("Company", args.company, "default_expense_account")),
+ "cost_center": ((item.selling_cost_center if args.transaction_type == "selling" else item.buying_cost_center)
+ or frappe.db.get_value("Item Group", item.item_group, "default_cost_center")
+ or frappe.db.get_value("Company", args.company, "cost_center")),
"batch_no": None,
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
item_doc.get("item_tax")))),
@@ -174,6 +181,7 @@
validate_price_list(args)
validate_conversion_rate(args, meta)
+
price_list_rate = frappe.db.get_value("Item Price",
{"price_list": args.price_list, "item_code": args.item_code}, "price_list_rate")