refactor: scan barcode field scanning (#26990)

This commit is contained in:
Saqib 2021-08-20 11:09:51 +05:30 committed by GitHub
parent b8c998119b
commit 153fe1cdb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 41 deletions

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -342,30 +342,6 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
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() {

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",

View File

@ -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",