packaging EAN fails validation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Addons (MOVED TO GITHUB) |
Fix Committed
|
Medium
|
OpenERP R&D Addons Team 2 |
Bug Description
OpenERP Server 6.1-1
Windows sbs 2008
If I try to save a packaging EAN for a product, I have an error message about invalid EAN.
I assume that this error is generated because the server tries to validate the EAN code with the same validator as EAN13 BUT (here is the but) this EAN is 14 digits.
I made some changes to the product.py file
I added this:
def check_ean14(
if not eancode:
return True
if len(eancode) <> 14:
return False
try:
except:
return False
oddsum=0
evensum=0
total=0
eanvalue=
reversevalue = eanvalue[::-1]
finalean=
for i in range(len(
if is_pair(i):
oddsum += int(finalean[i])
else:
evensum += int(finalean[i])
total=(oddsum * 3) + evensum
check = int(10 - math.ceil(total % 10.0)) %10
if check != int(eancode[-1]):
return False
return True
and modify this line from this:
res = check_ean(pack.ean)
To this
res = check_ean14(
with this I skipped the 14 characters error of the EAN but I am not sure the method for validation is the correct for packaging EAN.
After doing this change i was able to add packaging EAN for a product.
Related branches
- OpenERP Core Team: Pending requested
-
Diff: 21 lines (+2/-2)1 file modifiedproduct/product.py (+2/-2)
affects: | openobject-server → openobject-addons |
Changed in openobject-addons: | |
status: | Confirmed → In Progress |
Hello Rodrigo Nuno ,
Currently EAN14 facility is not provided by us , if you want this facility then you can custumise
it.So its not a bug and I am closing this issue.
Thanks!!!