[fix] [minor] merge conflict fixed
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 34427e6..9400e08 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -255,6 +255,7 @@
 	"patches.1311.p05_website_brand_html",
 	"patches.1311.p06_fix_report_columns",
 	"execute:webnotes.delete_doc('DocType', 'Documentation Tool')",
+	"execute:webnotes.delete_doc('Report', 'Stock Ledger') #2013-11-29",
 	"execute:webnotes.delete_doc('Report', 'Payment Collection With Ageing')",
 	"execute:webnotes.delete_doc('Report', 'Payment Made With Ageing')",
 ]
\ No newline at end of file
diff --git a/selling/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py
index f2b00c6..f6cfafa 100644
--- a/selling/doctype/sales_bom/sales_bom.py
+++ b/selling/doctype/sales_bom/sales_bom.py
@@ -3,8 +3,6 @@
 
 from __future__ import unicode_literals
 import webnotes
-from webnotes.utils import flt
-from webnotes.model.utils import getlist
 
 class DocType:
 	def __init__(self,d,dl):
@@ -14,8 +12,6 @@
 		self.doc.name = self.doc.new_item_code
 	
 	def validate(self):
-		# check for duplicate
-		self.check_duplicate()
 		self.validate_main_item()
 
 		from utilities.transaction_base import validate_uom_is_integer
@@ -36,40 +32,6 @@
 			'uom': det and det[0][1] or ''
 		}
 
-	def check_duplicate(self, finder=0):
-		il = getlist(self.doclist, "sales_bom_items")
-		if not il:
-			webnotes.msgprint("Add atleast one item")
-			return
-		
-		# get all Sales BOM that have the first item	
-		sbl = webnotes.conn.sql("""select distinct parent from `tabSales BOM Item` where item_code=%s 
-			and parent != %s and docstatus != 2""", (il[0].item_code, self.doc.name))
-		
-		# check all siblings
-		sub_items = [[d.item_code, flt(d.qty)] for d in il]
-		
-		for s in sbl:
-			t = webnotes.conn.sql("""select item_code, qty from `tabSales BOM Item` where parent=%s and 
-				docstatus != 2""", s[0])
-			t = [[d[0], flt(d[1])] for d in t]
-	
-			if self.has_same_items(sub_items, t):
-				webnotes.msgprint("%s has the same Sales BOM details" % s[0])
-				raise Exception
-		if finder:
-			webnotes.msgprint("There is no Sales BOM present with the following Combination.")
-
-	def has_same_items(self, l1, l2):
-		if len(l1)!=len(l2): return 0
-		for l in l2:
-			if l not in l1:
-				return 0
-		for l in l1:
-			if l not in l2:
-				return 0
-		return 1
-
 def get_new_item_code(doctype, txt, searchfield, start, page_len, filters):
 	from controllers.queries import get_match_cond
 	
diff --git a/selling/utils/cart.py b/selling/utils/cart.py
index c4c0b72..3cd7b3c 100644
--- a/selling/utils/cart.py
+++ b/selling/utils/cart.py
@@ -310,7 +310,7 @@
 	quotation.run_method("set_price_list_and_item_details")
 	
 	# set it in cookies for using in product page
-	webnotes.cookies[b"selling_price_list"] = quotation.doc.selling_price_list
+	webnotes.local._response.set_cookie("selling_price_list", quotation.doc.selling_price_list)
 	
 def set_taxes(quotation, cart_settings, billing_territory):
 	"""set taxes based on billing territory"""
diff --git a/selling/utils/product.py b/selling/utils/product.py
index d218979..32ff85a 100644
--- a/selling/utils/product.py
+++ b/selling/utils/product.py
@@ -16,7 +16,7 @@
 	
 	cart_quotation = _get_cart_quotation()
 	
-	price_list = webnotes.cookies.get("selling_price_list").value
+	price_list = webnotes.local.request.cookies.get("selling_price_list")
 
 	warehouse = webnotes.conn.get_value("Item", item_code, "website_warehouse")
 	if warehouse:
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index cbfc3fc..4be5a46 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -138,7 +138,8 @@
 		items: [
 			{
 				"label":wn._("Stock Ledger"),
-				page: "stock-ledger"
+				doctype: "Delivery Note",
+				route: "query-report/Stock Ledger"
 			},
 			{
 				"label":wn._("Stock Balance"),
@@ -171,11 +172,6 @@
 		icon: "icon-list",
 		items: [
 			{
-				"label":wn._("Stock Ledger"),
-				route: "Report/Stock Ledger Entry/Stock Ledger",
-				doctype: "Stock Ledger Entry"
-			},
-			{
 				"label":wn._("Ordered Items To Be Delivered"),
 				route: "query-report/Ordered Items To Be Delivered",
 				doctype: "Delivery Note"
diff --git a/stock/report/stock_ledger/stock_ledger.js b/stock/report/stock_ledger/stock_ledger.js
new file mode 100644
index 0000000..0e323eb
--- /dev/null
+++ b/stock/report/stock_ledger/stock_ledger.js
@@ -0,0 +1,58 @@
+// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+// License: GNU General Public License v3. See license.txt
+
+wn.query_reports["Stock Ledger"] = {
+	"filters": [
+		{
+			"fieldname":"company",
+			"label": wn._("Company"),
+			"fieldtype": "Link",
+			"options": "Company",
+			"default": wn.defaults.get_user_default("company"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"from_date",
+			"label": wn._("From Date"),
+			"fieldtype": "Date",
+			"default": wn.defaults.get_user_default("year_start_date"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"to_date",
+			"label": wn._("To Date"),
+			"fieldtype": "Date",
+			"default": wn.defaults.get_user_default("year_end_date"),
+			"reqd": 1
+		},
+		{
+			"fieldname":"warehouse",
+			"label": wn._("Warehouse"),
+			"fieldtype": "Link",
+			"options": "Warehouse"
+		},
+		{
+			"fieldname":"item_code",
+			"label": wn._("Item"),
+			"fieldtype": "Link",
+			"options": "Item"
+		},
+		{
+			"fieldname":"brand",
+			"label": wn._("Brand"),
+			"fieldtype": "Link",
+			"options": "Brand"
+		},
+		{
+			"fieldname":"voucher_no",
+			"label": wn._("Voucher #"),
+			"fieldtype": "Data"
+		}
+	]
+}
+
+// $(function() {
+// 	$(wrapper).bind("show", function() {
+// 		wn.query_report.load();
+// 	});
+// });
\ No newline at end of file
diff --git a/stock/report/stock_ledger/stock_ledger.py b/stock/report/stock_ledger/stock_ledger.py
new file mode 100644
index 0000000..3ae9135
--- /dev/null
+++ b/stock/report/stock_ledger/stock_ledger.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+def execute(filters=None):
+	columns = ["Date:Datetime:95", "Item:Link/Item:100", "Item Name::100", 
+		"Item Group:Link/Item Group:100", "Brand:Link/Brand:100",
+		"Description::200", "Warehouse:Link/Warehouse:100",
+		"Stock UOM:Link/UOM:100", "Qty:Float:50", "Balance Qty:Float:80", 
+		"Balance Value:Currency:100", "Voucher Type::100", "Voucher #::100",
+		"Batch:Link/Batch:100", "Serial #:Link/Serial No:100", "Company:Link/Company:100"]
+
+	data = webnotes.conn.sql("""select concat_ws(" ", posting_date, posting_time),
+			item.name, item.item_name, item.item_group, brand, description, warehouse, sle.stock_uom,
+			actual_qty, qty_after_transaction, stock_value, voucher_type, voucher_no, 
+			batch_no, serial_no, company
+		from `tabStock Ledger Entry` sle,
+			(select name, item_name, description, stock_uom, brand, item_group
+				from `tabItem` {item_conditions}) item
+		where item_code = item.name and
+			company = %(company)s and
+			posting_date between %(from_date)s and %(to_date)s
+			{sle_conditions}
+			order by posting_date desc, posting_time desc, sle.name desc"""\
+		.format(item_conditions=get_item_conditions(filters),
+			sle_conditions=get_sle_conditions(filters)),
+		filters)
+
+	return columns, data
+	
+def get_item_conditions(filters):
+	conditions = []
+	if filters.get("item_code"):
+		conditions.append("item_code=%(item_code)s")
+	if filters.get("brand"):
+		conditions.append("brand=%(brand)s")
+	
+	return "where {}".format(" and ".join(conditions)) if conditions else ""
+	
+def get_sle_conditions(filters):
+	conditions = []
+	if filters.get("warehouse"):
+		conditions.append("warehouse=%(warehouse)s")
+	if filters.get("voucher_no"):
+		conditions.append("voucher_no=%(voucher_no)s")
+	
+	return "and {}".format(" and ".join(conditions)) if conditions else ""
\ No newline at end of file
diff --git a/stock/report/stock_ledger/stock_ledger.txt b/stock/report/stock_ledger/stock_ledger.txt
index a40be1d..aadf323 100644
--- a/stock/report/stock_ledger/stock_ledger.txt
+++ b/stock/report/stock_ledger/stock_ledger.txt
@@ -1,19 +1,18 @@
 [
  {
-  "creation": "2013-01-14 15:26:21", 
+  "creation": "2013-11-29 17:08:23", 
   "docstatus": 0, 
-  "modified": "2013-08-20 11:53:43", 
+  "modified": "2013-11-29 17:28:15", 
   "modified_by": "Administrator", 
   "owner": "Administrator"
  }, 
  {
   "doctype": "Report", 
   "is_standard": "Yes", 
-  "json": "{\"filters\":[],\"columns\":[[\"item_code\",\"Stock Ledger Entry\"],[\"warehouse\",\"Stock Ledger Entry\"],[\"posting_date\",\"Stock Ledger Entry\"],[\"posting_time\",\"Stock Ledger Entry\"],[\"actual_qty\",\"Stock Ledger Entry\"],[\"qty_after_transaction\",\"Stock Ledger Entry\"],[\"voucher_type\",\"Stock Ledger Entry\"],[\"voucher_no\",\"Stock Ledger Entry\"]],\"sort_by\":\"Stock Ledger Entry.posting_date\",\"sort_order\":\"desc\",\"sort_by_next\":\"Stock Ledger Entry.posting_time\",\"sort_order_next\":\"desc\"}", 
   "name": "__common__", 
   "ref_doctype": "Stock Ledger Entry", 
   "report_name": "Stock Ledger", 
-  "report_type": "Report Builder"
+  "report_type": "Script Report"
  }, 
  {
   "doctype": "Report", 
diff --git a/stock/stock_ledger.py b/stock/stock_ledger.py
index 469fa53..8702744 100644
--- a/stock/stock_ledger.py
+++ b/stock/stock_ledger.py
@@ -1,5 +1,6 @@
 # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
 # License: GNU General Public License v3. See license.txt
+from __future__ import unicode_literals
 
 import webnotes
 from webnotes import msgprint