Merge pull request #7476 from rohitwaghchaure/draft_status_issue_after_amend

[Fix] After amend the status become cancelled even if docstatus is zero
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index 096bb2d..4fbee58 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -103,6 +103,8 @@
 
 	def set_status(self, update=False, status=None, update_modified=True):
 		if self.is_new():
+			if self.get('amended_from'):
+				self.status = 'Draft'
 			return
 
 		if self.doctype in status_map:
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 492fc1b..462f198 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -360,4 +360,5 @@
 erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
 execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statment'})
 erpnext.patches.v7_2.update_website_for_variant
-erpnext.patches.v7_2.update_salary_slips
\ No newline at end of file
+erpnext.patches.v7_2.update_doctype_status
+erpnext.patches.v7_2.update_salary_slips
diff --git a/erpnext/patches/v7_2/update_doctype_status.py b/erpnext/patches/v7_2/update_doctype_status.py
new file mode 100644
index 0000000..c66f3f2
--- /dev/null
+++ b/erpnext/patches/v7_2/update_doctype_status.py
@@ -0,0 +1,11 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	doctypes = ["Opportunity", "Quotation", "Sales Order", "Sales Invoice", "Purchase Invoice", "Purchase Order", "Delivery Note", "Purchase Receipt"]
+	for doctype in doctypes:
+		frappe.db.sql(""" update `tab{doctype}` set status = 'Draft'
+			where status = 'Cancelled' and docstatus = 0 """.format(doctype = doctype))
\ No newline at end of file