mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-18 04:12:07 +02:00
vanilla 16.0
This commit is contained in:
parent
8c653da57a
commit
f0ee375081
156 changed files with 10614 additions and 55980 deletions
|
|
@ -38,35 +38,14 @@ pip install odoo-bringout-oca-ocb-base_vat
|
|||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- account
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: VAT Number Validation
|
||||
- **Version**: 1.0
|
||||
- **Category**: Accounting/Accounting
|
||||
- **License**: LGPL-3
|
||||
- **Installable**: False
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `base_vat`.
|
||||
- Repository: https://github.com/OCA/OCB
|
||||
- Branch: 16.0
|
||||
- Path: addons/base_vat
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original LGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
This package preserves the original LGPL-3 license.
|
||||
|
|
|
|||
|
|
@ -1,91 +1,22 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_vat
|
||||
#
|
||||
# * base_vat
|
||||
#
|
||||
# Translators:
|
||||
# Martin Trigaux, 2018
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Project-Id-Version: Odoo Server saas~11.5\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-02-10 08:27+0000\n"
|
||||
"PO-Revision-Date: 2025-02-10 08:27+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"POT-Creation-Date: 2018-09-21 13:17+0000\n"
|
||||
"PO-Revision-Date: 2018-09-21 13:17+0000\n"
|
||||
"Last-Translator: Martin Trigaux, 2018\n"
|
||||
"Language-Team: Bosnian (https://www.transifex.com/odoo/teams/41243/bs/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"10XXXXXXXXY or 20XXXXXXXXY or 15XXXXXXXXY or 16XXXXXXXXY or 17XXXXXXXXY"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "17291716060 (NIN) or 1729171602 (VKN)"
|
||||
msgstr "17291716060 (NIN) or 1729171602 (VKN)"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "1792060346001 or 1792060346"
|
||||
msgstr "1792060346001 ili 1792060346"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "3101012009"
|
||||
msgstr "3101012009"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "310175397400003 [Fifteen digits, first and last digits should be \"3\"]"
|
||||
msgstr "310175397400003 [petnaest znamenaka, prva i zadnja moraju biti \"3\"]"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "49-098-576 or 49098576"
|
||||
msgstr "49-098-576 ili 49098576"
|
||||
|
||||
#. module: base_vat
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.res_config_settings_view_form
|
||||
msgid ""
|
||||
"<span class=\"fa fa-lg fa-building-o\" title=\"Values set here are company-"
|
||||
"specific.\" aria-label=\"Values set here are company-specific.\" "
|
||||
"groups=\"base.group_multi_company\" role=\"img\"/>"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "AR200-5536168-2 or 20055361682"
|
||||
msgstr "AR200-5536168-2 ili 20055361682"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "CHE-123.456.788 TVA or CHE-123.456.788 MWST or CHE-123.456.788 IVA"
|
||||
msgstr "CHE-123.456.788 TVA ili CHE-123.456.788 MWST ili CHE-123.456.788 IVA"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "CO213123432-1 or CO213.123.432-1"
|
||||
msgstr "CO213123432-1 ili CO213.123.432-1"
|
||||
"Language: bs\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
#. module: base_vat
|
||||
#: model:ir.model,name:base_vat.model_res_company
|
||||
|
|
@ -95,54 +26,13 @@ msgstr "Kompanije"
|
|||
#. module: base_vat
|
||||
#: model:ir.model,name:base_vat.model_res_config_settings
|
||||
msgid "Config Settings"
|
||||
msgstr "Postavke"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#: model:ir.model,name:base_vat.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr "Kontakt"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "DE123456788 or 12/345/67890"
|
||||
msgstr "DE123456788 ili 12/345/67890"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "DO1-01-85004-3 or 101850043"
|
||||
msgstr "DO1-01-85004-3 ili 101850043"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"Example: '219999830019' (format: 12 digits, all numbers, valid check digit)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#: model:ir.model,name:base_vat.model_account_fiscal_position
|
||||
msgid "Fiscal Position"
|
||||
msgstr "Fiskalna pozicija"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "GB123456782 or XI123456782"
|
||||
msgstr "GB123456782 ili XI123456782"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "HU12345676 or 12345678-1-11 or 8071592153"
|
||||
msgstr "HU12345676 ili 12345678-1-11 ili 8071592153"
|
||||
|
||||
#. module: base_vat
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.res_config_settings_view_form
|
||||
msgid ""
|
||||
|
|
@ -151,103 +41,35 @@ msgid ""
|
|||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "MXGODE561231GR8 or GODE561231GR8"
|
||||
msgstr "MXGODE561231GR8 ili GODE561231GR8"
|
||||
|
||||
#. module: base_vat
|
||||
#: model:ir.model.fields,field_description:base_vat.field_res_partner__vies_failed_message
|
||||
#: model:ir.model.fields,field_description:base_vat.field_res_users__vies_failed_message
|
||||
msgid "Technical field display a message to the user if the VIES check fails."
|
||||
msgstr "Tehničko polje prikazuje poruku korisniku ako je VIES provjera neuspješna."
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#: code:addons/base_vat/models/res_partner.py:154
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The %(vat_label)s number [%(wrong_vat)s] does not seem to be valid. \n"
|
||||
"Note: the expected format is %(expected_format)s"
|
||||
"The VAT number [%s] for partner [%s] does not seem to be valid. \n"
|
||||
"Note: the expected format is %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#: code:addons/base_vat/models/res_partner.py:153
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The %(vat_label)s number [%(wrong_vat)s] for %(record_label)s does not seem to be valid. \n"
|
||||
"Note: the expected format is %(expected_format)s"
|
||||
"The VAT number [%s] for partner [%s] either failed the VIES VAT validation "
|
||||
"check or did not respect the expected format %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "The VAT number %s failed the VIES VAT validation check."
|
||||
msgstr "Porezni broj %s nije prošao validaciju u VIES bazi."
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/account_fiscal_position.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The country detected for this foreign VAT number does not match any of the "
|
||||
"countries composing the country group set on this fiscal position."
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/account_fiscal_position.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The country of the foreign VAT number could not be detected. Please assign a"
|
||||
" country to the fiscal position or set a country group"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.company_form_vat
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.view_partner_form
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.view_partner_short_form
|
||||
msgid "VAT"
|
||||
msgstr "PDV broj [%s] za partnera [%s] izgleda da nije važeći. \nNapomena: očekivani format je %s"
|
||||
msgstr "PDV"
|
||||
|
||||
#. module: base_vat
|
||||
#: model:ir.model.fields,field_description:base_vat.field_res_company__vat_check_vies
|
||||
#: model:ir.model.fields,field_description:base_vat.field_res_config_settings__vat_check_vies
|
||||
msgid "Verify VAT Numbers"
|
||||
msgstr "Validiraj porezne brojeve"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_vat
|
||||
#: model_terms:ir.ui.view,arch_db:base_vat.res_config_settings_view_form
|
||||
msgid "Verify VAT numbers using the European VIES service"
|
||||
msgstr "PDV broj [%s] za partnera [%s] ili nije prošao VIES PDV validacionu proveru ili nije poštovao očekivani format %s."
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "XXXXXXXXX [9 digits] and it should respect the Luhn algorithm checksum"
|
||||
msgstr "XXXXXXXXX [9 brojeva] trebalo bi poštivati Luhn algoritam za provjeru"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "either 11 digits for CPF or 14 digits for CNPJ"
|
||||
msgstr "između 11 znamenaka za CPF ili 14 znamenaka za CNPJ"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/account_fiscal_position.py:0
|
||||
#, python-format
|
||||
msgid "fiscal position [%s]"
|
||||
msgstr "fiskalna pozicija [%s]"
|
||||
|
||||
#. module: base_vat
|
||||
#. odoo-python
|
||||
#: code:addons/base_vat/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "partner [%s]"
|
||||
msgstr "partner [%s]"
|
||||
msgstr ""
|
||||
|
|
|
|||
|
|
@ -847,6 +847,37 @@ class ResPartner(models.Model):
|
|||
stdnum_vat_format = stdnum.util.get_cc_module('sm', 'vat').compact
|
||||
return stdnum_vat_format('SM' + vat)[2:]
|
||||
|
||||
def check_vat_tw(self, vat):
|
||||
"""
|
||||
Since Feb. 2025, due to the imminent exhaustion of the UBN numbers, the validation logic was changed from using
|
||||
a division by 10 for the final check to using a division by 5, making numbers that were previously invalid now
|
||||
valid.
|
||||
|
||||
The stdnum implementation of the VAT validation is not up to date with this latest update, so we implement our
|
||||
own validation to support these new valid UBNs.
|
||||
"""
|
||||
vat = stdnum.util.get_cc_module("tw", "vat").compact(vat)
|
||||
if len(vat) != 8:
|
||||
return False # The length is fixed, and we will expect it to be 8 in the following checks.
|
||||
|
||||
logic_multiplier = [1, 2, 1, 2, 1, 2, 4, 1] # This multiplier is set by the official validation logic.
|
||||
# Multiply each of the 8 digits of the VAT number by the corresponding digit of the logic multiplier.
|
||||
# For the next steps, we will need to sum the results.
|
||||
# For a two-digit product like 20, you would add its digits (2 + 0) to the total sum, so we convert the sums here
|
||||
# to strings in order to make it easier later on.
|
||||
products = [str(a * int(b)) for a, b in zip(logic_multiplier, vat)]
|
||||
if vat[6] != '7':
|
||||
# If the 7th number is not 7, we simply sum everything and check that the result is divisible by 5.
|
||||
checksum = sum(int(d) for d in ''.join(products))
|
||||
return checksum % 5 == 0
|
||||
else:
|
||||
# If the 7th number is 7, we calculate two sums:
|
||||
# z1: Calculate the total sum where the 7th position's contribution is taken as 1.
|
||||
# z2: Calculate the total sum where the 7th position's contribution is taken as 0.
|
||||
# The VAT number is valid if either Z1 or Z2 (or both) is evenly divisible by 5.
|
||||
base_checksum = sum(int(d) for d in "".join(products[0:6] + products[7:]))
|
||||
return (base_checksum + 1) % 5 == 0 or base_checksum % 5 == 0
|
||||
|
||||
def _fix_vat_number(self, vat, country_id):
|
||||
code = self.env['res.country'].browse(country_id).code if country_id else False
|
||||
vat_country, vat_number = self._split_vat(vat)
|
||||
|
|
|
|||
|
|
@ -148,6 +148,16 @@ class TestStructure(TransactionCase):
|
|||
with self.assertRaisesRegex(ValidationError, msg):
|
||||
test_partner.write({'vat': '0123457890-11134'})
|
||||
|
||||
def test_vat_tw(self):
|
||||
test_partner = self.env["res.partner"].create({"name": "TW Company", "country_id": self.env.ref("base.tw").id})
|
||||
|
||||
for ubn in ['88117254', '12345601', '90183275']:
|
||||
test_partner.vat = ubn
|
||||
|
||||
for ubn in ['88117250', '12345600', '90183272']:
|
||||
with self.assertRaises(ValidationError):
|
||||
test_partner.vat = ubn
|
||||
|
||||
|
||||
@tagged('-standard', 'external')
|
||||
class TestStructureVIES(TestStructure):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-base_vat"
|
||||
version = "16.0.0"
|
||||
description = "VAT Number Validation - Odoo addon"
|
||||
description = "VAT Number Validation -
|
||||
Odoo addon
|
||||
"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
|
|
@ -16,7 +18,7 @@ classifiers = [
|
|||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue