Removed clear_custom_buttons, pos view switch fix
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
index 034880a..bfb500c 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js
@@ -24,7 +24,7 @@
 		}
 
 		// toggle to pos view if is_pos is 1 in user_defaults
-		if ((cint(frappe.defaults.get_user_defaults("is_pos"))===1 || this.frm.doc.is_pos)) {
+		if ((is_null(this.frm.doc.is_pos) && cint(frappe.defaults.get_user_default("is_pos"))===1) || this.frm.doc.is_pos) {
 			if(this.frm.doc.__islocal && !this.frm.doc.amended_from && !this.frm.doc.customer) {
 				this.frm.set_value("is_pos", 1);
 				this.is_pos(function() {
diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js
index 27ee152..2c37204 100644
--- a/erpnext/public/js/transaction.js
+++ b/erpnext/public/js/transaction.js
@@ -47,7 +47,6 @@
 	},
 
 	refresh: function() {
-		this.frm.clear_custom_buttons();
 		erpnext.toggle_naming_series();
 		erpnext.hide_company();
 		this.show_item_wise_taxes();
diff --git a/erpnext/selling/doctype/lead/lead.js b/erpnext/selling/doctype/lead/lead.js
index 286ce35..ba9741b 100644
--- a/erpnext/selling/doctype/lead/lead.js
+++ b/erpnext/selling/doctype/lead/lead.js
@@ -30,7 +30,6 @@
 	refresh: function() {
 		var doc = this.frm.doc;
 		erpnext.toggle_naming_series();
-		this.frm.clear_custom_buttons();
 
 		if(!this.frm.doc.__islocal && this.frm.doc.__onload && !this.frm.doc.__onload.is_customer) {
 			this.frm.add_custom_button(__("Create Customer"), this.create_customer);
diff --git a/erpnext/selling/doctype/opportunity/opportunity.js b/erpnext/selling/doctype/opportunity/opportunity.js
index 4cc95ad..ce7c6ea 100644
--- a/erpnext/selling/doctype/opportunity/opportunity.js
+++ b/erpnext/selling/doctype/opportunity/opportunity.js
@@ -80,7 +80,6 @@
 
 cur_frm.cscript.refresh = function(doc, cdt, cdn) {
 	erpnext.toggle_naming_series();
-	cur_frm.clear_custom_buttons();
 
 	if(doc.docstatus === 1 && doc.status!=="Lost") {
 		cur_frm.add_custom_button(__('Create Quotation'), cur_frm.cscript.create_quotation);