Support Barcode and QR code scanners


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.

Neither, it is an attribute of the form.

Because you need to display the video of what is scanned.

It is the live image of the camera.

No but the scanner will be available on wizard form.