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

[FIX] nl: dutch vat check broken since 01/01/2020 #183

Closed jhk-odoo closed 4 years ago

jhk-odoo commented 4 years ago

New vat numbers received by companies after the 1st january 2020 are considered invalid.

jhk-odoo commented 4 years ago

@arthurdejong let me know what you think about this

arthurdejong commented 4 years ago

Can you provide of this change to the check algorithm? Where do the letters come from?

Also, the tests fail due to an undefined check_val_sole and these changes to BSN will not fix BTW because the format is checked which disallows non-numeric digits before the checksum algorithm is applied.

Can you provide some sample numbers of actual companies that are valid (i.e. pass the VIES VAT validation but do not pass the check algorithm in BSN?

nim-odoo commented 4 years ago

Another VAT number: NL002455799B11 FYI: https://www.belastingdienst.nl/wps/wcm/connect/bldcontenten/belastingdienst/business/vat/new-vat-id/

About the list: http://kleineondernemer.nl/index.php/nieuw-btw-identificatienummer-vanaf-1-januari-2020-voor-eenmanszaken

timmuller commented 4 years ago

Fixes the issue for me, tested with vatnumber: NL000099998B57

vatnumber from: https://www.dezaak.nl/467/zo-ziet-btw-nummer-eruit.htm

@CasVissers How can this work, it contains a syntax error, causing all tests to fail?

Edit: With the assumption check_val_sole is check_val to cast of an int, the check won't work for our VAT-number NL822898044B01, which does not result in the magic number 98 to have rest 1

nim-odoo commented 4 years ago

@timmuller The PR is not correct. I'll adapt what we have done in https://github.com/odoo/odoo/pull/42681

arthurdejong commented 4 years ago

Thanks everyone for helping fix this. I've implemented the fix in a9b3e90. I will make a new release quickly.