-
Notifications
You must be signed in to change notification settings - Fork 222
VATIN tweaks #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
VATIN tweaks #316
Conversation
7a3409a to
63bcda8
Compare
|
It might be a better idea to provide a stdnum.tin module that transparently supports multiple international tax identification numbers instead of using the stdnum.vatin module for that. VAT numbers are often not general tax identification numbers and sometimes are only relevant for VAT and not for other taxes. A problem is that it is pretty difficult to categorise all personal and company identification numbers into one scheme. For example sometimes you may want to validate that a number is any kind of identifier of sorts, sometimes you may want to ensure that it is assigned to a company in some country or instead identifies some individual and sometimes you may accept one number over another (e.g. a drivers license number may not be sufficient but a ID-card number might be). Companies may have various numbers (e.g. VAT number, income tax number, chamber of commerce number) all of which may be different and appropriate for different circumstances. I'm also thinking about reviewing the existing module to check that the countries that currently provide a "vat" alias are countries that actually have a VAT-based tax system. Ideas on clarifying the use cases are very welcome. |
|
I do realize all of that. Please let me explain the rationale behind Time ago there was this Python package called In my particular case I discovered it through Odoo (formerly OpenERP), exactly when I had to fix the validation for some country. At that moment I discovered that Some time after Odoo replaced I in fact noticed this differentiation when I looked into the TIN for United States, where I found out that the don't have the concept of VAT number, and that their TIN number is not even "universal". To my dismay, the further I looked into other countries, the more difficult it became to differentiate which number to use. Then I stumbled upon https://en.wikipedia.org/wiki/VAT_identification_number in which they kinda mix these two concepts. That happened more or less at the moment when I really wanted So answering your question, sure we can add a Alternatively we can undo some of the Or try to convince those countries to use a single unified number as identifier for the companies/people/etc for all purposes. But I don't see that happening 😄. In fact even countries like Spain have a different company registration number, that in fact is nearly useless since we do use |
|
Another thing @arthurdejong, whether we do keep this module unchanged, or it gets renamed, I still think this particular PR should be merged 😄 |
|
Thanks for providing the detailed response. I will really have to give this some more thought into how to get to some kind of longer-term solution. For now I would think it would be reasonable for any number that is listed on https://en.wikipedia.org/wiki/VAT_identification_number or there is any other source that says the number is used for VAT purposes in the country to be accepted by the vatin module. Btw, I merged one of the commits in this PR as 7348c7a. I'll have to look at the others in more detail (sorry it is taking so long). I'll have to check but I thought Python's regex module automatically kept a cache of compiled regexes and I'm not too happy with the validate() function returning exceptions that are not a subclass of ValidationError because that is the documented API (see https://arthurdejong.org/python-stdnum/doc/). |
| Traceback (most recent call last): | ||
| ... | ||
| InvalidComponent: ... | ||
| ImportError: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validate() function should only raise one of the exceptions listed in stdnum.exceptions.
No description provided.