Merge pull request #4245 from nabinhait/sr_no

[fix] Serial No query in Warranty Claim
diff --git a/erpnext/config/buying.py b/erpnext/config/buying.py
index 7729872..79de835 100644
--- a/erpnext/config/buying.py
+++ b/erpnext/config/buying.py
@@ -164,6 +164,21 @@
 					"label": _("Customer and Supplier"),
 					"youtube_id": "anoGi_RpQ20"
 				},
+				{
+					"type": "help",
+					"label": _("Material Request to Purchase Order"),
+					"youtube_id": "4TN9kPyfIqM"
+				},
+				{
+					"type": "help",
+					"label": _("Purchase Order to Payment"),
+					"youtube_id": "EK65tLdVUDk"
+				},
+				{
+					"type": "help",
+					"label": _("Managing Subcontracting"),
+					"youtube_id": "ThiMCC2DtKo"
+				},
 			]
 		},
 	]
diff --git a/erpnext/config/crm.py b/erpnext/config/crm.py
index 7b015c7..b92bf22 100644
--- a/erpnext/config/crm.py
+++ b/erpnext/config/crm.py
@@ -146,6 +146,11 @@
 					"label": _("Lead to Quotation"),
 					"youtube_id": "TxYX4r4JAKA"
 				},
+				{
+					"type": "help",
+					"label": _("Newsletters"),
+					"youtube_id": "muLKsCrrDRo"
+				},
 			]
 		},
 	]
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 72fe8dd..3942766 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -196,4 +196,30 @@
 				},
 			]
 		},
+		{
+			"label": _("Help"),
+			"icon": "icon-facetime-video",
+			"items": [
+				{
+					"type": "help",
+					"label": _("Setting up Employees"),
+					"youtube_id": "USfIUdZlUhw"
+				},
+				{
+					"type": "help",
+					"label": _("Leave Management"),
+					"youtube_id": "fc0p_AXebc8"
+				},
+				{
+					"type": "help",
+					"label": _("Expense Claims"),
+					"youtube_id": "5SZHJF--ZFY"
+				},
+				{
+					"type": "help",
+					"label": _("Processing Payroll"),
+					"youtube_id": "apgE-f25Rm0"
+				},
+			]
+		}
 	]
diff --git a/erpnext/config/learn.py b/erpnext/config/learn.py
index e0f1c06..6557f52 100644
--- a/erpnext/config/learn.py
+++ b/erpnext/config/learn.py
@@ -124,6 +124,11 @@
 				},
 				{
 					"type": "help",
+					"label": _("Item Variants"),
+					"youtube_id": "OGBETlCzU5o"
+				},
+				{
+					"type": "help",
 					"label": _("Opening Stock Balance"),
 					"youtube_id": "0yPgrtfeCTs"
 				},
diff --git a/erpnext/config/manufacturing.py b/erpnext/config/manufacturing.py
index 5b51b0f..1db7945 100644
--- a/erpnext/config/manufacturing.py
+++ b/erpnext/config/manufacturing.py
@@ -120,6 +120,16 @@
 					"label": _("Bill of Materials"),
 					"youtube_id": "hDV0c1OeWLo"
 				},
+				{
+					"type": "help",
+					"label": _("Production Planning Tool"),
+					"youtube_id": "CzatSl4zJ2Y"
+				},
+				{
+					"type": "help",
+					"label": _("Production Order"),
+					"youtube_id": "ZotgLyp2YFY"
+				},
 			]
 		}
 	]
diff --git a/erpnext/config/projects.py b/erpnext/config/projects.py
index 07149e3..78a78ac 100644
--- a/erpnext/config/projects.py
+++ b/erpnext/config/projects.py
@@ -70,4 +70,15 @@
 				},
 			]
 		},
+		{
+			"label": _("Help"),
+			"icon": "icon-facetime-video",
+			"items": [
+				{
+					"type": "help",
+					"label": _("Managing Projects"),
+					"youtube_id": "egxIGwtoKI4"
+				},
+			]
+		},
 	]
diff --git a/erpnext/config/selling.py b/erpnext/config/selling.py
index 62dfe23..ba1210e 100644
--- a/erpnext/config/selling.py
+++ b/erpnext/config/selling.py
@@ -294,6 +294,16 @@
 					"label": _("Customer and Supplier"),
 					"youtube_id": "anoGi_RpQ20"
 				},
+				{
+					"type": "help",
+					"label": _("Sales Order to Payment"),
+					"youtube_id": "7AMq4lqkN4A"
+				},
+				{
+					"type": "help",
+					"label": _("Point-of-Sale"),
+					"youtube_id": "4WkelWkbP_c"
+				},
 			]
 		},
 	]
diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py
index f5ecba0..dab009d 100644
--- a/erpnext/config/stock.py
+++ b/erpnext/config/stock.py
@@ -265,13 +265,33 @@
 				},
 				{
 					"type": "help",
+					"label": _("Item Variants"),
+					"youtube_id": "OGBETlCzU5o"
+				},
+				{
+					"type": "help",
 					"label": _("Opening Stock Balance"),
 					"youtube_id": "0yPgrtfeCTs"
 				},
 				{
 					"type": "help",
-					"label": _("Item Variants"),
-					"youtube_id": "OGBETlCzU5o"
+					"label": _("Making Stock Entries"),
+					"youtube_id": "Njt107hlY3I"
+				},
+				{
+					"type": "help",
+					"label": _("Serialized Inventory"),
+					"youtube_id": "gvOVlEwFDAk"
+				},
+				{
+					"type": "help",
+					"label": _("Batch Inventory"),
+					"youtube_id": "J0QKl7ABPKM"
+				},
+				{
+					"type": "help",
+					"label": _("Managing Subcontracting"),
+					"youtube_id": "ThiMCC2DtKo"
 				},
 			]
 		}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index b36f74b..c40eec5 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -228,3 +228,5 @@
 erpnext.patches.v6_4.make_image_thumbnail #2015-10-20
 erpnext.patches.v6_5.show_in_website_for_template_item
 erpnext.patches.v6_4.fix_expense_included_in_valuation
+execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
+erpnext.patches.v6_6.fix_website_image
diff --git a/erpnext/patches/v6_6/__init__.py b/erpnext/patches/v6_6/__init__.py
new file mode 100644
index 0000000..baffc48
--- /dev/null
+++ b/erpnext/patches/v6_6/__init__.py
@@ -0,0 +1 @@
+from __future__ import unicode_literals
diff --git a/erpnext/patches/v6_6/fix_website_image.py b/erpnext/patches/v6_6/fix_website_image.py
new file mode 100644
index 0000000..b3b4cab
--- /dev/null
+++ b/erpnext/patches/v6_6/fix_website_image.py
@@ -0,0 +1,32 @@
+from __future__ import unicode_literals
+import frappe
+from frappe.utils import encode
+
+def execute():
+	"""Fix the File records created via item.py even if the website_image file didn't exist"""
+	for item in frappe.db.sql_list("""select name from `tabItem`
+		where website_image is not null and website_image != ''
+			and website_image like '/files/%'
+			and exists (
+				select name from `tabFile`
+					where attached_to_doctype='Item'
+					and attached_to_name=`tabItem`.name
+					and file_url=`tabItem`.website_image
+					and (file_name is null or file_name = '')
+				)"""):
+
+		item = frappe.get_doc("Item", item)
+		file = frappe.get_doc("File", {
+			"attached_to_doctype": "Item",
+			"attached_to_name": item.name,
+			"file_url": item.website_image
+		})
+
+		try:
+			file.validate_file()
+		except IOError:
+			print encode(item.website_image), "does not exist"
+			file.delete()
+			item.db_set("website_image", None, update_modified=False)
+
+
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 96e2660..c1d4591 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -760,7 +760,7 @@
    "fieldname": "target_warehouse", 
    "fieldtype": "Link", 
    "hidden": 0, 
-   "ignore_user_permissions": 0, 
+   "ignore_user_permissions": 1, 
    "in_filter": 0, 
    "in_list_view": 0, 
    "label": "To Warehouse (Optional)", 
@@ -1162,7 +1162,7 @@
  "is_submittable": 0, 
  "issingle": 0, 
  "istable": 1, 
- "modified": "2015-10-26 02:19:18.053222", 
+ "modified": "2015-10-28 12:41:53.738462", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Delivery Note Item", 
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 0f1f0e0..c621957 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -104,12 +104,16 @@
 
 			# for CSV import
 			if not file_doc:
-				file_doc = frappe.get_doc({
-					"doctype": "File",
-					"file_url": self.website_image,
-					"attached_to_doctype": "Item",
-					"attached_to_name": self.name
-				}).insert()
+				try:
+					file_doc = frappe.get_doc({
+						"doctype": "File",
+						"file_url": self.website_image,
+						"attached_to_doctype": "Item",
+						"attached_to_name": self.name
+					}).insert()
+
+				except IOError:
+					self.website_image = None
 
 			if file_doc:
 				if not file_doc.thumbnail_url: