ERPNext Conference 2019* Blog

How can manage barcode for weighed items in POS?



You might need to check the code if product number is 4 or 5 digits long.

Think the code check for 5 digits…

You might just also change your item code to 40250 on erpnext before making any changes to source code


Thanks for quick reply,i had made changes in code 40250 in erp next. but same not adding in cart .


Unfortunately not close to of to check the code…
Once near by will check what we’re doing wrong.


Is it possible can you share one of your item code in erp and a barcode sticker which is generated from weight machine. so i can test what is exact problem.


I have checked my code again and code length should be 13
so 2004025001404 is correct but instead of having 5 digits for Item code it should have only 4 (was correct before, item code should be 4025).
Now if no changes done to my code it checks for 280 instead of 200 … . just change from 200 to 280 and give a try to see if ERPNext gives you the Barcode scanned ?



Hi @Helio_Jesus
I had tried this before but same no luck :frowning:


Make you barcode like 2804025001404 should work if no changes to source code were done… as it checks for number 280 to start…


hi thank you for help, do i need to run bench build or any other command ? after this. cuz its same result no item found .


Not really… I advise you to Debug to see what the code is getting after scanning …
For instance if you still have the same code i shared… by pressing F12 and seeing the console you will ‘continua procura’ by following that or by checking the code on that you will end up a line code if key.lenght == 13 put a breakpoint (F9 if not a click on the left of the code line) to mark and do line by line to see what if the value of key.sbustr(3,4) as this is the one that will search for the BarCode on your item.


Hi @Helio_Jesus and @adam26d Thank you both for help,
Finally its working, i just followed @Helio_Jesus code from begging and its work perfectly for weighted items. just wondering how can we get barcode for count items? corrently its give qty .01 for counted items.


Thanks and glad to know… Now when you say counting is you pass the same item many times and the qty increases?


helo Helio_Jesus,

could you drop me a pm please, We are looking for a pro for POS customization and somebody recomennded you. Thank you


Yes i had fix counted item as well , what i have done i make changes in barcode and your machine must support two or more different barcode for diffrent items. i used ACOM NETS machine.
For weighted item i use 280 2000 WWWWW and digital number is coming as 13 digit in last from weight machine. where W is stand for weighted item.
for counted item i made change 280 200 WW000 and last number is coming auto. so barcode reader give proper counted item in qty.



In what can I help you?


Has anyone tested this in V11?


Hi. Am interested in this code on V11. Can anyone confirm if it work fine?


Last I tested I was not successful. But we’ll have to face the music sooner or later.


Hello everyone.

Three years ago someone posted this issue on github asking for it to be built into the core, The issue hasn’t gotten much attention. Maybe this is why it hasn’t been taken seriously. This is not good because we have to hack each new erpnext version to get this weighted barcode working, so far we are still in version 10. Sad isnt it?

Kindly take a minute to log into / signup on github and give a thumbs up (:+1:) to the linked issue so we can show that this is a much needed issue. So here it is:


Hi @adam26d Did this work on V11/12?



Hello @Muzzy

I don’t remember the results of my test but my customers that need this feature are still on v10.

If I were to guess my test result I’d say NO, the solution may need rewriting.