Skip to content

Commit 25dba93

Browse files
committed
[MIG] attachment_zipped_download: Migration to 18.0
TT54112
1 parent 7e256cf commit 25dba93

File tree

7 files changed

+23
-22
lines changed

7 files changed

+23
-22
lines changed

attachment_zipped_download/README.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Attachment Zipped Download
1717
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
1818
:alt: License: AGPL-3
1919
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
20-
:target: https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download
20+
:target: https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download
2121
:alt: OCA/knowledge
2222
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23-
:target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-attachment_zipped_download
23+
:target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-attachment_zipped_download
2424
:alt: Translate me on Weblate
2525
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26-
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0
2727
:alt: Try me on Runboat
2828

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

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

@@ -148,13 +148,13 @@ Authors
148148
Contributors
149149
------------
150150

151-
- César Fernández Domínguez <cesfernandez@outlook.com>
152-
- `Tecnativa <https://www.tecnativa.com>`__:
151+
- César Fernández Domínguez <cesfernandez@outlook.com>
152+
- `Tecnativa <https://www.tecnativa.com>`__:
153153

154-
- Víctor Martínez
155-
- Pedro M. Baeza
154+
- Víctor Martínez
155+
- Pedro M. Baeza
156156

157-
- Pierre Verkest <pierreverkest@gmail.com>
157+
- Pierre Verkest <pierreverkest@gmail.com>
158158

159159
Maintainers
160160
-----------
@@ -169,6 +169,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
169169
mission is to support the collaborative development of Odoo features and
170170
promote its widespread use.
171171

172-
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download>`_ project on GitHub.
172+
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download>`_ project on GitHub.
173173

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

attachment_zipped_download/__manifest__.py

+1-1
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).
33
{
44
"name": "Attachment Zipped Download",
5-
"version": "17.0.1.0.0",
5+
"version": "18.0.1.0.0",
66
"category": "Tools",
77
"website": "https://github.com/OCA/knowledge",
88
"author": "Tecnativa, Odoo Community Association (OCA)",

attachment_zipped_download/models/ir_attachment.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import zipfile
55
from io import BytesIO
66

7-
from odoo import _, models
7+
from odoo import models
88
from odoo.exceptions import UserError
99

1010

@@ -15,12 +15,12 @@ def action_attachments_download(self):
1515
items = self.filtered(lambda x: x.type == "binary")
1616
if not items:
1717
raise UserError(
18-
_("None attachment selected. Only binary attachments allowed.")
18+
self.env._("None attachment selected. Only binary attachments allowed.")
1919
)
2020
ids = ",".join(map(str, items.ids))
2121
return {
2222
"type": "ir.actions.act_url",
23-
"url": "/web/attachment/download_zip?ids=%s" % (ids),
23+
"url": f"/web/attachment/download_zip?ids={ids}",
2424
"target": "self",
2525
}
2626

attachment_zipped_download/models/ir_attachment_action_download.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright 2023 Foodles (https://www.foodles.com/)
22
# @author Pierre Verkest <pierreverkest84@gmail.com>
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4-
from odoo import _, models
4+
from odoo import models
55

66

77
class IrAttachmentActionDownloadMixin(models.AbstractModel):
@@ -32,8 +32,8 @@ def action_download_attachments(self):
3232
"""
3333
attachments = self._get_downloadable_attachments()
3434
if not attachments:
35-
title = _("No attachment!")
36-
message = _("There is no document found to download.")
35+
title = self.env._("No attachment!")
36+
message = self.env._("There is no document found to download.")
3737
return {
3838
"type": "ir.actions.client",
3939
"tag": "display_notification",
@@ -49,7 +49,7 @@ def action_download_attachments(self):
4949
return {
5050
"target": "self",
5151
"type": "ir.actions.act_url",
52-
"url": "/web/content/%s?download=1" % attachments.id,
52+
"url": f"/web/content/{attachments.id}?download=1",
5353
}
5454
else:
5555
return attachments.action_attachments_download()

attachment_zipped_download/static/description/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ <h1 class="title">Attachment Zipped Download</h1>
369369
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370370
!! source digest: sha256:63602db7f612916c91796c11238e746b60396e495f8df6bb7f4bcbff442e56d1
371371
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372-
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-attachment_zipped_download"><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/knowledge&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372+
<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/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download"><img alt="OCA/knowledge" src="https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-attachment_zipped_download"><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/knowledge&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373373
<p>This module allows downloading multiple attachments as a zip file.</p>
374374
<p>This also provide a helper class IrAttachmentActionDownloadMixin to be
375375
used by developer to add action method on models.</p>
@@ -475,7 +475,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
475475
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
476476
In case of trouble, please check there if your issue has already been reported.
477477
If you spotted it first, help us to smash it by providing a detailed and welcomed
478-
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
478+
<a class="reference external" href="https://github.com/OCA/knowledge/issues/new?body=module:%20attachment_zipped_download%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
479479
<p>Do not contact contributors directly about support or help with technical issues.</p>
480480
</div>
481481
<div class="section" id="credits">
@@ -507,7 +507,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
507507
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
508508
mission is to support the collaborative development of Odoo features and
509509
promote its widespread use.</p>
510-
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download">OCA/knowledge</a> project on GitHub.</p>
510+
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download">OCA/knowledge</a> project on GitHub.</p>
511511
<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>
512512
</div>
513513
</div>

attachment_zipped_download/tests/test_ir_attachment_action_download.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_action_download_attachments_one_attachment(self):
5252
self.assertEqual(action["type"], "ir.actions.act_url")
5353
self.assertEqual(action["target"], "self")
5454
self.assertEqual(
55-
action["url"], "/web/content/%s?download=1" % self.partner_2_f1.id
55+
action["url"], f"/web/content/{self.partner_2_f1.id}?download=1"
5656
)
5757

5858
def test_action_download_attachments_two_attachment_one_record(self):

test-requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
odoo_test_helper

0 commit comments

Comments
 (0)