Fixed opportunity status (#9062)

diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index cede8f4..42327b9 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -19,10 +19,10 @@
 		["Converted", "has_customer"],
 	],
 	"Opportunity": [
-		["Quotation", "has_active_quotation"],
-		["Converted", "has_ordered_quotation"],
 		["Lost", "eval:self.status=='Lost'"],
 		["Lost", "has_lost_quotation"],
+		["Quotation", "has_active_quotation"],
+		["Converted", "has_ordered_quotation"],
 		["Closed", "eval:self.status=='Closed'"]
 	],
 	"Quotation": [
diff --git a/erpnext/crm/doctype/opportunity/opportunity.js b/erpnext/crm/doctype/opportunity/opportunity.js
index 974b23e..0e14c85 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.js
+++ b/erpnext/crm/doctype/opportunity/opportunity.js
@@ -35,6 +35,7 @@
 		var doc = frm.doc;
 		frm.events.enquiry_from(frm);
 		frm.trigger('set_contact_link');
+		erpnext.toggle_naming_series();
 
 		if(!doc.__islocal && doc.status!=="Lost") {
 			if(doc.with_items){
@@ -53,6 +54,20 @@
 				frm.add_custom_button(__('Lost'),
 					cur_frm.cscript['Declare Opportunity Lost']);
 			}
+		},
+
+		if(!frm.doc.__islocal && frm.perm[0].write && frm.doc.docstatus==0) {
+			if(frm.doc.status==="Open") {
+				frm.add_custom_button(__("Close"), function() {
+					frm.set_value("status", "Closed");
+					frm.save();
+				});
+			} else {
+				frm.add_custom_button(__("Reopen"), function() {
+					frm.set_value("status", "Open");
+					frm.save();
+				});
+			}
 		}
 	},
 
@@ -122,25 +137,6 @@
 
 $.extend(cur_frm.cscript, new erpnext.crm.Opportunity({frm: cur_frm}));
 
-cur_frm.cscript.refresh = function(doc, cdt, cdn) {
-	erpnext.toggle_naming_series();
-
-	var frm = cur_frm;
-	if(!doc.__islocal && frm.perm[0].write && doc.docstatus==0) {
-		if(frm.doc.status==="Open") {
-			frm.add_custom_button(__("Close"), function() {
-				frm.set_value("status", "Closed");
-				frm.save();
-			});
-		} else {
-			frm.add_custom_button(__("Reopen"), function() {
-				frm.set_value("status", "Open");
-				frm.save();
-			});
-		}
-	}
-}
-
 cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
 	if(doc.enquiry_from == 'Lead' && doc.lead)
 		cur_frm.cscript.lead(doc, cdt, cdn);
diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py
index eebf464..58f26fe 100644
--- a/erpnext/crm/doctype/opportunity/opportunity.py
+++ b/erpnext/crm/doctype/opportunity/opportunity.py
@@ -31,7 +31,6 @@
 		if not self.enquiry_from:
 			frappe.throw(_("Opportunity From field is mandatory"))
 
-		self.set_status()
 		self.validate_item_details()
 		self.validate_uom_is_integer("uom", "qty")
 		self.validate_lead_cust()