Browse Source

trying to fix sales barcode 3

chemi ledon 7 years ago
parent
commit
d13f4a8f27
1 changed files with 9 additions and 7 deletions
  1. 9 7
      app/views/sales/_form.html.erb

+ 9 - 7
app/views/sales/_form.html.erb

@@ -327,13 +327,15 @@
 		});
 	});
 
-	$('#barcode_for_sale').codeScanner({
-		maxEntryTime: 200, // milliseconds
-		minEntryChars: 7,  // characters
-		onScan: function ($element, code) {
-			findProductByBarcode(code);
-		}
-	});
+	if (window.location.pathname == "/sales/new") {
+		$('#sale_form #barcode_for_sale').codeScanner({
+			maxEntryTime: 200, // milliseconds
+			minEntryChars: 7,  // characters
+			onScan: function ($element, code) {
+				findProductByBarcode(code);
+			}
+		});
+	}
 
 	$('#sale_customer_id').on('change', function() {
 		// $(this).attr('disabled', true);