2
0

Merge PR #1722 into 16.0

Signed-off-by rafaelbn
This commit is contained in:
OCA-git-bot 2023-09-28 15:48:01 +00:00
commit 1450617119
9 changed files with 157 additions and 6 deletions

View File

@ -3,13 +3,17 @@
# Copyright 2017 Tecnativa - David Vidal # Copyright 2017 Tecnativa - David Vidal
# Copyright 2019 FactorLibre - Rodrigo Bonilla # Copyright 2019 FactorLibre - Rodrigo Bonilla
# Copyright 2022 Moduon - Eduardo de Miguel # Copyright 2022 Moduon - Eduardo de Miguel
# Copyright 2023 Moduon - Emilio Pascual
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{ {
"name": "Optional validation of VAT via VIES", "name": "Optional validation of VAT via VIES",
"category": "Accounting", "category": "Accounting",
"version": "16.0.1.0.1", "version": "16.0.1.0.1",
"depends": ["base_vat"], "depends": ["base_vat"],
"data": ["views/res_partner_view.xml"], "data": [
"views/res_partner_view.xml",
"views/res_config_settings_view.xml",
],
"author": "Tecnativa," "Odoo Community Association (OCA)", "author": "Tecnativa," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools", "website": "https://github.com/OCA/account-financial-tools",
"license": "AGPL-3", "license": "AGPL-3",

View File

@ -4,8 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 16.0\n" "Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-18 07:12+0000\n"
"PO-Revision-Date: 2023-09-18 07:12+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -13,6 +15,16 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid "Compute check vies"
msgstr ""
#. module: base_vat_optional_vies
#: model:ir.model,name:base_vat_optional_vies.model_res_config_settings
msgid "Config Settings"
msgstr ""
#. module: base_vat_optional_vies #. module: base_vat_optional_vies
#: model:ir.model,name:base_vat_optional_vies.model_res_partner #: model:ir.model,name:base_vat_optional_vies.model_res_partner
msgid "Contact" msgid "Contact"
@ -27,8 +39,22 @@ msgid ""
"Note: the expected format is %(expected_format)s" "Note: the expected format is %(expected_format)s"
msgstr "" msgstr ""
#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid ""
"This process can take a long time. Are you sure you want to start the "
"process?"
msgstr ""
#. module: base_vat_optional_vies #. module: base_vat_optional_vies
#: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_partner__vies_passed #: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_partner__vies_passed
#: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_users__vies_passed #: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_users__vies_passed
msgid "VIES validation" msgid "VIES validation"
msgstr "" msgstr ""
#. module: base_vat_optional_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 ""

View File

@ -6,15 +6,26 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 12.0\n" "Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-04-17 10:18+0000\n" "POT-Creation-Date: 2023-09-18 07:12+0000\n"
"Last-Translator: gelo joga Rodríguez <gelo.joga@factorlibre.com>\n" "PO-Revision-Date: 2023-09-18 09:17+0200\n"
"Last-Translator: Emilio Pascual <emilio@moduom.team>\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n" "Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.14.1\n" "X-Generator: Poedit 3.3.1\n"
#. module: base_vat_optional_vies
#: model_terms:ir.ui.view,arch_db:base_vat_optional_vies.res_config_settings_view_form
msgid "Compute check vies"
msgstr "Calcular comprobación VIES"
#. module: base_vat_optional_vies
#: model:ir.model,name:base_vat_optional_vies.model_res_config_settings
msgid "Config Settings"
msgstr "Opciones de configuración"
#. module: base_vat_optional_vies #. module: base_vat_optional_vies
#: model:ir.model,name:base_vat_optional_vies.model_res_partner #: model:ir.model,name:base_vat_optional_vies.model_res_partner
@ -33,8 +44,23 @@ msgstr ""
"El NIF [%(wrong_vat)s] para %(record_label)s parece no ser válido. \n" "El NIF [%(wrong_vat)s] para %(record_label)s parece no ser válido. \n"
"Nota: El formato esperado es %(expected_format)s" "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 ""
"This process can take a long time. Are you sure you want to start the "
"process?"
msgstr ""
"Este proceso puede tardar. ¿Está seguro que quiere iniciar el proceso?"
#. module: base_vat_optional_vies #. module: base_vat_optional_vies
#: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_partner__vies_passed #: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_partner__vies_passed
#: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_users__vies_passed #: model:ir.model.fields,field_description:base_vat_optional_vies.field_res_users__vies_passed
msgid "VIES validation" msgid "VIES validation"
msgstr "Validación automática VIES" msgstr "Validación automática VIES"
#. module: base_vat_optional_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"

View File

@ -1 +1,2 @@
from . import res_partner from . import res_partner
from . import res_config_settings

View File

@ -0,0 +1,21 @@
# Copyright 2022-2023 Moduon Team S.L. <info@moduon.team>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, models
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()
return {
"effect": {
"fadeout": "slow",
"message": _("Vies passed calculated in %s partners") % count_partners,
"img_url": "/web/static/img/smile.svg",
"type": "rainbow_man",
}
}

View File

@ -2,6 +2,7 @@
# Copyright 2017 Tecnativa - David Vidal # Copyright 2017 Tecnativa - David Vidal
# Copyright 2019 FactorLibre - Rodrigo Bonilla # Copyright 2019 FactorLibre - Rodrigo Bonilla
# Copyright 2022 Moduon - Eduardo de Miguel # Copyright 2022 Moduon - Eduardo de Miguel
# Copyright 2023 Moduon - Emilio Pascual
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import _, api, fields, models from odoo import _, api, fields, models

View File

@ -6,3 +6,4 @@
* Alexandre Díaz <alexandre.diaz@tecnativa.com> * Alexandre Díaz <alexandre.diaz@tecnativa.com>
* Harald Panten <harald.panten@sygel.es> * Harald Panten <harald.panten@sygel.es>
* Eduardo de Miguel <edu@moduon.team> * Eduardo de Miguel <edu@moduon.team>
* Emilio Pascual <emilio@moduon.team>

View File

@ -0,0 +1,44 @@
# Copyright 2022-2023 Moduon Team S.L. <info@moduon.team>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from unittest import mock
from odoo.tests import common
class TestConfigSettings(common.TransactionCase):
def setUp(self):
super(TestConfigSettings, self).setUp()
self.company = self.env.user.company_id
self.partner1_test = self.env["res.partner"].create(
{
"name": "Test partner",
"is_company": True,
"vat": "ESB87530432",
"country_id": self.env.ref("base.be").id,
}
)
self.partner2_test = self.env["res.partner"].create(
{
"name": "Test partner2",
"is_company": True,
"vat": "ESB87530432",
}
)
self.vatnumber_path = "odoo.addons.base_vat.models.res_partner.check_vies"
def test_execute_update_check_vies_validate(self):
with mock.patch(self.vatnumber_path) as mock_vatnumber:
self.company.vat_check_vies = True
mock_vatnumber.check_vies.return_value = True
self.env["res.config.settings"].execute_update_check_vies()
self.assertTrue(self.partner1_test.vies_passed)
self.assertFalse(self.partner2_test.vies_passed)
def test_execute_update_check_vies_no_validate(self):
with mock.patch(self.vatnumber_path) as mock_vatnumber:
self.company.vat_check_vies = False
mock_vatnumber.check_vies.return_value = False
self.env["res.config.settings"].execute_update_check_vies()
self.assertFalse(self.partner1_test.vies_passed)
self.assertFalse(self.partner2_test.vies_passed)

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2023 Moduon Team S.L.
License Other proprietary
-->
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.account</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_vat.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath
expr="//div[@id='vies_service_setting']/div[hasclass('o_setting_right_pane')]"
position="inside"
>
<button
type="object"
name="execute_update_check_vies"
string="Compute check vies"
class="oe_link"
icon="fa-arrow-right"
confirm="This process can take a long time. Are you sure you want to start the process?"
attrs="{'invisible': [('vat_check_vies', '=', False)]}"
/>
</xpath>
</field>
</record>
</odoo>