refactor: scan barcode field scanning (#26990)
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
index 33c3e04..fcccb39 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.json
@@ -595,7 +595,8 @@
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
- "label": "Scan Barcode"
+ "label": "Scan Barcode",
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -1553,7 +1554,7 @@
"icon": "fa fa-file-text",
"is_submittable": 1,
"links": [],
- "modified": "2021-07-29 13:37:20.636171",
+ "modified": "2021-08-17 20:13:44.255437",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
index 7025dd9..7822f74 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
@@ -668,8 +668,7 @@
"fieldname": "scan_barcode",
"fieldtype": "Data",
"label": "Scan Barcode",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -1715,7 +1714,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
- "modified": "2021-08-07 17:53:14.351439",
+ "modified": "2021-08-17 20:16:12.737743",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index b65b101..e317443 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -692,6 +692,7 @@
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
+ "options": "Barcode",
"hide_days": 1,
"hide_seconds": 1,
"label": "Scan Barcode"
@@ -2013,7 +2014,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2021-08-17 19:00:32.230701",
+ "modified": "2021-08-17 20:16:12.737743",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index bb0ad60..a55a0b7 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -565,6 +565,7 @@
"fieldname": "scan_barcode",
"fieldtype": "Data",
"label": "Scan Barcode",
+ "options": "Barcode",
"show_days": 1,
"show_seconds": 1
},
@@ -1378,7 +1379,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2021-05-30 15:17:53.663648",
+ "modified": "2021-08-17 20:16:12.737743",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index 3c6c347..9375e35 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -342,30 +342,6 @@
this.set_dynamic_labels();
this.setup_sms();
this.setup_quality_inspection();
- let scan_barcode_field = this.frm.get_field('scan_barcode');
- if (scan_barcode_field && scan_barcode_field.get_value()) {
- scan_barcode_field.set_value("");
- scan_barcode_field.set_new_description("");
-
- if (frappe.is_mobile()) {
- if (scan_barcode_field.$input_wrapper.find('.input-group').length) return;
-
- let $input_group = $('<div class="input-group">');
- scan_barcode_field.$input_wrapper.find('.control-input').append($input_group);
- $input_group.append(scan_barcode_field.$input);
- $(`<span class="input-group-btn" style="vertical-align: top">
- <button class="btn btn-default border" type="button">
- <i class="fa fa-camera text-muted"></i>
- </button>
- </span>`)
- .on('click', '.btn', () => {
- frappe.barcode.scan_barcode().then(barcode => {
- scan_barcode_field.set_value(barcode);
- });
- })
- .appendTo($input_group);
- }
- }
}
scan_barcode() {
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index d31db82..38ea5c8 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -571,7 +571,8 @@
"fieldtype": "Data",
"hide_days": 1,
"hide_seconds": 1,
- "label": "Scan Barcode"
+ "label": "Scan Barcode",
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -1510,7 +1511,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
- "modified": "2021-07-08 21:37:44.177493",
+ "modified": "2021-08-17 20:15:26.531553",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.json b/erpnext/stock/doctype/delivery_note/delivery_note.json
index dbfeb4a..9581896 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.json
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.json
@@ -515,7 +515,8 @@
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
- "label": "Scan Barcode"
+ "label": "Scan Barcode",
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -1305,7 +1306,7 @@
"idx": 146,
"is_submittable": 1,
"links": [],
- "modified": "2021-07-08 21:37:20.802652",
+ "modified": "2021-08-17 20:15:50.574966",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index 4e2d9e6..cb46a6c 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -133,7 +133,8 @@
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
- "label": "Scan Barcode"
+ "label": "Scan Barcode",
+ "options": "Barcode"
},
{
"allow_bulk_edit": 1,
@@ -181,7 +182,7 @@
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Select",
- "options": "\nDraft\nSubmitted\nStopped\nCancelled\nPending\nPartially Ordered\nPartially Received\nOrdered\nIssued\nTransferred\nReceived",
+ "options": "\nDraft\nSubmitted\nStopped\nCancelled\nPending\nPartially Ordered\nOrdered\nIssued\nTransferred\nReceived",
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
@@ -314,7 +315,7 @@
"idx": 70,
"is_submittable": 1,
"links": [],
- "modified": "2021-03-31 23:52:55.392512",
+ "modified": "2021-08-17 20:16:12.737743",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request",
diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
index 44fb736..1a59734 100755
--- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
+++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
@@ -1098,7 +1098,8 @@
{
"fieldname": "scan_barcode",
"fieldtype": "Data",
- "label": "Scan Barcode"
+ "label": "Scan Barcode",
+ "options": "Barcode"
},
{
"fieldname": "billing_address",
@@ -1148,7 +1149,7 @@
"idx": 261,
"is_submittable": 1,
"links": [],
- "modified": "2021-05-25 00:15:12.239017",
+ "modified": "2021-08-17 20:16:40.849885",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt",
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.json b/erpnext/stock/doctype/stock_entry/stock_entry.json
index 523d332..e6ce3c8 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.json
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.json
@@ -355,6 +355,7 @@
},
{
"fieldname": "scan_barcode",
+ "options": "Barcode",
"fieldtype": "Data",
"label": "Scan Barcode"
},
@@ -629,7 +630,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
- "modified": "2021-05-26 17:07:58.015737",
+ "modified": "2021-08-17 20:16:12.737743",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",