Hello,

This bug have been Fixed.

 * It has been Fixed in 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1050648-tta
 * Revision ID: [email protected]

  It will be available soon in trunk.

Thanks,
Tejas - tta

** Branch linked: lp:~openerp-dev/openobject-addons/trunk-
bug-1050648-tta

** Changed in: openobject-addons
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1050648

Title:
  packaging EAN fails validation

Status in OpenERP Addons (modules):
  Fix Committed

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(eancode):
      if not eancode:
          return True
      if len(eancode) <> 14:
          return False
      try:
          int(eancode)
      except:
          return False
      oddsum=0
      evensum=0
      total=0
      eanvalue=eancode
      reversevalue = eanvalue[::-1]
      finalean=reversevalue[1:]

      for i in range(len(finalean)):
          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(pack.ean)

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1050648/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~openerp-india
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-india
More help   : https://help.launchpad.net/ListHelp

Reply via email to