mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-13 15:34:49 -06:00
[IMP] attachment_zipped_download: pre-commit auto fixes
This commit is contained in:
parent
49e38ce17d
commit
422c64a40e
@ -17,21 +17,21 @@ Attachment Zipped Download
|
|||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
|
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github
|
||||||
:target: https://github.com/OCA/knowledge/tree/16.0/attachment_zipped_download
|
:target: https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download
|
||||||
:alt: OCA/knowledge
|
:alt: OCA/knowledge
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||||
:target: https://translation.odoo-community.org/projects/knowledge-16-0/knowledge-16-0-attachment_zipped_download
|
:target: https://translation.odoo-community.org/projects/knowledge-17-0/knowledge-17-0-attachment_zipped_download
|
||||||
:alt: Translate me on Weblate
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
||||||
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=16.0
|
:target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=17.0
|
||||||
:alt: Try me on Runboat
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
This module allows downloading multiple attachments as a zip file.
|
This module allows downloading multiple attachments as a zip file.
|
||||||
|
|
||||||
This also provide a helper class `IrAttachmentActionDownloadMixin`
|
This also provide a helper class IrAttachmentActionDownloadMixin to be
|
||||||
to be used by developer to add action method on models.
|
used by developer to add action method on models.
|
||||||
|
|
||||||
**Table of contents**
|
**Table of contents**
|
||||||
|
|
||||||
@ -41,84 +41,91 @@ to be used by developer to add action method on models.
|
|||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
#. Go to *Settings > Technical > Database Structure > Attachments* and select some files.
|
1. Go to *Settings > Technical > Database Structure > Attachments* and
|
||||||
#. Go to *Actions > Download* and a zip file containing the selected files will be downloaded.
|
select some files.
|
||||||
|
2. Go to *Actions > Download* and a zip file containing the selected
|
||||||
|
files will be downloaded.
|
||||||
|
|
||||||
## For developer
|
## For developer
|
||||||
|
|
||||||
You can reuse the `IrAttachmentActionDownloadMixin` on your
|
You can reuse the IrAttachmentActionDownloadMixin on your favorite
|
||||||
favorite models::
|
models:
|
||||||
|
|
||||||
from odoo import models
|
::
|
||||||
|
|
||||||
|
from odoo import models
|
||||||
|
|
||||||
|
|
||||||
class StockPicking(models.Model):
|
class StockPicking(models.Model):
|
||||||
_name = "stock.picking"
|
_name = "stock.picking"
|
||||||
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
||||||
|
|
||||||
|
Then you can add an action button on list view line or on the action
|
||||||
|
button (when multiple lines are selected) to download all files:
|
||||||
|
|
||||||
Then you can add an action button on list view line or on the action button
|
::
|
||||||
(when multiple lines are selected) to download all files::
|
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
<!--
|
<!--
|
||||||
add a button on list view to download all attachement present
|
add a button on list view to download all attachement present
|
||||||
on the given transfert
|
on the given transfert
|
||||||
-->
|
-->
|
||||||
<record id="vpicktree" model="ir.ui.view">
|
<record id="vpicktree" model="ir.ui.view">
|
||||||
<field name="inherit_id" ref="stock.vpicktree"/>
|
<field name="inherit_id" ref="stock.vpicktree"/>
|
||||||
<field name="name">stock.picking.tree download attachments</field>
|
<field name="name">stock.picking.tree download attachments</field>
|
||||||
<field name="model">stock.picking</field>
|
<field name="model">stock.picking</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="json_popover" position="after">
|
<field name="json_popover" position="after">
|
||||||
<button name="action_download_attachments"
|
<button name="action_download_attachments"
|
||||||
type="object"
|
type="object"
|
||||||
icon="fa-download"
|
icon="fa-download"
|
||||||
string="Download attachment(s)"
|
string="Download attachment(s)"
|
||||||
aria-label="Download Proof documents"
|
aria-label="Download Proof documents"
|
||||||
class="float-right"/>
|
class="float-right"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!--
|
|
||||||
Add "Download attachments" item in the Action menu when
|
|
||||||
multiple records are selected
|
|
||||||
-->
|
|
||||||
<record id="action_download_picking_attachements" model="ir.actions.server">
|
|
||||||
<field name="name">Download attachments</field>
|
|
||||||
<field name="model_id" ref="stock.model_stock_picking"/>
|
|
||||||
<field name="binding_model_id" ref="stock.model_stock_picking"/>
|
|
||||||
<field name="binding_view_types">list</field>
|
|
||||||
<field name="state">code</field>
|
|
||||||
<field name="code">
|
|
||||||
action = records.action_download_attachments()
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Add "Download attachments" item in the Action menu when
|
||||||
|
multiple records are selected
|
||||||
|
-->
|
||||||
|
<record id="action_download_picking_attachements" model="ir.actions.server">
|
||||||
|
<field name="name">Download attachments</field>
|
||||||
|
<field name="model_id" ref="stock.model_stock_picking"/>
|
||||||
|
<field name="binding_model_id" ref="stock.model_stock_picking"/>
|
||||||
|
<field name="binding_view_types">list</field>
|
||||||
|
<field name="state">code</field>
|
||||||
|
<field name="code">
|
||||||
|
action = records.action_download_attachments()
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Even you will be able to generate a zip file with multiple document with the
|
Even you will be able to generate a zip file with multiple document
|
||||||
same name it's advice to overwrite `_compute_zip_file_name` to improve the
|
with the same name it's advice to overwrite \_compute_zip_file_name
|
||||||
name. When a slash (`/`) is present in the path it will create a directory.
|
to improve the name. When a slash (/) is present in the path it will
|
||||||
This example will create a directory per stock.picking using its name::
|
create a directory. This example will create a directory per
|
||||||
|
stock.picking using its name:
|
||||||
|
|
||||||
class IrAttachment(models.Model):
|
::
|
||||||
_inherit = "ir.attachment"
|
|
||||||
|
|
||||||
def _compute_zip_file_name(self):
|
class IrAttachment(models.Model):
|
||||||
self.ensure_one()
|
_inherit = "ir.attachment"
|
||||||
if self.res_model and self.res_model == "stock.picking":
|
|
||||||
return (
|
def _compute_zip_file_name(self):
|
||||||
self.env[self.res_model]
|
self.ensure_one()
|
||||||
.browse(self.res_id)
|
if self.res_model and self.res_model == "stock.picking":
|
||||||
.display_name.replace("/", "-")
|
return (
|
||||||
+ "/"
|
self.env[self.res_model]
|
||||||
+ self.name
|
.browse(self.res_id)
|
||||||
)
|
.display_name.replace("/", "-")
|
||||||
return super()._compute_zip_file_name()
|
+ "/"
|
||||||
|
+ self.name
|
||||||
|
)
|
||||||
|
return super()._compute_zip_file_name()
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
@ -126,7 +133,7 @@ Bug Tracker
|
|||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.
|
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.
|
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
|
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:%2016.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:%2017.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.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
@ -134,24 +141,23 @@ Credits
|
|||||||
=======
|
=======
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
-------
|
||||||
|
|
||||||
* Tecnativa
|
* Tecnativa
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
~~~~~~~~~~~~
|
------------
|
||||||
|
|
||||||
* César Fernández Domínguez <cesfernandez@outlook.com>
|
- César Fernández Domínguez <cesfernandez@outlook.com>
|
||||||
|
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
- Víctor Martínez
|
||||||
|
- Pedro M. Baeza
|
||||||
|
|
||||||
* Víctor Martínez
|
- Pierre Verkest <pierreverkest@gmail.com>
|
||||||
* Pedro M. Baeza
|
|
||||||
|
|
||||||
* Pierre Verkest <pierreverkest@gmail.com>
|
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
-----------
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
This module is maintained by the OCA.
|
||||||
|
|
||||||
@ -163,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
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/16.0/attachment_zipped_download>`_ project on GitHub.
|
This module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/17.0/attachment_zipped_download>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
3
attachment_zipped_download/pyproject.toml
Normal file
3
attachment_zipped_download/pyproject.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
5
attachment_zipped_download/readme/CONTRIBUTORS.md
Normal file
5
attachment_zipped_download/readme/CONTRIBUTORS.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
- César Fernández Domínguez \<<cesfernandez@outlook.com>\>
|
||||||
|
- [Tecnativa](https://www.tecnativa.com):
|
||||||
|
- Víctor Martínez
|
||||||
|
- Pedro M. Baeza
|
||||||
|
- Pierre Verkest \<<pierreverkest@gmail.com>\>
|
@ -1,8 +0,0 @@
|
|||||||
* César Fernández Domínguez <cesfernandez@outlook.com>
|
|
||||||
|
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
|
||||||
|
|
||||||
* Víctor Martínez
|
|
||||||
* Pedro M. Baeza
|
|
||||||
|
|
||||||
* Pierre Verkest <pierreverkest@gmail.com>
|
|
4
attachment_zipped_download/readme/DESCRIPTION.md
Normal file
4
attachment_zipped_download/readme/DESCRIPTION.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
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.
|
@ -1,4 +0,0 @@
|
|||||||
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.
|
|
@ -1,10 +1,12 @@
|
|||||||
#. Go to *Settings > Technical > Database Structure > Attachments* and select some files.
|
1. Go to *Settings \> Technical \> Database Structure \> Attachments*
|
||||||
#. Go to *Actions > Download* and a zip file containing the selected files will be downloaded.
|
and select some files.
|
||||||
|
2. Go to *Actions \> Download* and a zip file containing the selected
|
||||||
|
files will be downloaded.
|
||||||
|
|
||||||
## For developer
|
\## For developer
|
||||||
|
|
||||||
You can reuse the `IrAttachmentActionDownloadMixin` on your
|
You can reuse the IrAttachmentActionDownloadMixin on your favorite
|
||||||
favorite models::
|
models:
|
||||||
|
|
||||||
from odoo import models
|
from odoo import models
|
||||||
|
|
||||||
@ -13,9 +15,8 @@ favorite models::
|
|||||||
_name = "stock.picking"
|
_name = "stock.picking"
|
||||||
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
||||||
|
|
||||||
|
Then you can add an action button on list view line or on the action
|
||||||
Then you can add an action button on list view line or on the action button
|
button (when multiple lines are selected) to download all files:
|
||||||
(when multiple lines are selected) to download all files::
|
|
||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
<!--
|
<!--
|
||||||
@ -54,25 +55,24 @@ Then you can add an action button on list view line or on the action button
|
|||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
.. note::
|
> Even you will be able to generate a zip file with multiple document
|
||||||
|
> with the same name it's advice to overwrite \_compute_zip_file_name to
|
||||||
Even you will be able to generate a zip file with multiple document with the
|
> improve the name. When a slash (/) is present in the path it will
|
||||||
same name it's advice to overwrite `_compute_zip_file_name` to improve the
|
> create a directory. This example will create a directory per
|
||||||
name. When a slash (`/`) is present in the path it will create a directory.
|
> stock.picking using its name:
|
||||||
This example will create a directory per stock.picking using its name::
|
>
|
||||||
|
> class IrAttachment(models.Model):
|
||||||
class IrAttachment(models.Model):
|
> _inherit = "ir.attachment"
|
||||||
_inherit = "ir.attachment"
|
>
|
||||||
|
> def _compute_zip_file_name(self):
|
||||||
def _compute_zip_file_name(self):
|
> self.ensure_one()
|
||||||
self.ensure_one()
|
> if self.res_model and self.res_model == "stock.picking":
|
||||||
if self.res_model and self.res_model == "stock.picking":
|
> return (
|
||||||
return (
|
> self.env[self.res_model]
|
||||||
self.env[self.res_model]
|
> .browse(self.res_id)
|
||||||
.browse(self.res_id)
|
> .display_name.replace("/", "-")
|
||||||
.display_name.replace("/", "-")
|
> + "/"
|
||||||
+ "/"
|
> + self.name
|
||||||
+ self.name
|
> )
|
||||||
)
|
> return super()._compute_zip_file_name()
|
||||||
return super()._compute_zip_file_name()
|
|
@ -8,10 +8,11 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
:Author: David Goodger (goodger@python.org)
|
:Author: David Goodger (goodger@python.org)
|
||||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||||
:Copyright: This stylesheet has been placed in the public domain.
|
:Copyright: This stylesheet has been placed in the public domain.
|
||||||
|
|
||||||
Default cascading style sheet for the HTML output of Docutils.
|
Default cascading style sheet for the HTML output of Docutils.
|
||||||
|
Despite the name, some widely supported CSS2 features are used.
|
||||||
|
|
||||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||||
customize this style sheet.
|
customize this style sheet.
|
||||||
@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
|||||||
margin-left: 2em ;
|
margin-left: 2em ;
|
||||||
margin-right: 2em }
|
margin-right: 2em }
|
||||||
|
|
||||||
pre.code .ln { color: grey; } /* line numbers */
|
pre.code .ln { color: gray; } /* line numbers */
|
||||||
pre.code, code { background-color: #eeeeee }
|
pre.code, code { background-color: #eeeeee }
|
||||||
pre.code .comment, code .comment { color: #5C6576 }
|
pre.code .comment, code .comment { color: #5C6576 }
|
||||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||||
@ -300,7 +301,7 @@ span.option {
|
|||||||
span.pre {
|
span.pre {
|
||||||
white-space: pre }
|
white-space: pre }
|
||||||
|
|
||||||
span.problematic {
|
span.problematic, pre.problematic {
|
||||||
color: red }
|
color: red }
|
||||||
|
|
||||||
span.section-subtitle {
|
span.section-subtitle {
|
||||||
@ -368,10 +369,10 @@ ul.auto-toc {
|
|||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:4163544eb16787f39f46edcd97305586594a6f708c1e489908d344467c82483e
|
!! source digest: sha256:4163544eb16787f39f46edcd97305586594a6f708c1e489908d344467c82483e
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<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/16.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-16-0/knowledge-16-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=16.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/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>This module allows downloading multiple attachments as a zip file.</p>
|
<p>This module allows downloading multiple attachments as a zip file.</p>
|
||||||
<p>This also provide a helper class <cite>IrAttachmentActionDownloadMixin</cite>
|
<p>This also provide a helper class IrAttachmentActionDownloadMixin to be
|
||||||
to be used by developer to add action method on models.</p>
|
used by developer to add action method on models.</p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
@ -388,12 +389,14 @@ to be used by developer to add action method on models.</p>
|
|||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
|
||||||
<ol class="arabic simple">
|
<ol class="arabic simple">
|
||||||
<li>Go to <em>Settings > Technical > Database Structure > Attachments</em> and select some files.</li>
|
<li>Go to <em>Settings > Technical > Database Structure > Attachments</em> and
|
||||||
<li>Go to <em>Actions > Download</em> and a zip file containing the selected files will be downloaded.</li>
|
select some files.</li>
|
||||||
|
<li>Go to <em>Actions > Download</em> and a zip file containing the selected
|
||||||
|
files will be downloaded.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>## For developer</p>
|
<p>## For developer</p>
|
||||||
<p>You can reuse the <cite>IrAttachmentActionDownloadMixin</cite> on your
|
<p>You can reuse the IrAttachmentActionDownloadMixin on your favorite
|
||||||
favorite models:</p>
|
models:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
from odoo import models
|
from odoo import models
|
||||||
|
|
||||||
@ -402,8 +405,8 @@ class StockPicking(models.Model):
|
|||||||
_name = "stock.picking"
|
_name = "stock.picking"
|
||||||
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
_inherit = ["stock.picking", "ir.attachment.action_download"]
|
||||||
</pre>
|
</pre>
|
||||||
<p>Then you can add an action button on list view line or on the action button
|
<p>Then you can add an action button on list view line or on the action
|
||||||
(when multiple lines are selected) to download all files:</p>
|
button (when multiple lines are selected) to download all files:</p>
|
||||||
<pre class="literal-block">
|
<pre class="literal-block">
|
||||||
<odoo>
|
<odoo>
|
||||||
<!--
|
<!--
|
||||||
@ -444,10 +447,11 @@ class StockPicking(models.Model):
|
|||||||
</pre>
|
</pre>
|
||||||
<div class="admonition note">
|
<div class="admonition note">
|
||||||
<p class="first admonition-title">Note</p>
|
<p class="first admonition-title">Note</p>
|
||||||
<p>Even you will be able to generate a zip file with multiple document with the
|
<p>Even you will be able to generate a zip file with multiple document
|
||||||
same name it’s advice to overwrite <cite>_compute_zip_file_name</cite> to improve the
|
with the same name it’s advice to overwrite _compute_zip_file_name
|
||||||
name. When a slash (<cite>/</cite>) is present in the path it will create a directory.
|
to improve the name. When a slash (/) is present in the path it will
|
||||||
This example will create a directory per stock.picking using its name:</p>
|
create a directory. This example will create a directory per
|
||||||
|
stock.picking using its name:</p>
|
||||||
<pre class="last literal-block">
|
<pre class="last literal-block">
|
||||||
class IrAttachment(models.Model):
|
class IrAttachment(models.Model):
|
||||||
_inherit = "ir.attachment"
|
_inherit = "ir.attachment"
|
||||||
@ -471,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>.
|
<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.
|
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
|
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:%2016.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:%2017.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>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
@ -497,11 +501,13 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
|||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
||||||
<p>This module is maintained by the OCA.</p>
|
<p>This module is maintained by the OCA.</p>
|
||||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||||
|
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||||
|
</a>
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/knowledge/tree/16.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/17.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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user