Merge pull request #3651 from rmehta/pos-default-pay-fix

[fix] pos default payment #3631
diff --git a/erpnext/public/js/pos/pos.js b/erpnext/public/js/pos/pos.js
index 70f3023..e28c718 100644
--- a/erpnext/public/js/pos/pos.js
+++ b/erpnext/public/js/pos/pos.js
@@ -401,7 +401,7 @@
 
 			this.with_modes_of_payment(function() {
 				// prefer cash payment!
-				var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment : 
+				var default_mode = me.frm.doc.mode_of_payment ? me.frm.doc.mode_of_payment :
 					me.modes_of_payment.indexOf(__("Cash"))!==-1 ? __("Cash") : undefined;
 
 				// show payment wizard
@@ -450,8 +450,7 @@
 
 					if (is_cash && !dialog.get_value("change")) {
 						// set to nearest 5
-						var paid_amount = 5 * Math.ceil(dialog.get_value("total_amount") / 5);
-						dialog.set_value("paid_amount", paid_amount);
+						dialog.set_value("paid_amount", dialog.get_value("total_amount"));
 						dialog.get_input("paid_amount").trigger("change");
 					}
 				}).trigger("change");
@@ -487,6 +486,12 @@
 });
 
 erpnext.pos.make_pos_btn = function(frm) {
+	frm.page.add_menu_item(__("{0} View", [frm.page.current_view_name === "pos" ? "Form" : "Point-of-Sale"]), function() {
+		erpnext.pos.toggle(frm);
+	});
+
+	if(frm.pos_btn) return;
+
 	// Show POS button only if it is enabled from features setup
 	if (cint(sys_defaults.fs_pos_view)!==1 || frm.doctype==="Material Request") {
 		return;
@@ -494,7 +499,8 @@
 
 	if(!frm.pos_btn) {
 		frm.pos_btn = frm.page.add_action_icon("icon-th", function() {
-			erpnext.pos.toggle(frm) });
+			erpnext.pos.toggle(frm);
+		});
 	}
 
 	if(erpnext.open_as_pos && frm.page.current_view_name !== "pos") {