Merge pull request #2073 from anandpdoshi/anand-august-18

[fix] Leave Application Calendar - Fixes #2065
diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py
index 124e309..3222a0c 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.py
+++ b/erpnext/hr/doctype/leave_application/leave_application.py
@@ -242,8 +242,13 @@
 @frappe.whitelist()
 def get_events(start, end):
 	events = []
-	employee = frappe.db.get_default("employee", frappe.session.user)
-	company = frappe.db.get_default("company", frappe.session.user)
+
+	employee = frappe.db.get_value("Employee", {"user_id": frappe.session.user}, ["name", "company"],
+		as_dict=True)
+	if not employee:
+		return events
+
+	employee, company = employee.name, employee.company
 
 	from frappe.widgets.reportview import build_match_conditions
 	match_conditions = build_match_conditions("Leave Application")
diff --git a/erpnext/selling/doctype/sms_center/sms_center.py b/erpnext/selling/doctype/sms_center/sms_center.py
index 8c4cad3..d53a20e 100644
--- a/erpnext/selling/doctype/sms_center/sms_center.py
+++ b/erpnext/selling/doctype/sms_center/sms_center.py
@@ -18,12 +18,10 @@
 			where_clause = self.customer and " and customer = '%s'" % \
 				self.customer.replace("'", "\'") or " and ifnull(customer, '') != ''"
 		if self.send_to == 'All Supplier Contact':
-			where_clause = self.supplier and \
-				" and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % \
+			where_clause = self.supplier and " and supplier = '%s'" % \
 				self.supplier.replace("'", "\'") or " and ifnull(supplier, '') != ''"
 		if self.send_to == 'All Sales Partner Contact':
-			where_clause = self.sales_partner and \
-				" and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % \
+			where_clause = self.sales_partner and " and sales_partner = '%s'" % \
 				self.sales_partner.replace("'", "\'") or " and ifnull(sales_partner, '') != ''"
 
 		if self.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index 88109bb..45b4232 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -175,7 +175,7 @@
    "reqd": 1
   }, 
   {
-   "depends_on": "eval:doc.is_stock_item==\"Yes\"", 
+   "depends_on": "", 
    "description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.", 
    "fieldname": "default_warehouse", 
    "fieldtype": "Link", 
@@ -825,7 +825,7 @@
  "icon": "icon-tag", 
  "idx": 1, 
  "max_attachments": 1, 
- "modified": "2014-07-03 10:45:19.574737", 
+ "modified": "2014-08-18 09:32:57.268763", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item", 
diff --git a/erpnext/stock/doctype/packed_item/packed_item.py b/erpnext/stock/doctype/packed_item/packed_item.py
index f04625b..9263907 100644
--- a/erpnext/stock/doctype/packed_item/packed_item.py
+++ b/erpnext/stock/doctype/packed_item/packed_item.py
@@ -67,12 +67,10 @@
 	packing_list_idx = 0
 	parent_items = []
 	for d in obj.get(item_table_fieldname):
-		warehouse = (item_table_fieldname == "sales_order_details") \
-			and d.warehouse or d.warehouse
 		if frappe.db.get_value("Sales BOM", {"new_item_code": d.item_code}):
 			for i in get_sales_bom_items(d.item_code):
 				update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty),
-					warehouse, d, packing_list_idx)
+					d.warehouse, d, packing_list_idx)
 
 			if [d.item_code, d.name] not in parent_items:
 				parent_items.append([d.item_code, d.name])