From 847deffd88d3ab150f2c75af7dd06e0488c86310 Mon Sep 17 00:00:00 2001 From: Borruso Date: Fri, 24 Feb 2023 10:15:13 +0100 Subject: [PATCH] [MIG] l10n_it_fatturapa_pec: Migration to 16.0 --- l10n_it_fatturapa_pec/README.rst | 15 ++++++------- l10n_it_fatturapa_pec/__manifest__.py | 9 ++++++-- .../data/config_parameter.xml | 14 ++++++------- l10n_it_fatturapa_pec/data/fetchmail_data.xml | 14 ++++++------- .../migrations/14.0.1.0.4/pre-migration.py | 18 ---------------- .../models/fatturapa_attachment_out.py | 2 +- l10n_it_fatturapa_pec/models/fetchmail.py | 6 ++++-- l10n_it_fatturapa_pec/models/mail_thread.py | 19 +++++++++-------- l10n_it_fatturapa_pec/models/sdi.py | 18 ++++++++++++---- l10n_it_fatturapa_pec/readme/CONTRIBUTORS.rst | 1 + .../static/description/index.html | 9 ++++---- .../tests/e_invoice_common.py | 21 +++++++++++-------- .../tests/test_e_invoice_response.py | 4 +--- .../tests/test_e_invoice_send.py | 6 ++++++ .../views/fatturapa_attachment_out.xml | 16 +++++++++----- .../views/fetchmail_view.xml | 2 +- requirements.txt | 1 + 17 files changed, 96 insertions(+), 79 deletions(-) delete mode 100644 l10n_it_fatturapa_pec/migrations/14.0.1.0.4/pre-migration.py diff --git a/l10n_it_fatturapa_pec/README.rst b/l10n_it_fatturapa_pec/README.rst index 6f22244211dd..0c3e8044e2c9 100644 --- a/l10n_it_fatturapa_pec/README.rst +++ b/l10n_it_fatturapa_pec/README.rst @@ -14,14 +14,14 @@ ITA - Fattura elettronica - Supporto PEC :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github - :target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_fatturapa_pec + :target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_fatturapa_pec :alt: OCA/l10n-italy .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_fatturapa_pec + :target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_fatturapa_pec :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/122/14.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-italy&target_branch=16.0 + :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -128,7 +128,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -155,6 +155,7 @@ Contributors * `Ooops `_: * Giovanni Serra +* Giuseppe Borruso Maintainers ~~~~~~~~~~~ @@ -169,6 +170,6 @@ 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. -This module is part of the `OCA/l10n-italy `_ project on GitHub. +This module is part of the `OCA/l10n-italy `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/l10n_it_fatturapa_pec/__manifest__.py b/l10n_it_fatturapa_pec/__manifest__.py index 1b286b232fbf..e28e8c04863f 100644 --- a/l10n_it_fatturapa_pec/__manifest__.py +++ b/l10n_it_fatturapa_pec/__manifest__.py @@ -8,14 +8,14 @@ { "name": "ITA - Fattura elettronica - Supporto PEC", - "version": "14.0.1.1.0", + "version": "16.0.1.0.0", "category": "Localization/Italy", "summary": "Invio fatture elettroniche tramite PEC", "author": "Openforce Srls Unipersonale, Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-italy", "license": "AGPL-3", "depends": [ - "fetchmail", + "mail", "l10n_it_fatturapa_out", "l10n_it_fatturapa_in", "l10n_it_sdi_channel", @@ -34,4 +34,9 @@ "data/sdi_channel_demo.xml", ], "installable": True, + "external_dependencies": { + "python": [ + "mock", + ], + }, } diff --git a/l10n_it_fatturapa_pec/data/config_parameter.xml b/l10n_it_fatturapa_pec/data/config_parameter.xml index 61bac2da595a..f58dacbd064d 100644 --- a/l10n_it_fatturapa_pec/data/config_parameter.xml +++ b/l10n_it_fatturapa_pec/data/config_parameter.xml @@ -1,9 +1,9 @@ - - - - sdi.pec.first.address - sdi01@pec.fatturapa.it - - + + + + sdi.pec.first.address + sdi01@pec.fatturapa.it + + diff --git a/l10n_it_fatturapa_pec/data/fetchmail_data.xml b/l10n_it_fatturapa_pec/data/fetchmail_data.xml index 37a040ebc41b..f4e3efc43986 100644 --- a/l10n_it_fatturapa_pec/data/fetchmail_data.xml +++ b/l10n_it_fatturapa_pec/data/fetchmail_data.xml @@ -1,9 +1,9 @@ - - - - fetchmail.pec.max.retry - 5 - - + + + + fetchmail.pec.max.retry + 5 + + diff --git a/l10n_it_fatturapa_pec/migrations/14.0.1.0.4/pre-migration.py b/l10n_it_fatturapa_pec/migrations/14.0.1.0.4/pre-migration.py deleted file mode 100644 index 37cd3f8b8510..000000000000 --- a/l10n_it_fatturapa_pec/migrations/14.0.1.0.4/pre-migration.py +++ /dev/null @@ -1,18 +0,0 @@ -from openupgradelib.openupgrade import rename_xmlids - - -def migrate(cr, version): - - rename_xmlids( - cr, - [ - ( - "l10n_it_sdi_channel.sdi_pec_first_address", - "l10n_it_fatturapa_pec.sdi_pec_first_address", - ), - ( - "l10n_it_sdi_channel.sdi_channel_pec", - "l10n_it_fatturapa_pec.sdi_channel_pec", - ), - ], - ) diff --git a/l10n_it_fatturapa_pec/models/fatturapa_attachment_out.py b/l10n_it_fatturapa_pec/models/fatturapa_attachment_out.py index 350932bcef6b..67bd0aebc67f 100644 --- a/l10n_it_fatturapa_pec/models/fatturapa_attachment_out.py +++ b/l10n_it_fatturapa_pec/models/fatturapa_attachment_out.py @@ -28,7 +28,7 @@ class FatturaPAAttachmentOut(models.Model): default="No response yet", readonly=True, ) - sending_user = fields.Many2one("res.users", "Sending User", readonly=True) + sending_user = fields.Many2one("res.users", readonly=True) @api.model def _check_fetchmail(self): diff --git a/l10n_it_fatturapa_pec/models/fetchmail.py b/l10n_it_fatturapa_pec/models/fetchmail.py index a24bc898c299..ceb5352b0c4a 100644 --- a/l10n_it_fatturapa_pec/models/fetchmail.py +++ b/l10n_it_fatturapa_pec/models/fetchmail.py @@ -168,8 +168,10 @@ def manage_pec_failure(self, exception, error_messages): def notify_about_server_reset(self): self.ensure_one() self.notify_or_log( - _("PEC server %s has been reset. Last error message is '%s'") - % (self.name, self.last_pec_error_message) + _( + "PEC server %(name)s has been reset. Last error message is '%(error_message)s'" + ) + % {"name": self.name, "error_message": self.last_pec_error_message} ) def notify_or_log(self, message): diff --git a/l10n_it_fatturapa_pec/models/mail_thread.py b/l10n_it_fatturapa_pec/models/mail_thread.py index b033d9075d9e..6e712c214c77 100644 --- a/l10n_it_fatturapa_pec/models/mail_thread.py +++ b/l10n_it_fatturapa_pec/models/mail_thread.py @@ -88,18 +88,19 @@ def message_route( return self.manage_pec_sdi_response(att, message_dict) raise UserError( _( - 'PEC message "%s" has been read ' + 'PEC message "%(subject)s" has been read ' "but not processed, as not related to an " "e-invoice.\n" - "Please check PEC mailbox %s, at server %s," - " with user %s." - ) - % ( - message_dict["subject"], - fetchmail_server.name, - fetchmail_server.server, - fetchmail_server.user, + "Please check PEC mailbox %(fetchmail_name)s, " + "at server %(fetchmail_server)s," + " with user %(fetchmail_user)s." ) + % { + "subject": message_dict["subject"], + "fetchmail_name": fetchmail_server.name, + "fetchmail_server": fetchmail_server.server, + "fetchmail_user": fetchmail_server.user, + } ) return super(MailThread, self).message_route( message, diff --git a/l10n_it_fatturapa_pec/models/sdi.py b/l10n_it_fatturapa_pec/models/sdi.py index 02c7b1e8f540..abfd9688cb81 100644 --- a/l10n_it_fatturapa_pec/models/sdi.py +++ b/l10n_it_fatturapa_pec/models/sdi.py @@ -49,8 +49,13 @@ def check_fetch_pec_server_id(self): elements = self.search(domain) if len(elements) > 1: raise exceptions.ValidationError( - _("The channel %s with pec server %s already exists") - % (channel.name, channel.fetch_pec_server_id.name) + _( + "The channel %(name)s with pec server %(server_name)s already exists" + ) + % { + "name": channel.name, + "server_name": channel.fetch_pec_server_id.name, + } ) @api.constrains("pec_server_id") @@ -60,8 +65,13 @@ def check_pec_server_id(self): elements = self.search(domain) if len(elements) > 1: raise exceptions.ValidationError( - _("The channel %s with pec server %s already exists") - % (channel.name, channel.pec_server_id.name) + _( + "The channel %(name)s with pec server %(server_name)s already exists" + ) + % { + "name": channel.name, + "server_name": channel.pec_server_id.name, + } ) @api.constrains("email_exchange_system") diff --git a/l10n_it_fatturapa_pec/readme/CONTRIBUTORS.rst b/l10n_it_fatturapa_pec/readme/CONTRIBUTORS.rst index 688f41207b92..8e50184f061d 100644 --- a/l10n_it_fatturapa_pec/readme/CONTRIBUTORS.rst +++ b/l10n_it_fatturapa_pec/readme/CONTRIBUTORS.rst @@ -10,3 +10,4 @@ * `Ooops `_: * Giovanni Serra +* Giuseppe Borruso diff --git a/l10n_it_fatturapa_pec/static/description/index.html b/l10n_it_fatturapa_pec/static/description/index.html index a47a77f75131..3bd8c00e099c 100644 --- a/l10n_it_fatturapa_pec/static/description/index.html +++ b/l10n_it_fatturapa_pec/static/description/index.html @@ -3,7 +3,7 @@ - + ITA - Fattura elettronica - Supporto PEC