[fix] Patch for material request to purchase order added
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index dbd098d..9474a94 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -486,4 +486,5 @@
 erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
 erpnext.patches.v10_0.update_assessment_plan
 erpnext.patches.v10_0.update_assessment_result
-erpnext.patches.v10_0.set_default_payment_terms_based_on_company
\ No newline at end of file
+erpnext.patches.v10_0.set_default_payment_terms_based_on_company
+erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
\ No newline at end of file
diff --git a/erpnext/patches/v10_0/update_sales_order_link_to_purchase_order.py b/erpnext/patches/v10_0/update_sales_order_link_to_purchase_order.py
new file mode 100644
index 0000000..b4f5838
--- /dev/null
+++ b/erpnext/patches/v10_0/update_sales_order_link_to_purchase_order.py
@@ -0,0 +1,18 @@
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	frappe.reload_doc("buying", "doctype", "supplier_quotation_item")
+
+	for doctype in ['Purchase Order','Supplier Quotation']:
+		frappe.db.sql("""
+			Update
+				`tab{doctype} Item`, `tabMaterial Request Item`
+			set
+				`tab{doctype} Item`.sales_order = `tabMaterial Request Item`.sales_order
+			where
+				`tab{doctype} Item`.material_request= `tabMaterial Request Item`.parent
+				and `tab{doctype} Item`.material_request_item = `tabMaterial Request Item`.name
+				and `tabMaterial Request Item`.sales_order is not null""".format(doctype=doctype))
\ No newline at end of file