arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
498 stars 206 forks source link

New BTW identification number (NL) #185

Closed nim-odoo closed 4 years ago

nim-odoo commented 4 years ago

As of January 1st 2020, a new BTW identification number has been introduced in Netherlands.

This commit implements the new check algorithm.

The algorithm detail can be found in: http://kleineondernemer.nl/index.php/nieuw-btw-identificatienummer-vanaf-1-januari-2020-voor-eenmanszaken

Note that this implementation already takes into account the following:

Op termijn kan de structuur met uitzondering van de landaanduiding op positie 1-2 en de 2 cijfers op positie 13-14 wijzigen. Dat wil zeggen dat op de posities 3-12 cijfers, hoofdletters of de tekens ‘+’ en ‘*’ kunnen komen.

Even if positions 3-12 have still the format 9 digits + 'B', this might not be the case anymore in the future.

This aims to replace #183 and #184

nim-odoo commented 4 years ago

Note: this was successfully tested with a list of ~2500 existing Dutch BTW numbers and the new ones from 2020:

NL001162938B28 NL002455799B11 NL001617419B92 NL001452330B47

I am checking the CI error at the moment.

nim-odoo commented 4 years ago

@arthurdejong Fixes #182, tests added and CI passing. Thanks

arthurdejong commented 4 years ago

Thanks for the fix. Since the stdnum module already had a Mod 97 implementation that was used instead in a9b3e90. The test numbers were really helpful though as it helped me better confirm the correct implementation.

arthurdejong commented 4 years ago

Hi @nim-odoo, Release 1.13 of python-stdnum was made that includes this fix. You may want to consider using this in Odoo.

nim-odoo commented 4 years ago

Thanks!