Merge pull request #1865 from frappe/wip-4.1

Wip 4.1
diff --git a/erpnext/manufacturing/doctype/bom/bom.js b/erpnext/manufacturing/doctype/bom/bom.js
index ef4f399..6af63d9 100644
--- a/erpnext/manufacturing/doctype/bom/bom.js
+++ b/erpnext/manufacturing/doctype/bom/bom.js
@@ -62,7 +62,7 @@
 
 cur_frm.cscript.workstation = function(doc,dt,dn) {
 	var d = locals[dt][dn];
-	frappe.model.with_doc("Workstation", d.workstation, function(i, r) {
+	frappe.model.with_doc("Workstation", d.workstation, function(name, r) {
 		d.hour_rate = r.docs[0].hour_rate;
 		refresh_field("hour_rate", dn, "bom_operations");
 		erpnext.bom.calculate_op_cost(doc);
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 2eeb841..173a1cf 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -169,14 +169,12 @@
 }
 
 cur_frm.cscript.copy_from_item_group = function(doc) {
-	frappe.model.with_doc("Item Group", doc.item_group, function() {
-		$.each((doc.item_website_specifications || []), function(i, d) {
-				var n = frappe.model.add_child(doc, "Item Website Specification",
-					"item_website_specifications");
-				n.label = d.label;
-				n.description = d.description;
-			}
-		);
+	frappe.model.with_doc("Item Group", doc.item_group, function(name, r) {
+		$.each((r.docs[0].item_website_specifications || []), function(i, d) {
+			var n = frappe.model.add_child(doc, "Item Website Specification", "item_website_specifications");
+			n.label = d.label;
+			n.description = d.description;
+		});
 		cur_frm.refresh();
 	});
 }
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index a7e007a..586179d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -387,7 +387,7 @@
 	def get_item_details(self, args):
 		item = frappe.db.sql("""select stock_uom, description, item_name,
 			expense_account, buying_cost_center from `tabItem`
-			where name = %s and (ifnull(end_of_life,'')='' or end_of_life > now())""",
+			where name = %s and (ifnull(end_of_life,'0000-00-00')='0000-00-00' or end_of_life > now())""",
 			(args.get('item_code')), as_dict = 1)
 		if not item:
 			frappe.throw(_("Item {0} is not active or end of life has been reached").format(args.get("item_code")))