8000 [FIX] base_vat: accept correct Israeli VAT numbers · odoo/odoo@d3aa781 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3aa781

Browse files
committed
[FIX] base_vat: accept correct Israeli VAT numbers
Issue: The reference displayed when entering a non valid VAT number for Israel is incorrect. And the check used is not the right one. Steps to reproduce: - In app Contact, create a new one - Select Israel as country and enter a non valid VAT number - The default ref is displayed: 'CC##' (CC=Country Code, ##=VAT Number) - And the number 039225313 should be accepted Cause: The check used by the library stdnum is not up to date. There is a PR to modify the library stdnum: https://github.com/arthurdejong/python-stdnum/ PR436 as the law has changed. Before only corporations could have a VAT number, now individuals can also have one. The new regulations give different formats for comanies and individuals. Solution: Use the right check (tdnum.il.idnr) for individuals, which is available in the library stdnum. opw-395467
1 parent 5fb4e82 commit d3aa781

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

addons/base_vat/i18n/base_vat.pot

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,3 +253,10 @@ msgstr ""
253253
#, python-format
254254
msgid "partner [%s]"
255255
msgstr ""
256+
257+
#. module: base_vat
258+
#. odoo-python
259+
#: code:addons/base_vat/models/res_partner.py:0
260+
#, python-format
261+
msgid "XXXXXXXXX [9 digits] and it should respect the Luhn algorithm checksum"
262+
msgstr ""

addons/base_vat/models/res_partner.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
'hu': _('HU12345676 or 12345678-1-11 or 8071592153'),
5050
'hr': 'HR01234567896', # Croatia, contributed by Milan Tribuson
5151
'ie': 'IE1234567FA',
52+
'il': _('XXXXXXXXX [9 digits] and it should respect the Luhn algorithm checksum'),
5253
'in': "12AAAAA1234AAZA",
5354
'is': 'IS062199',
5455
'it': 'IT12345670017',
@@ -780,6 +781,10 @@ def check_vat_de(self, vat):
780781
is_valid_stnr = stdnum.util.get_cc_module("de", "stnr").is_valid
781782
return is_valid_vat(vat) or is_valid_stnr(vat)
782783

784+
def check_vat_il(self, vat):
785+
check_func = stdnum.util.get_cc_module('il', 'hp').is_valid if self.is_company else stdnum.util.get_cc_module('il', 'idnr').is_valid
786+
return check_func(vat)
787+
783788
def format_vat_sm(self, vat):
784789
stdnum_vat_format = stdnum.util.get_cc_module('sm', 'vat').compact
785790
return stdnum_vat_format('SM' + vat)[2:]

0 commit comments

Comments
 (0)
0