ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How can manage barcode for weighed items in POS?



could any one please tell us how to use

iv an item with code : pistachio Barcode : 0991111 and im trying to scan : 2000991111095 ( which is 950 G)
But couldnt scan it

so please some one describe how to design my entire barcode for the 13 digits and how can i separate them to include all important data

Thanks in advance


Any updates please !!


Have a look at the beginning of this post.



Do u mean that ?

think the barcode is composed like this:

1st digit: is 2 - fixed number for weighted items
from 2nd to 7th digit for item code (actually it’s a PLU of the weight scale)
from 8th to 12nd is the weight or the price value (in your case is the price)
the 13rd is the check digit.


as i can see here

 if (item.barcode.substr(0,7) == key.substr(0,7)) {                            
	        			pesokg1 = key.substr(7,6)

				        if (pesokg1.startsWith('0000')){
	        			        pesokg='0.' + pesokg1.substr(4)
				        }else if (pesokg1.startsWith('000')){
	        			        pesokg='0.' + pesokg1.substr(3)
				        }else if (pesokg1.startsWith('00')){
	        			        pesokg='0.' + pesokg1.substr(2)
				        }else if (pesokg1.startsWith('0')){
	        			        pesokg=pesokg1.substr(1,1) +'.' + pesokg1.substr(2,pesokg1.length)
				        }else if (!pesokg1.startsWith('0')){
	        			        pesokg=pesokg1.substr(0,2) +'.' + pesokg1.substr(2,pesokg1.length)


i`v made item barcode = 20012345 so now its from 0 to 7

and key = 2001234500012

so now (item.barcode.substr(0,7) == key.substr(0,7)) is done

and (pesokg1.startsWith(‘000’) so its = 120G 0.12

Am i right ??


That is correct.
Notice that 0000 decrease as the weight number increases.


Ok but when i try to scan the barcode it appears no data !!

Whats wrong ??


Debug and check that you can see the code here
if (key.length == 13){
//Codigo barras por KG; Weighted barcode
if (key.startsWith(‘200’)){


base_amount: could not find docfield in method precision()

the only error message in console

but where can i find the code in debugger


Before the if(key.length == 13){ add console.log(key.length)
this will show the result and will also allow you to breakpoint to debug line by line…


i made what you said
and then clear-cache
restarted the bench

but no new logs in console ??


Did you after reloading the page pressed F12 for debug you should see all Console.log you have added and be able to click for the source code and click again on the numbers to breakpoint and debug.



That is not a local server instance?
Did you manage to change the POS.JS ?
Correct first the error you have about the base_amount and only after you will be able to continue…


Hi @adam26d
Thank you for file, but when i scan i cannot get item details.
i have product item code say 4025
i had put in plu 4025 , item code 4025
in erp i had put item 4025
after scanning sticker came out , with weight = 0.140
but when i scan this barcode its showing no product in ERP.
i have local server install with POS offline

Really appriciate your help


@adam26d @Helio_Jesus bro any update?


When you scan the barcode what numbers you get? Like 124025025000286 or something else?

Also on the barcode should be the weight and not the price as you need to input on POS the quantity so the system calculates the total.


Thank you for the message, I had created code with weight, i am attaching that sticker .

when i scan code i get 204025001404
item code in erp and plu is 4025, weight is 0.140 . but when i scan in erp pos it can not find product .


Without making too much change on the code you already copied just change your bar code to have 13 numbers by adding a Zero like 2004025001404 and give a try.

The rest is done by the code.


Hi i tried with adding zero but no luck same “Not items found”