diff --git a/attachment_zipped_download/README.rst b/attachment_zipped_download/README.rst index 2a089a99..d13e7e62 100644 --- a/attachment_zipped_download/README.rst +++ b/attachment_zipped_download/README.rst @@ -17,13 +17,13 @@ Attachment Zipped Download :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github - :target: https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download + :target: https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download :alt: OCA/knowledge .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-attachment_zipped_download + :target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-attachment_zipped_download :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -133,7 +133,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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -148,13 +148,13 @@ Authors Contributors ------------ -- César Fernández Domínguez -- `Tecnativa `__: +- César Fernández Domínguez +- `Tecnativa `__: - - Víctor Martínez - - Pedro M. Baeza + - Víctor Martínez + - Pedro M. Baeza -- Pierre Verkest +- Pierre Verkest Maintainers ----------- @@ -169,6 +169,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/knowledge `_ project on GitHub. +This module is part of the `OCA/knowledge `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/attachment_zipped_download/__manifest__.py b/attachment_zipped_download/__manifest__.py index 89717974..c42f3dd9 100644 --- a/attachment_zipped_download/__manifest__.py +++ b/attachment_zipped_download/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Attachment Zipped Download", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "category": "Tools", "website": "https://github.com/OCA/knowledge", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/attachment_zipped_download/models/ir_attachment.py b/attachment_zipped_download/models/ir_attachment.py index f91d8588..d6900e5d 100644 --- a/attachment_zipped_download/models/ir_attachment.py +++ b/attachment_zipped_download/models/ir_attachment.py @@ -4,7 +4,7 @@ import zipfile from io import BytesIO -from odoo import _, models +from odoo import models from odoo.exceptions import UserError @@ -15,12 +15,12 @@ class IrAttachment(models.Model): items = self.filtered(lambda x: x.type == "binary") if not items: raise UserError( - _("None attachment selected. Only binary attachments allowed.") + self.env._("None attachment selected. Only binary attachments allowed.") ) ids = ",".join(map(str, items.ids)) return { "type": "ir.actions.act_url", - "url": "/web/attachment/download_zip?ids=%s" % (ids), + "url": f"/web/attachment/download_zip?ids={ids}", "target": "self", } diff --git a/attachment_zipped_download/models/ir_attachment_action_download.py b/attachment_zipped_download/models/ir_attachment_action_download.py index e06c573e..635a9e44 100644 --- a/attachment_zipped_download/models/ir_attachment_action_download.py +++ b/attachment_zipped_download/models/ir_attachment_action_download.py @@ -1,7 +1,7 @@ # Copyright 2023 Foodles (https://www.foodles.com/) # @author Pierre Verkest # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from odoo import _, models +from odoo import models class IrAttachmentActionDownloadMixin(models.AbstractModel): @@ -32,8 +32,8 @@ class IrAttachmentActionDownloadMixin(models.AbstractModel): """ attachments = self._get_downloadable_attachments() if not attachments: - title = _("No attachment!") - message = _("There is no document found to download.") + title = self.env._("No attachment!") + message = self.env._("There is no document found to download.") return { "type": "ir.actions.client", "tag": "display_notification", @@ -49,7 +49,7 @@ class IrAttachmentActionDownloadMixin(models.AbstractModel): return { "target": "self", "type": "ir.actions.act_url", - "url": "/web/content/%s?download=1" % attachments.id, + "url": f"/web/content/{attachments.id}?download=1", } else: return attachments.action_attachments_download() diff --git a/attachment_zipped_download/static/description/index.html b/attachment_zipped_download/static/description/index.html index cef13548..e41726a0 100644 --- a/attachment_zipped_download/static/description/index.html +++ b/attachment_zipped_download/static/description/index.html @@ -369,7 +369,7 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:63602db7f612916c91796c11238e746b60396e495f8df6bb7f4bcbff442e56d1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/knowledge Translate me on Weblate Try me on Runboat

This module allows downloading multiple attachments as a zip file.

This also provide a helper class IrAttachmentActionDownloadMixin to be used by developer to add action method on models.

@@ -475,7 +475,7 @@ class IrAttachment(models.Model):

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

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

@@ -507,7 +507,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

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/knowledge project on GitHub.

+

This module is part of the OCA/knowledge project on GitHub.

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

diff --git a/attachment_zipped_download/tests/test_ir_attachment_action_download.py b/attachment_zipped_download/tests/test_ir_attachment_action_download.py index 95db89e1..bb1a0209 100644 --- a/attachment_zipped_download/tests/test_ir_attachment_action_download.py +++ b/attachment_zipped_download/tests/test_ir_attachment_action_download.py @@ -52,7 +52,7 @@ class TestMixin(TestAttachmentZippedDownloadBase): self.assertEqual(action["type"], "ir.actions.act_url") self.assertEqual(action["target"], "self") self.assertEqual( - action["url"], "/web/content/%s?download=1" % self.partner_2_f1.id + action["url"], f"/web/content/{self.partner_2_f1.id}?download=1" ) def test_action_download_attachments_two_attachment_one_record(self): diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 00000000..66bc2cba --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1 @@ +odoo_test_helper