forked from OCA/account-financial-tools
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1639 from OCA/16.0
Syncing from upstream OCA/account-financial-tools (16.0)
- Loading branch information
Showing
18 changed files
with
190 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 | ||
~~~~~~~~~~~ | ||
|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
* Harald Panten <[email protected]> | ||
* Eduardo de Miguel <[email protected]> | ||
* Emilio Pascual <[email protected]> | ||
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.