Skip to content

Commit 12f843c

Browse files
committed
[MIG] l10n_es_facturae_face: Migration to 19.0
1 parent b26b5e5 commit 12f843c

11 files changed

Lines changed: 77 additions & 50 deletions

l10n_es_facturae_face/README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ Envío de Facturae a FACe
2121
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
2222
:alt: License: AGPL-3
2323
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github
24-
:target: https://github.com/OCA/l10n-spain/tree/18.0/l10n_es_facturae_face
24+
:target: https://github.com/OCA/l10n-spain/tree/19.0/l10n_es_facturae_face
2525
:alt: OCA/l10n-spain
2626
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
27-
:target: https://translation.odoo-community.org/projects/l10n-spain-18-0/l10n-spain-18-0-l10n_es_facturae_face
27+
:target: https://translation.odoo-community.org/projects/l10n-spain-19-0/l10n-spain-19-0-l10n_es_facturae_face
2828
:alt: Translate me on Weblate
2929
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
30-
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=18.0
30+
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&target_branch=19.0
3131
:alt: Try me on Runboat
3232

3333
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -130,7 +130,7 @@ Bug Tracker
130130
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-spain/issues>`_.
131131
In case of trouble, please check there if your issue has already been reported.
132132
If you spotted it first, help us to smash it by providing a detailed and welcomed
133-
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_facturae_face%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
133+
`feedback <https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_facturae_face%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
134134

135135
Do not contact contributors directly about support or help with technical issues.
136136

@@ -149,6 +149,7 @@ Contributors
149149
- Eric Antones <eantones@nuobit.com>
150150
- Manuel Regidor <manuel.regidor@sygel.es>
151151
- Valentín Vinagre <valentin.vinagre@sygel.es>
152+
- Alex Garcia <alex@studio73.es>
152153

153154
Maintainers
154155
-----------
@@ -171,6 +172,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
171172

172173
|maintainer-etobella|
173174

174-
This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/18.0/l10n_es_facturae_face>`_ project on GitHub.
175+
This module is part of the `OCA/l10n-spain <https://github.com/OCA/l10n-spain/tree/19.0/l10n_es_facturae_face>`_ project on GitHub.
175176

176177
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

l10n_es_facturae_face/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
{
55
"name": "Envío de Facturae a FACe",
6-
"version": "18.0.1.0.1",
6+
"version": "19.0.1.0.0",
77
"author": "Creu Blanca, Odoo Community Association (OCA)",
88
"category": "Accounting & Finance",
99
"website": "https://github.com/OCA/l10n-spain",

l10n_es_facturae_face/models/account_move.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
33

44

5-
from odoo import _, api, fields, models
5+
from odoo import api, fields, models
66
from odoo.exceptions import UserError, ValidationError
77

88

@@ -60,7 +60,7 @@ def _edi_create_exchange_record_vals(self, exchange_type):
6060
self.env.ref("l10n_es_facturae_face.face_backend"),
6161
)
6262
if not related_record:
63-
raise UserError(_("Exchange record cannot be found for FACe"))
63+
raise UserError(self.env._("Exchange record cannot be found for FACe"))
6464
result.update(
6565
{"edi_exchange_state": "input_pending", "parent_id": related_record.id}
6666
)
@@ -107,17 +107,17 @@ def validate_facturae_fields(self):
107107
self.partner_id.l10n_es_facturae_sending_code == "face"
108108
and not self.partner_id.organo_gestor
109109
):
110-
raise ValidationError(_("Organo Gestor not provided"))
110+
raise ValidationError(self.env._("Organo Gestor not provided"))
111111
if (
112112
self.partner_id.l10n_es_facturae_sending_code == "face"
113113
and not self.partner_id.unidad_tramitadora
114114
):
115-
raise ValidationError(_("Unidad Tramitadora not provided"))
115+
raise ValidationError(self.env._("Unidad Tramitadora not provided"))
116116
if (
117117
self.partner_id.l10n_es_facturae_sending_code == "face"
118118
and not self.partner_id.oficina_contable
119119
):
120-
raise ValidationError(_("Oficina Contable not provided"))
120+
raise ValidationError(self.env._("Oficina Contable not provided"))
121121
return
122122

123123
def _get_l10n_es_facturae_face_backend(self):

l10n_es_facturae_face/models/edi_exchange_record.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from zeep import helpers
99

10-
from odoo import _, fields, models
10+
from odoo import fields, models
1111

1212
_logger = logging.getLogger(__name__)
1313

@@ -84,7 +84,7 @@ def _cron_face_update_method(self, company_domain=False, limit=None, days_limit=
8484
exchanges,
8585
)
8686
if response.resultado.codigo != "0":
87-
_logger.info(_("Company %s cannot be processed") % company.display_name)
87+
_logger.info("Company %s cannot be processed", company.display_name)
8888
continue
8989
for invoice in response.facturas.consultarListadoFactura:
9090
exchange_record = exchange_dict[invoice.factura.numeroRegistro]

l10n_es_facturae_face/models/l10n_es_facturae_face_base_handler.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ def send_webservice(
5959
email, invoice_file, anexos
6060
)
6161
response = client.service.enviarFactura(invoice_call)
62+
if not response:
63+
raise ValidationError(
64+
self.env._("No response received from FACe webservice")
65+
)
6266
if response.resultado.codigo != "0":
6367
raise ValidationError(response.resultado.descripcion)
6468
return response
@@ -75,14 +79,14 @@ def consult_invoices(self, public_crt, private_key, invoices):
7579
def cancel(self, public_crt, private_key, identifier, motive):
7680
client = self._get_client(public_crt, private_key)
7781
response = client.service.anularFactura(identifier, motive)
82+
if not response:
83+
raise UserError(self.env._("No response received from FACe webservice"))
7884
if response.resultado.codigo != "0":
7985
raise UserError(
8086
self.env._(
81-
"Connection with FACe returned error %(code)s - %(description)s"
87+
"Connection with FACe returned error %(code)s - %(description)s",
88+
code=response.resultado.codigo,
89+
description=response.resultado.descripcion,
8290
)
83-
% {
84-
"code": response.resultado.codigo,
85-
"description": response.resultado.descripcion,
86-
}
8791
)
8892
return response

l10n_es_facturae_face/models/l10n_es_facturae_face_update_handler.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ def receive(self, exchange_record):
3232
if response.resultado.codigo != "0":
3333
raise UserError(
3434
self.env._(
35-
"Connection with FACe returned error %(code)s - %(description)s"
35+
"Connection with FACe returned error %(code)s - %(description)s",
36+
code=response.resultado.codigo,
37+
description=response.resultado.descripcion,
3638
)
37-
% {
38-
"code": response.resultado.codigo,
39-
"description": response.resultado.descripcion,
40-
}
4139
)
4240
return json.dumps(helpers.serialize_object(response.factura))
4341

4442
def process(self, exchange_record):
4543
data = json.loads(exchange_record._get_file_content())
4644
parent = exchange_record.parent_id
47-
process_code = "face-" + data["tramitacion"]["codigo"]
48-
revocation_code = "face-" + data["anulacion"]["codigo"]
45+
tramitacion = data.get("tramitacion") or {}
46+
anulacion = data.get("anulacion") or {}
47+
process_code = "face-" + tramitacion.get("codigo", "")
48+
revocation_code = "face-" + anulacion.get("codigo", "")
4949
if (
5050
process_code == parent.l10n_es_facturae_status
5151
and revocation_code == parent.l10n_es_facturae_cancellation_status
@@ -54,9 +54,9 @@ def process(self, exchange_record):
5454
parent.write(
5555
{
5656
"l10n_es_facturae_status": process_code,
57-
"l10n_es_facturae_motive": data["tramitacion"]["motivo"],
57+
"l10n_es_facturae_motive": tramitacion.get("motivo", ""),
5858
"l10n_es_facturae_cancellation_status": revocation_code,
59-
"l10n_es_facturae_cancellation_motive": data["anulacion"]["motivo"],
59+
"l10n_es_facturae_cancellation_motive": anulacion.get("motivo", ""),
6060
}
6161
)
6262
exchange_record.record.write(

l10n_es_facturae_face/models/res_company.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import re
55

6-
from odoo import _, api, fields, models
6+
from odoo import api, fields, models
77
from odoo.exceptions import ValidationError
88

99

@@ -19,4 +19,4 @@ def check_face_email(self):
1919
"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$)",
2020
record.face_email,
2121
):
22-
raise ValidationError(_("Invalid facturae email"))
22+
raise ValidationError(self.env._("Invalid facturae email"))

l10n_es_facturae_face/models/res_partner.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
33

44

5-
from odoo import _, api, exceptions, fields, models
5+
from odoo import api, exceptions, fields, models
66

77

88
class ResPartner(models.Model):
@@ -30,18 +30,20 @@ def _constrain_l10n_es_facturae_sending_code_face(self):
3030
continue
3131
if not record.facturae:
3232
raise exceptions.ValidationError(
33-
_("Facturae must be selected in order to send to FACe")
33+
self.env._("Facturae must be selected in order to send to FACe")
3434
)
3535
if not record.vat:
3636
raise exceptions.ValidationError(
37-
_("Vat must be defined in order to send to FACe")
37+
self.env._("Vat must be defined in order to send to FACe")
3838
)
3939
if not record.country_id:
4040
raise exceptions.ValidationError(
41-
_("Country must be defined in order to send to FACe")
41+
self.env._("Country must be defined in order to send to FACe")
4242
)
4343
if record.country_id.code_alpha3 == "ESP":
4444
if not record.state_id:
4545
raise exceptions.ValidationError(
46-
_("State must be defined in Spain in order to send to FACe")
46+
self.env._(
47+
"State must be defined in Spain in order to send to FACe"
48+
)
4749
)

l10n_es_facturae_face/readme/CONTRIBUTORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
- Eric Antones \<<eantones@nuobit.com>\>
33
- Manuel Regidor \<<manuel.regidor@sygel.es>\>
44
- Valentín Vinagre \<<valentin.vinagre@sygel.es>\>
5+
- Alex Garcia \<<alex@studio73.es>\>

l10n_es_facturae_face/static/description/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ <h1>Envío de Facturae a FACe</h1>
374374
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375375
!! source digest: sha256:817e060f1babd121176557da4bbcfc06107620aec59a159bf1ff9f0dfb8d59a4
376376
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377-
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/18.0/l10n_es_facturae_face"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-18-0/l10n-spain-18-0-l10n_es_facturae_face"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
377+
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-spain/tree/19.0/l10n_es_facturae_face"><img alt="OCA/l10n-spain" src="https://img.shields.io/badge/github-OCA%2Fl10n--spain-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-spain-19-0/l10n-spain-19-0-l10n_es_facturae_face"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-spain&amp;target_branch=19.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378378
<p>Este módulo permite la gestión del envío de la facturación electrónica
379379
española a FACe. La gestión del envío se realiza mediante los
380380
certificados con los que se firma.</p>
@@ -485,7 +485,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Bug Tracker</a></h2>
485485
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-spain/issues">GitHub Issues</a>.
486486
In case of trouble, please check there if your issue has already been reported.
487487
If you spotted it first, help us to smash it by providing a detailed and welcomed
488-
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_facturae_face%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
488+
<a class="reference external" href="https://github.com/OCA/l10n-spain/issues/new?body=module:%20l10n_es_facturae_face%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
489489
<p>Do not contact contributors directly about support or help with technical issues.</p>
490490
</div>
491491
<div class="section" id="credits">
@@ -503,6 +503,7 @@ <h3><a class="toc-backref" href="#toc-entry-9">Contributors</a></h3>
503503
<li>Eric Antones &lt;<a class="reference external" href="mailto:eantones&#64;nuobit.com">eantones&#64;nuobit.com</a>&gt;</li>
504504
<li>Manuel Regidor &lt;<a class="reference external" href="mailto:manuel.regidor&#64;sygel.es">manuel.regidor&#64;sygel.es</a>&gt;</li>
505505
<li>Valentín Vinagre &lt;<a class="reference external" href="mailto:valentin.vinagre&#64;sygel.es">valentin.vinagre&#64;sygel.es</a>&gt;</li>
506+
<li>Alex Garcia &lt;<a class="reference external" href="mailto:alex&#64;studio73.es">alex&#64;studio73.es</a>&gt;</li>
506507
</ul>
507508
</div>
508509
<div class="section" id="maintainers">
@@ -516,7 +517,7 @@ <h3><a class="toc-backref" href="#toc-entry-10">Maintainers</a></h3>
516517
promote its widespread use.</p>
517518
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
518519
<p><a class="reference external image-reference" href="https://github.com/etobella"><img alt="etobella" src="https://github.com/etobella.png?size=40px" /></a></p>
519-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/18.0/l10n_es_facturae_face">OCA/l10n-spain</a> project on GitHub.</p>
520+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-spain/tree/19.0/l10n_es_facturae_face">OCA/l10n-spain</a> project on GitHub.</p>
520521
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
521522
</div>
522523
</div>

0 commit comments

Comments
 (0)