← 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

 

You're right. The problem was in a module of the spanish localization
that was calling check_vat_es() directly. Thanks for checking and sorry
for the noise.

-- 
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: Invalid

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.