odoo-addon-attachment-zipped-download


Nameodoo-addon-attachment-zipped-download JSON
Version 18.0.1.0.0.3 PyPI version JSON
download
home_pagehttps://github.com/OCA/knowledge
SummaryAttachment Zipped Download
upload_time2025-02-19 02:55:39
maintainerNone
docs_urlNone
authorTecnativa, Odoo Community Association (OCA)
requires_python>=3.10
licenseAGPL-3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ==========================
Attachment Zipped Download
==========================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:fbdb4e46ccbc9603a62727e5f0d60de09598e65070309e84de2095cfb922767f
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
    :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/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-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=18.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

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.

**Table of contents**

.. contents::
   :local:

Usage
=====

1. Go to *Settings > Technical > Database Structure > Attachments* and
   select some files.
2. Go to *Actions > Download* and a zip file containing the selected
   files will be downloaded.

## For developer

You can reuse the IrAttachmentActionDownloadMixin on your favorite
models:

::

   from odoo import models


   class StockPicking(models.Model):
       _name = "stock.picking"
       _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:

::

   <odoo>
       <!--
           add a button on list view to download all attachement present
           on the given transfert
       -->
       <record id="vpicktree" model="ir.ui.view">
           <field name="inherit_id" ref="stock.vpicktree"/>
           <field name="name">stock.picking.tree download attachments</field>
           <field name="model">stock.picking</field>
           <field name="arch" type="xml">
               <field name="json_popover" position="after">
                   <button name="action_download_attachments"
                       type="object"
                       icon="fa-download"
                       string="Download attachment(s)"
                       aria-label="Download Proof documents"
                       class="float-right"/>
               </field>
           </field>
       </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>

.. 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 improve the name. When a slash (/) is present in the path it will
   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):
              self.ensure_one()
              if self.res_model and self.res_model == "stock.picking":
                  return (
                      self.env[self.res_model]
                      .browse(self.res_id)
                      .display_name.replace("/", "-")
                      + "/"
                      + self.name
                  )
              return super()._compute_zip_file_name()

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:%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.

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- 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>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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/18.0/attachment_zipped_download>`_ project on GitHub.

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OCA/knowledge",
    "name": "odoo-addon-attachment-zipped-download",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tecnativa, Odoo Community Association (OCA)",
    "author_email": "support@odoo-community.org",
    "download_url": null,
    "platform": null,
    "description": "==========================\nAttachment Zipped Download\n==========================\n\n.. \n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n   !! This file is generated by oca-gen-addon-readme !!\n   !! changes will be overwritten.                   !!\n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n   !! source digest: sha256:fbdb4e46ccbc9603a62727e5f0d60de09598e65070309e84de2095cfb922767f\n   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png\n    :target: https://odoo-community.org/page/development-status\n    :alt: Beta\n.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png\n    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html\n    :alt: License: AGPL-3\n.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fknowledge-lightgray.png?logo=github\n    :target: https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download\n    :alt: OCA/knowledge\n.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png\n    :target: https://translation.odoo-community.org/projects/knowledge-18-0/knowledge-18-0-attachment_zipped_download\n    :alt: Translate me on Weblate\n.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png\n    :target: https://runboat.odoo-community.org/builds?repo=OCA/knowledge&target_branch=18.0\n    :alt: Try me on Runboat\n\n|badge1| |badge2| |badge3| |badge4| |badge5|\n\nThis module allows downloading multiple attachments as a zip file.\n\nThis also provide a helper class IrAttachmentActionDownloadMixin to be\nused by developer to add action method on models.\n\n**Table of contents**\n\n.. contents::\n   :local:\n\nUsage\n=====\n\n1. Go to *Settings > Technical > Database Structure > Attachments* and\n   select some files.\n2. Go to *Actions > Download* and a zip file containing the selected\n   files will be downloaded.\n\n## For developer\n\nYou can reuse the IrAttachmentActionDownloadMixin on your favorite\nmodels:\n\n::\n\n   from odoo import models\n\n\n   class StockPicking(models.Model):\n       _name = \"stock.picking\"\n       _inherit = [\"stock.picking\", \"ir.attachment.action_download\"]\n\nThen you can add an action button on list view line or on the action\nbutton (when multiple lines are selected) to download all files:\n\n::\n\n   <odoo>\n       <!--\n           add a button on list view to download all attachement present\n           on the given transfert\n       -->\n       <record id=\"vpicktree\" model=\"ir.ui.view\">\n           <field name=\"inherit_id\" ref=\"stock.vpicktree\"/>\n           <field name=\"name\">stock.picking.tree download attachments</field>\n           <field name=\"model\">stock.picking</field>\n           <field name=\"arch\" type=\"xml\">\n               <field name=\"json_popover\" position=\"after\">\n                   <button name=\"action_download_attachments\"\n                       type=\"object\"\n                       icon=\"fa-download\"\n                       string=\"Download attachment(s)\"\n                       aria-label=\"Download Proof documents\"\n                       class=\"float-right\"/>\n               </field>\n           </field>\n       </record>\n\n       <!--\n           Add \"Download attachments\" item in the Action menu when\n           multiple records are selected\n       -->\n       <record id=\"action_download_picking_attachements\" model=\"ir.actions.server\">\n           <field name=\"name\">Download attachments</field>\n           <field name=\"model_id\" ref=\"stock.model_stock_picking\"/>\n           <field name=\"binding_model_id\" ref=\"stock.model_stock_picking\"/>\n           <field name=\"binding_view_types\">list</field>\n           <field name=\"state\">code</field>\n           <field name=\"code\">\n               action = records.action_download_attachments()\n           </field>\n       </record>\n   </odoo>\n\n.. note::\n\n   Even you will be able to generate a zip file with multiple document\n   with the same name it's advice to overwrite \\_compute_zip_file_name\n   to improve the name. When a slash (/) is present in the path it will\n   create a directory. This example will create a directory per\n   stock.picking using its name:\n\n   ::\n\n      class IrAttachment(models.Model):\n          _inherit = \"ir.attachment\"\n\n          def _compute_zip_file_name(self):\n              self.ensure_one()\n              if self.res_model and self.res_model == \"stock.picking\":\n                  return (\n                      self.env[self.res_model]\n                      .browse(self.res_id)\n                      .display_name.replace(\"/\", \"-\")\n                      + \"/\"\n                      + self.name\n                  )\n              return super()._compute_zip_file_name()\n\nBug Tracker\n===========\n\nBugs are tracked on `GitHub Issues <https://github.com/OCA/knowledge/issues>`_.\nIn case of trouble, please check there if your issue has already been reported.\nIf you spotted it first, help us to smash it by providing a detailed and welcomed\n`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**>`_.\n\nDo not contact contributors directly about support or help with technical issues.\n\nCredits\n=======\n\nAuthors\n-------\n\n* Tecnativa\n\nContributors\n------------\n\n- C\u00e9sar Fern\u00e1ndez Dom\u00ednguez <cesfernandez@outlook.com>\n- `Tecnativa <https://www.tecnativa.com>`__:\n\n  - V\u00edctor Mart\u00ednez\n  - Pedro M. Baeza\n\n- Pierre Verkest <pierreverkest@gmail.com>\n\nMaintainers\n-----------\n\nThis module is maintained by the OCA.\n\n.. image:: https://odoo-community.org/logo.png\n   :alt: Odoo Community Association\n   :target: https://odoo-community.org\n\nOCA, or the Odoo Community Association, is a nonprofit organization whose\nmission is to support the collaborative development of Odoo features and\npromote its widespread use.\n\nThis module is part of the `OCA/knowledge <https://github.com/OCA/knowledge/tree/18.0/attachment_zipped_download>`_ project on GitHub.\n\nYou are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.\n",
    "bugtrack_url": null,
    "license": "AGPL-3",
    "summary": "Attachment Zipped Download",
    "version": "18.0.1.0.0.3",
    "project_urls": {
        "Homepage": "https://github.com/OCA/knowledge"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7eaa90c94485579d711ca8286552ff5c54d4c85d304a7a6dbc98331217c04697",
                "md5": "e3af7d109722adaa50e313af847b6f31",
                "sha256": "00c05a0732cd9d790d521fcf779b07bf6a85f60417728412af3a1824654dc156"
            },
            "downloads": -1,
            "filename": "odoo_addon_attachment_zipped_download-18.0.1.0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3af7d109722adaa50e313af847b6f31",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 36293,
            "upload_time": "2025-02-19T02:55:39",
            "upload_time_iso_8601": "2025-02-19T02:55:39.183235Z",
            "url": "https://files.pythonhosted.org/packages/7e/aa/90c94485579d711ca8286552ff5c54d4c85d304a7a6dbc98331217c04697/odoo_addon_attachment_zipped_download-18.0.1.0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-19 02:55:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OCA",
    "github_project": "knowledge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "odoo-addon-attachment-zipped-download"
}
        
Elapsed time: 7.19599s