[Feature] EAN Validator in forms?

Hi there,

what about to add an EAN validator in forms?

kind of http://formvalidation.io/validators/ean/


what would you need it for?

I assume If you have your own EANs then you would not need to validate as you have them generated already including checksum and images

If you use others e.g. in retail or wholesale…
just scan them in with a Barcodescaner

maybe I dont get it!?

Let’s assume u have a retail food chain with about 4k items and each items have at least 1 barcode …retail chain stores get items update everyday from central warehouse …could happen that barcode has typo errors so would be nice to validate it while storing …same if operators add item manually …if barcode are wrong item will not be recognised while scanning …

Another problem is that 1 item can have more than 1 barcode …erpnext by design, allow to store only one …I think this can be solved adding item barcode child table in item, in place of barcode field.

Search will have to be modified to look up to the new item barcode doctype instead of a single field in the item table …

ok… I get that manual Operation thing

But ! Item or different PUs of one Item have only one EAN that is the idea of the EAN
so if you have f.e Item 1 -
a glass of peanut butter 250grams from peanut butter heaven it has one EAN
The Item 2 - a 12 Pack of it may have an other EAN
A pallet (Item 3) an other EAN
but that then would be a variants of Item 1
hence there would be barcode fields for each variant anyhow

Am I wrong?

Unfortunately it’she not like that …barcode depends on where item has been produced.

Let’s get can of coke 33cl as example: if produced and shipped from farm A (North Italy) will have barcode 8001234567890 if shipped from farm B (South of Italy) it will have barcode 8001230006789, but the product is exactly the same.

really?? within one country you habe different EAN???
that cant be according to GS1 Standard

I know that depending of the country of Origin you can have different ones but that makes sense as the packaging might be different in terms of Language
or marketing like special edition so another EAN makes sense in order not to send italian Coke to France as Law requires conform packaging.
but then again its a different Item even if the content is the same

Well I guess if you say so the problem persists no matter whether the manufacturers are up to standart or not.

Thanks, learned something new today

Yes, because ean code is related to production warehouse …so if you have more production warehouse in a country you’ll have different barcodes …later i’ll post all barcodes for coke 33cl and oreal shampoo …so u will have an idea on difference bwtween theory and pratics :smile:

Here it comes:

EAN13 for Coke Light 33 x 6:


EAN13 for Shampoo Pantene Classic 2 in 1:


in both cases it’s exactly the same product …

Oh No, what a mess…

Ok so now I can follow your suggestion. So it would be essential to set up that type of Barcode table
Do you think it would make sense to tie any atributes to the barcode eg “origin”
or “Promotion Packaging”? - what I mean would it make sense to do that or can you think of a usecase?


well honestly we don’t keep track of barcode attributes as it will be scanned and then u get item related to it.

Thing is that erpnext need to be customized in order to have the search to lookup up into the new item Barcode DocType instead of the field; actually i’m not python skilled enough to make it work :grin: Up to now I’ve added the child table to item doctype :sweat_smile:

well ok then so as long as the barcode is tied to the Item we´re fine

I just got into Python as well and the ERPNext code is mighty so yes it is quite a hard thing for beginners - but I look at it

if others have a hint!? - feel free to help.

I definitely second the notion that UPC/EAN code validation is a good idea. Really, anything with a check digit is probably going to be worth the fraction of a second that validating it would take. I’m just evaluating the system at the moment, but this is something I will work on in the future if it hasn’t already been done.

Of course, a manufacturer can always abuse the rules, or devise non-standard ways to handle problems, but this is definitely not a correct statement in general. GS1 standard barcodes are not, by definition, related in any way to the manufacturing facility. We sometimes produce products for other manufacturers and they provide their own UPCs, even though they are manufactured by an entirely different company. The company prefix is really just who controls assignment of the block of codes.

If they’re doing that, it sounds like they’re trying to track some information through POS that would normally be managed through lot numbers. And it really does sound like a mess…

1 Like

It’s really a mess …but that’s happening in food stores …i’ve a database with about 150k valid EANs and about 130k different products.

Let me add that, all POS software in food stores are built using a database table having Item to Barcode relation as 1 to many

In theory should be 1 to 1 relation …but, believe me …practically its not like that at all …