mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-13 07:24:48 -06:00
[MIG] attachment_zipped_download: Migration to 18.0
TT54112
This commit is contained in:
parent
7e256cfaa8
commit
25dba93d16
@ -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 <https://github.com/OCA/knowledge/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 <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 <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**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
@ -148,13 +148,13 @@ Authors
|
||||
Contributors
|
||||
------------
|
||||
|
||||
- César Fernández Domínguez <cesfernandez@outlook.com>
|
||||
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||
- César Fernández Domínguez <cesfernandez@outlook.com>
|
||||
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||
|
||||
- Víctor Martínez
|
||||
- Pedro M. Baeza
|
||||
- Víctor Martínez
|
||||
- Pedro M. Baeza
|
||||
|
||||
- Pierre Verkest <pierreverkest@gmail.com>
|
||||
- Pierre Verkest <pierreverkest@gmail.com>
|
||||
|
||||
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 <https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download>`_ project on GitHub.
|
||||
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
@ -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)",
|
||||
|
@ -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",
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright 2023 Foodles (https://www.foodles.com/)
|
||||
# @author Pierre Verkest <pierreverkest84@gmail.com>
|
||||
# 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()
|
||||
|
@ -369,7 +369,7 @@ ul.auto-toc {
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:63602db7f612916c91796c11238e746b60396e495f8df6bb7f4bcbff442e56d1
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<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&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<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&target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows downloading multiple attachments as a zip file.</p>
|
||||
<p>This also provide a helper class IrAttachmentActionDownloadMixin to be
|
||||
used by developer to add action method on models.</p>
|
||||
@ -475,7 +475,7 @@ class IrAttachment(models.Model):
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/knowledge/issues">GitHub Issues</a>.
|
||||
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
|
||||
<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>
|
||||
<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>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@ -507,7 +507,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<p>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.</p>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -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):
|
||||
|
1
test-requirements.txt
Normal file
1
test-requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
odoo_test_helper
|
Loading…
Reference in New Issue
Block a user