Barcode and QR code are used to quickly input data. Tryton clients could benefit from supporting scanners to fill form quickly.
A new attribute is added to the form which contains the list of type of barcode or qr code to detect.
When set the client display an input entry and a button to start the reader or if no reader is supported just the entry (with a customizable shortcut to set the focus on it).
The position must be fixed to be always visible.
When the user starts the reader, the client display a feedback of the video in a popup until a code bar is detected. An option activate or not a beep to warn user that a code has been detected. And another defines if the reader must stop or keep scanning until the user close the window.
When a code is scanned (or entered and validated in the input), the client calls a method on_code_scan which behaves like an instance button but with the code as parameter (the depends are managed like for the buttons).
The method could raise exceptions in case the code can not be processed (and if the option is activate, another beep is played).
To support hardware scanner (which behaves most of the time as a keyboard), the input shortcut can be used as trigger by the scanner to put the focus on the input before “typing” the code.
For the web client we can use the library quagga2, the main advantage against the common zxing is that it is invariant to scale and rotation.
And for the desktop client we can use zbar.
The feature can be activate on the Sale Point to find product to add (or to increase) with a quantity of 1 (if the sale unit has no digits).
Is it a new field type, or a widget of a common field? Will it be possible to scan multiple codes one by one, without keyboard interaction? E.g. scan all lot numbers and or product codes of all products in a shipment-in at once and separate/handle them in the next step.
Why is a button needed to start the reader? Is it also possible to start the reader once the view is opened?
What does video means in this context?
This sounds scanning multiple codes one after one seems not directly possible. Is on_code scan able to drive a wizard? E.g. having a view with only input and buttons scan next and cancel*. On code scan press button scan next to store the scanned code and propose the same view for the next code.
After testing both libraries based on camera, I think the performance and the speed of detecting barcode is not good enough to be useful. Indeed there are hardwares for about 30€ that can scan barcode quickly and communicate via USB or Bluetooth that are compatible with Linux, MacOS, Windows, Android and iphone.
So I think it is simpler to just develop the input capture of such hardware (which behaves like keyboard) and it will provide a better user experience.
That was not true, we don’t use the on_change but the next step of the wizard.
Not exactly. In many cases you’ll receive a barcode and you will have to parse it to see the kind of barcode it is and do more things that just selecting a product. For example, an EAN128 barcode can include lot number, expiry date and a quantity.
With a single char field we also allow the user to introduce the quantity after the barcode or simply scan barcodes one after the other. Just like in the supermarket.
I would also like Tryton to select the item automatically in a Many2One field if there is only one, that’s an improvement for the user introducing the information manually, but don’t see it as an advantage for barcode reading specifically.
I have recently tried using a c++ library to read barcodes and qr codes on the web with webassembly (wasm), and it is very effective using the live camera. detection is very efficient even on an old mobile. milliseconds.
It is even fast having all the formats activated.
I tested it and it may be faster than the other library, it still has difficulties with small barcode when a cheap gun at 25€ scan it quickly. More over such gun is more user friendly because you have the red light line to help you pointing to the barcode.
What you will try, a native scanner is always faster because it is designed specifically for that purpose. You can buy a Bluetooth finger scanner, connect it with your device and scan quickly and efficiently in your warehouse. Much more efficient then trying to scan with your phone or tablet. An example https://www.amazon.com/Bluetooth-Wireless-Portable-Wearable-Connection/dp/B08KD2LNC7. There are also fixed scanners for in your shop.
So generally speaking make it possible in the client to enter barcodes very quickly. Maybe even kind of “disconnect” the field. Barcodes are entered by the scanner and put into a queue and from there they will be send to Tryton. So when Tryton is checking and searching, the user can already scan the next product.
I was thinking a bit too far ahead on this because it needs a really different UI. Also in most cases it doesn’t make sense because Tryton will be fast enough to send data back. And I know this because I’m using a barcode scanner for 2D data matrix in a special client which sends the barcode to Tryton (JSON-RPC) and gets data back before the user even got the other product.
Going back to the queue, you can think of showing the barcodes scanned in a list and show a spinner when waiting for return data from Tryton. When there is an error a warning sign is displayed and the user can click on it to see the error.
I just tested and it looks good to me. I’m just wondering if we should also include a visual indicator to show to the user that the code have been successfully scanned, as with disabled sound it is no way to know if the code had been correctly scanned or not.
We just tested with a USB barcode scanner using firefox and the Bookmark menu entry is opened when scanning the code. Everything works fine with chromium or even tryton client. Not sure if others experimented the same behaviour.
I think a on_code_scan function should be implemented in sale_point module to scan products directly from the user interface. This implementation should:
Raise error if the product is not found or not salable.
Add a new line if the product is not included on the sale point lines with quantity 1 and compute the price.
If a line with the same product is found, the line quantity should be increased by one.
I discovered that there is a missing match in the scan window with the password window. that happened when the session time expired.
It would be nice if the scan window detects some special keys (F1, F2,…), such as to modify the quantity of the product, before being searched.
Also that the One2Many field/widget can emit the type of action in the on_change:
Some points of sale require confirmation from a supervisor before removing any product from the list.
I have a question: can a wizard be issued from the on_change?
if action == "add":
if action == "remove":
if that’s true!
I like the elegance of this implementation (input code from form).
In any case, depending on the case, you could take advantage of the barcode input to manually add the quantity, but that would have to be done by the developer, for example:
if we want to add 4 units of a product 0001
we could write 4x0001 in the input and from the code detect the “x” to do the rest