← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 635265] Re: base_vat checks don't behave correctly with spaces and throw a server exception

 

** Changed in: openobject-addons
     Assignee: (unassigned) => OpenERP R&D Addons Team 2 (openerp-dev-addons2)

** Changed in: openobject-addons
       Status: New => Confirmed

** Changed in: openobject-addons
   Importance: Undecided => Low

-- 
base_vat checks don't behave correctly with spaces and throw a server exception
https://bugs.launchpad.net/bugs/635265
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: Confirmed

Bug description:
base_vat module uses the following expression to ensure all elements of a string are numeric:

try:
        int(vat)
except:
        return False

This is just wrong because vat (which is a string) may contain spaces at the beginning or end ('  123456') which will not throw an exception. The problem is that usually, after this check, the code continues as if each character was a number and the application can crash.

The attached patch adds a function 'all_numbers()' that is used to check this properly by using a regular expression.