Modify ERPNext Barcode Scanner

Has anybody built a custom app to replace the ERPNext barcode scanner?

Many of the labels I scan have multiple barcodes, and it’s impossible to use the camera-based barcode scanner that ERPNext provides because I can’t accurately enough scan the barcode I need.

I need a way to override the ERPNext barcode scanner and use a different Javascript barcode scanning library.

Has anybody ever build anything like this?

This is related to beam by @tmatteson with Agritheory.

Not sure if it covers all your use cases: https://github.com/agritheory/beam

Basically I don’t need to change what the ERPNext barcode scanner actually does, but the javascript-based barcode scanner that ships with ERPNext doesn’t work for me at all.

For instance, Ubiquiti hardware ships with a small label that has 3 different barcodes on it, and they are printed very small, so I can’t get the barcode I need to scan in the window by itself.

I believe there are javascript libraries that can scan multiple barcodes and allow the user to select which barcode is actually copied/read.

Yes it should be possible, maybe with a client script but for sure with an app. You would disable frappe scanner, replace with your own, scan, then pass the retrieved string into the same barcode field.

I am by no means an expert - this is an option as a high level overview:

  1. Remove the scan button element from the barcode field
  2. Add your own scan button element in it’s place
  3. Trigger a modal on click with frappe.ui.Dialog
  4. The model loads your version of the scanner with the library of your choice
  5. handle any other user inputs within the modal
  6. On modal completion, push the retrieved string into the barcode field. With something like:
frm.set_value('scan_barcode', decodedTextFromYourScanner)
   .then(() => {
     // optional: refresh the field or trigger any downstream logic
     frm.refresh_field('scan_barcode');
   });

Why don’t you buy a simple external scanner? It usually can be paired via Bluetooth with a mobile or computer and works just like a keyboard. The red laser can be aimed very easily to small bar codes and it’s very fast with reading.
I believe it would be easier than modifying code.
Something like this is not very expensive: Netum Nt-1698w Handheld Wirelress Barcode Scanner And Nt-1228bl Bluetooth 1d/2d Qr Bar Code Reader Pdf417 For Ios Android Ipad - Scanners - AliExpress

1 Like

Why not go the easier option of buying a barcode scanner that can read multiple barcodes and return the only the data you need.

I’ve used Zebra scanners to read GS1 data matrix info and configured it to report back only the info I was interested in, and in the order I wanted it to be presented, even including tabs to the next field before entering the data.

Other manufacturers have similar options, Zebra is the only one I have first actually used

https://www.zebra.com/gb/en/software/scanner-software/label-parse-plus.html

Because I’d rather not give my guys another device to have to carry around and maintain…

Many on my employees have to scan barcodes, but relatively infrequently. For example the field sales team may only have to scan barcodes a couple times a month, but when they do they might have a couple dozen barcodes to scan.

In that scenario, it doesn’t make sense to make them worry about carrying around a dedicated device just to scan barcodes.