Skip to content

Commit

Permalink
Merge pull request #1639 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/account-financial-tools (16.0)
  • Loading branch information
bt-admin authored Nov 13, 2024
2 parents 35a2196 + 7401246 commit afc7da2
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 154 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ addon | version | maintainers | summary
[account_spread_cost_revenue](account_spread_cost_revenue/) | 16.0.1.0.1 | | Spread costs and revenues over a custom period
[account_template_active](account_template_active/) | 16.0.1.0.1 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Allow to disable / enable account template items (tax, fiscal position, account)
[account_usability](account_usability/) | 16.0.1.0.3 | [![legalsylvain](https://github.com/legalsylvain.png?size=30px)](https://github.com/legalsylvain) | Adds missing menu entries for Account module and adds the option to enable Saxon Accounting
[base_vat_optional_vies](base_vat_optional_vies/) | 16.0.1.1.0 | | Optional validation of VAT via VIES
[base_vat_optional_vies](base_vat_optional_vies/) | 16.0.1.1.1 | [![yajo](https://github.com/yajo.png?size=30px)](https://github.com/yajo) [![rafaelbn](https://github.com/rafaelbn.png?size=30px)](https://github.com/rafaelbn) | Optional validation of VAT via VIES
[stock_account_anglo_saxon_cogs_kit](stock_account_anglo_saxon_cogs_kit/) | 16.0.2.0.0 | [![MarinaAForgeFlow](https://github.com/MarinaAForgeFlow.png?size=30px)](https://github.com/MarinaAForgeFlow) [![AaronHForgeFlow](https://github.com/AaronHForgeFlow.png?size=30px)](https://github.com/AaronHForgeFlow) | Stock Account Anglo Saxon COGS Kit

[//]: # (end addons)
Expand Down
16 changes: 14 additions & 2 deletions base_vat_optional_vies/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Optional validation of VAT via VIES
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:cf3cd94c0a395c42415001a53bec5b0c5ee7c525b4cc8e5f45bd8722cc6066c7
!! source digest: sha256:fea220c75263038de9d11a233571b52dabea45731c05b55a60ced03718ab7997
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -32,7 +32,7 @@ This module extends base_vat module features allowing to know if VIES
validation was passed or not.

Then you can use "VIES validation passed" field in order to show VAT ID with
or without country preffix in invoices, for instance.
or without country prefix in invoices, for instance.

*NOTE*: Although VIES validation is set in your company, this validation
will not block VAT ID write (main difference to Odoo standard behavior) if this
Expand Down Expand Up @@ -97,6 +97,7 @@ Contributors
* Harald Panten <[email protected]>
* Eduardo de Miguel <[email protected]>
* Emilio Pascual <[email protected]>
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__)

Maintainers
~~~~~~~~~~~
Expand All @@ -111,6 +112,17 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

.. |maintainer-yajo| image:: https://github.com/yajo.png?size=40px
:target: https://github.com/yajo
:alt: yajo
.. |maintainer-rafaelbn| image:: https://github.com/rafaelbn.png?size=40px
:target: https://github.com/rafaelbn
:alt: rafaelbn

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-yajo| |maintainer-rafaelbn|

This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/16.0/base_vat_optional_vies>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 2 additions & 1 deletion base_vat_optional_vies/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"name": "Optional validation of VAT via VIES",
"category": "Accounting",
"version": "16.0.1.1.0",
"version": "16.0.1.1.1",
"depends": ["base_vat"],
"data": [
"views/res_partner_view.xml",
Expand All @@ -17,5 +17,6 @@
"author": "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",
"license": "AGPL-3",
"maintainers": ["yajo", "rafaelbn"],
"installable": True,
}
12 changes: 2 additions & 10 deletions base_vat_optional_vies/i18n/base_vat_optional_vies.pot
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ msgstr ""
msgid "Contact"
msgstr ""

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -54,5 +45,6 @@ msgstr ""
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgid ""
"Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""
29 changes: 15 additions & 14 deletions base_vat_optional_vies/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ msgstr "Opciones de configuración"
msgid "Contact"
msgstr "Contacto"

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
"valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""
"El NIF [%(wrong_vat)s] para %(record_label)s parece no ser válido. \n"
"Nota: El formato esperado es %(expected_format)s"

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -61,5 +49,18 @@ msgstr "Validación automática VIES"
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgstr "Validación automática VIES calculada para %s contactos"
msgid "Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""

#, python-format
#~ msgid ""
#~ "The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
#~ "valid. \n"
#~ "Note: the expected format is %(expected_format)s"
#~ msgstr ""
#~ "El NIF [%(wrong_vat)s] para %(record_label)s parece no ser válido. \n"
#~ "Nota: El formato esperado es %(expected_format)s"

#, python-format
#~ msgid "Vies passed calculated in %s partners"
#~ msgstr "Validación automática VIES calculada para %s contactos"
29 changes: 15 additions & 14 deletions base_vat_optional_vies/i18n/hr.po
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,6 @@ msgstr "Konfiguracijske postavke"
msgid "Contact"
msgstr "Kontakt"

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
"valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""
"Porezni broj [%(wrong_vat)s] za %(record_label)s se čini neispravan. \n"
"Napomena: očekivani format je %(expected_format)s"

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -63,5 +51,18 @@ msgstr "VIES Provjera"
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgstr "Vies prošao izračunato na %s partnera"
msgid "Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""

#, python-format
#~ msgid ""
#~ "The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
#~ "valid. \n"
#~ "Note: the expected format is %(expected_format)s"
#~ msgstr ""
#~ "Porezni broj [%(wrong_vat)s] za %(record_label)s se čini neispravan. \n"
#~ "Napomena: očekivani format je %(expected_format)s"

#, python-format
#~ msgid "Vies passed calculated in %s partners"
#~ msgstr "Vies prošao izračunato na %s partnera"
30 changes: 16 additions & 14 deletions base_vat_optional_vies/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ msgstr "Impostazioni configurazione"
msgid "Contact"
msgstr "Contatto"

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""
"La partita IVA [%(wrong_vat)s] per %(record_label)s non sembra essere "
"valida. \n"
"Nota: il formato atteso è %(expected_format)s"

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -61,5 +49,19 @@ msgstr "Validazione VIES"
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgstr "VIES validato calcolato per %s partner"
msgid "Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""

#, python-format
#~ msgid ""
#~ "The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
#~ "valid. \n"
#~ "Note: the expected format is %(expected_format)s"
#~ msgstr ""
#~ "La partita IVA [%(wrong_vat)s] per %(record_label)s non sembra essere "
#~ "valida. \n"
#~ "Nota: il formato atteso è %(expected_format)s"

#, python-format
#~ msgid "Vies passed calculated in %s partners"
#~ msgstr "VIES validato calcolato per %s partner"
30 changes: 16 additions & 14 deletions base_vat_optional_vies/i18n/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ msgstr "Configuratie instellingen"
msgid "Contact"
msgstr "Contact"

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""
"Het BTW-nummer [%(wrong_vat)s] voor %(record_label)s lijkt niet geldig te "
"zijn. \n"
"Opmerking: het verwachte formaat is %(expected_format)s"

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -61,5 +49,19 @@ msgstr "VIES-validatie"
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgstr "VIES geslaagde berekening in %s partners"
msgid "Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""

#, python-format
#~ msgid ""
#~ "The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
#~ "valid. \n"
#~ "Note: the expected format is %(expected_format)s"
#~ msgstr ""
#~ "Het BTW-nummer [%(wrong_vat)s] voor %(record_label)s lijkt niet geldig te "
#~ "zijn. \n"
#~ "Opmerking: het verwachte formaat is %(expected_format)s"

#, python-format
#~ msgid "Vies passed calculated in %s partners"
#~ msgstr "VIES geslaagde berekening in %s partners"
23 changes: 10 additions & 13 deletions base_vat_optional_vies/i18n/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ msgstr ""
msgid "Contact"
msgstr "Contacto"

#. module: base_vat_optional_vies
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_partner.py:0
#, python-format
msgid ""
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
"valid. \n"
"Note: the expected format is %(expected_format)s"
msgstr ""
"O NIF [%(wrong_vat)s] para %(record_label)s não parece válido. \n"
"Nota: o formato esperado é %(expected_format)s"

#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
Expand All @@ -60,5 +48,14 @@ msgstr "Validação do VIES"
#. odoo-python
#: code:addons/base_vat_optional_vies/models/res_config_settings.py:0
#, python-format
msgid "Vies passed calculated in %s partners"
msgid "Vies passed calculated in %(partners)d partners (%(failures)d failures)"
msgstr ""

#, python-format
#~ msgid ""
#~ "The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be "
#~ "valid. \n"
#~ "Note: the expected format is %(expected_format)s"
#~ msgstr ""
#~ "O NIF [%(wrong_vat)s] para %(record_label)s não parece válido. \n"
#~ "Nota: o formato esperado é %(expected_format)s"
29 changes: 25 additions & 4 deletions base_vat_optional_vies/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
# Copyright 2022-2023 Moduon Team S.L. <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from logging import getLogger

from odoo import _, models
from odoo.exceptions import ValidationError

_logger = getLogger(__name__)


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

def execute_update_check_vies(self):
# Only parent partners, children are synced from parent
count_partners = self.env["res.partner"].search_count([])
self.env["res.partner"].search([]).check_vat()
"""Bulk VAT check on company partners."""
partners = self.env["res.partner"].search(
[
("is_company", "=", True),
("parent_id", "=", False),
("vat", "!=", False),
("vies_passed", "=", False),
]
)
failures = 0
for partner in partners:
try:
partner.check_vat()
except ValidationError:
_logger.warning("VAT check failed for %r", partner, exc_info=True)
failures += 1
return {
"effect": {
"fadeout": "slow",
"message": _("Vies passed calculated in %s partners") % count_partners,
"message": _(
"Vies passed calculated in %(partners)d partners (%(failures)d failures)",
partners=len(partners),
failures=failures,
),
"img_url": "/web/static/img/smile.svg",
"type": "rainbow_man",
}
Expand Down
16 changes: 1 addition & 15 deletions base_vat_optional_vies/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
# Copyright 2022 Moduon - Eduardo de Miguel
# Copyright 2023 Moduon - Emilio Pascual
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models

from odoo.addons.base_vat.models.res_partner import _ref_vat
from odoo import api, fields, models


class ResPartner(models.Model):
Expand Down Expand Up @@ -61,15 +59,3 @@ def _onchange_check_vies(self):
return super(
ResPartner, self.with_context(vat_partner=self)
)._onchange_check_vies()

@api.model
def _build_vat_error_message(self, country_code, wrong_vat, record_label):
return "\n" + _(
"The VAT number [%(wrong_vat)s] for %(record_label)s does not seem to be valid. "
"\nNote: the expected format is %(expected_format)s",
wrong_vat=wrong_vat,
record_label=record_label,
expected_format=_ref_vat.get(
country_code, "'CC##' (CC=Country Code, ##=VAT Number)"
),
)
1 change: 1 addition & 0 deletions base_vat_optional_vies/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
* Harald Panten <[email protected]>
* Eduardo de Miguel <[email protected]>
* Emilio Pascual <[email protected]>
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
2 changes: 1 addition & 1 deletion base_vat_optional_vies/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ This module extends base_vat module features allowing to know if VIES
validation was passed or not.

Then you can use "VIES validation passed" field in order to show VAT ID with
or without country preffix in invoices, for instance.
or without country prefix in invoices, for instance.

*NOTE*: Although VIES validation is set in your company, this validation
will not block VAT ID write (main difference to Odoo standard behavior) if this
Expand Down
Loading

0 comments on commit afc7da2

Please sign in to comment.