[fix] issue#980

This commit is contained in:
Neil Trini Lasrado 2014-08-20 17:20:29 +05:30
parent bb6b58c271
commit caba531e89
2 changed files with 44 additions and 9 deletions

View File

@ -22,9 +22,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 @@
"reqd": 1,
"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",
@ -164,7 +191,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",

View File

@ -35,6 +35,7 @@ def get_item_details(args):
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 @@ def get_basic_details(args, item_doc):
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 @@ def get_price_list_rate(args, item_doc, out):
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")