Barcode Reports

We have been asked so many times to print the barcodes of a product or a lot.
I would be nice to have core Barcode reports for product and lots. So you can print those reports to get the label.

We have some custom reports u-sing python-barcode which works really well.
The field to get the code for the image should be a property, to allow customization.

Don’t you think it make sense to have this? Any use case I’m not catching or that can be an addition to my suggestion?

1 Like

I would suggest to add the barcode generation function into the report class itself. So you can call for the barcode with the data you want, the size and the type of barcode. The function returns an image which you can position in your report. So no new things are needed in the different models.

There are many reports for which you want a barcode. For example a form which is filled by hand and then digitized. By using OCR you can use the barcode to match with a Tryton record for example.

I use Treepoem for barcode generation. It’s a Python wrapper around BWIPP a pure Postscript barcode generator. It has basically all the barcodes available (Symbologies Reference · bwipp/postscriptbarcode Wiki · GitHub) from 1D to 2D.

I will not be against adding tools to generate barcode and qrcode in trytond. The API must be designed to be abstract from the underlying library used (because we may need to change it in the future). Of course it is a good idea to expose this API to the report context. The API must also allow to create Function field to display them in the client.
Once this API is designed we can choose the libraries. For me they must be pure Python to avoid to have to deal with non-Python dependencies. I think it is good like python-barcode to use SVG as base format and rely on Pillow (which is already an optional dependency) to generate non-vectorial image. qrcode seem to be a good option also.
Also we should be allowed to introspect the available formats and support to have fallback.