Allow to scan product barcodes on sale point


It is common that sale points have a barcode scanner so it will be good to have a scan function implemented on it.


Implement on_code_scan function 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.

As we do not know which code should be used to search the product we can just use the rec_name clause to find the product which will match using product code and product identifiers (AKA EAN).



I guess raise error is the only option we have here? Or is it possible to add another wizard view to select or search for product name?
OTOH raise error would drop the user to the standard interface anyway, there they can search for products by name.

This is not a behavior that every POS will want. So for me it must be implemented in a separate module.

Why is it 1? How about product with a UoM that is not in Units category.

What about barcode which include the quantity?

For me using barcode should be more strict than guessing with record name.
The POS should be configured to accept only specific code. The input should be validated before being used to search the exact matching product.
I think if the search has more than one result, there should be an error message.

Also the POS should support scanning gift card (and in the future promotion coupon).

What are other behaviours? What is the issue of having a scan code and not using it?

Because when its a weigth they usually have a balance to put the product and enter the code on the balance. Also the balance are creting the pos receipt. So I do not think other UoM will be using the scanner.

On the other hand, as the barcode is printed on each product. If you have multiple units its common to scan them one by one.

We can try to parse if the code is Code128 using python-stdnum and read if if available.
I’m just mentioning Code128 because I do not know other barcodes that include the quantity. But as far as they can be parsed it won’t be an issue.

I’m wondering if the scan widget should scan which type of product to be scanned. Otherwise we can pick a promotion coupon when the user scaned a product with the same code. Of course that won’t be an issue using EAN code but it can be when using products for formats.

OF course, if we allow to configure the code that should be used for the product, we should provide a report for printing the barcode of a product. So the user is able to print it and add it to the product.

IIRC I already asked you to include a barcode report on product when support to print barcodes was added but It was rejected do not remember why.

I’m not talking about that at all.

The administrator should be define which barcode are in use.

If we defined the barcode to scan we should be also able to print it

I do not agree. This is two unrelated topic.

Then we need another blueprint!

What exactly does this mean? How should this work?

On a sale point, barcodes are useful for countable units. When you buy 1 kg flour, you buy one package with 1 kg flour. When you go to the fresh food counter and buy 750g Tomatos, you get one (bag with a) barcode with the price for the 742g Tomatoes. Do you mean this with the quantity?

Some barcode format include a quantity or event packaging information.

Some barcode specifications like GS1 allow include product code and quantities in the same barcode.

I haven’t read the GS1 specification for a long time but IIRC there are also bar code that specify the total amount (for example when you weight an apple, the barcode generated will sometimes contain the product identifier and the weight and sometimes the product identifier and the amount, I guess other combinations are possible).

I would like to add some elements about barcode types.

The kind of barcode depends a lot of the usage case:

  • in retail, you usually have only barcode with track the item (1 barcode = 1 package)
  • in food retail, you could find some barcode with price or weight information (1 barcode = item code + price/weight info encoded)
  • in industry, you could have more elaborated barcodes with packaging information (1 barcode = item code + quantity + …)

I am relatively familiar with retail (as I have such configuration, but i don’t use Tryton for the point of sale retail), and usually all products are purchased with a barcode already printed (I am in France, so it is EAN13 barcode type). so I don’t control what the supplier did with the barcode and I need to cope with it.

Yes, it may also contain the total amount.

Fortunatly python-stdnum has a module for parsing gs1_128, so we just need to use it to get the proper data.

1 Like

Is the module existing or in progress?

There is a working implementation on the first post.