Patch for reverting manufacturers table from item
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index c396402..773583e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -390,3 +390,4 @@
erpnext.patches.v8_0.set_project_copied_from
erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim
erpnext.patches.v7_2.stock_uom_in_selling
+erpnext.patches.v8_0.revert_manufacturers_table_from_item
\ No newline at end of file
diff --git a/erpnext/patches/v8_0/manufacturer_childtable_migrate.py b/erpnext/patches/v8_0/manufacturer_childtable_migrate.py
deleted file mode 100644
index 87a3431..0000000
--- a/erpnext/patches/v8_0/manufacturer_childtable_migrate.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2017, Frappe and Contributors
-# License: GNU General Public License v3. See license.txt
-
-from __future__ import unicode_literals
-import frappe
-
-def execute():
-
- # reading from json and writing it to mariadb
- # reload_doc needed here with information because new table introduced
- frappe.reload_doc('stock', 'doctype', 'item_manufacturer')
- # reload_doctype is a simpler concept of reload_doc
- frappe.reload_doctype('Item')
-
- item_manufacturers = frappe.get_all("Item", fields=["name", "manufacturer", "manufacturer_part_no"])
- for item in item_manufacturers:
- if item.manufacturer or item.manufacturer_part_no:
- item_doc = frappe.get_doc("Item", item.name)
- item_doc.append("manufacturers", {
- "manufacturer": item.manufacturer,
- "manufacturer_part_no": item.manufacturer_part_no
- })
-
- item_doc.get("manufacturers")[0].db_update()
\ No newline at end of file
diff --git a/erpnext/patches/v8_0/revert_manufacturers_table_from_item.py b/erpnext/patches/v8_0/revert_manufacturers_table_from_item.py
new file mode 100644
index 0000000..60cbb33
--- /dev/null
+++ b/erpnext/patches/v8_0/revert_manufacturers_table_from_item.py
@@ -0,0 +1,22 @@
+# 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 frappe
+
+def execute():
+ if frappe.db.exists("DocType", "Item Manufacturer"):
+ frappe.reload_doctype("Item")
+ item_manufacturers = frappe.db.sql("""
+ select parent, manufacturer, manufacturer_part_no
+ from `tabItem Manufacturer`
+ """, as_dict=1)
+
+ for im in item_manufacturers:
+ frappe.db.sql("""
+ update tabItem
+ set manufacturer=%s, manufacturer_part_no=%s
+ where name=%s
+ """, (im.manufacturer, im.manufacturer_part_no, im.parent))
+
+ frappe.delete_doc("DocType", "Item Manufacturer")
\ No newline at end of file