-
-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
17 changed files
with
781 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
================================== | ||
Product Attachment Zipped Download | ||
================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:83ad066d1fff91f3a30547d9094b4d4bacd0e7614498a95854047bb2e9e52f0b | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fproduct--attribute-lightgray.png?logo=github | ||
:target: https://github.com/OCA/product-attribute/tree/16.0/product_attachment_zipped_download | ||
:alt: OCA/product-attribute | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_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/product-attribute&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows the possibility to download attachments in a .zip file of the selected products. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_attachment_zipped_download%0Aversion:%2016.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 | ||
~~~~~~~~~~~~ | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Víctor Martínez | ||
* Pedro M. Baeza | ||
|
||
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. | ||
|
||
.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px | ||
:target: https://github.com/victoralmau | ||
:alt: victoralmau | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-victoralmau| | ||
|
||
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/16.0/product_attachment_zipped_download>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Product Attachment Zipped Download", | ||
"version": "16.0.1.0.0", | ||
"category": "Product Management", | ||
"website": "https://github.com/OCA/product-attribute", | ||
"author": "Tecnativa, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["attachment_zipped_download", "product"], | ||
"data": ["data/ir_actions_server_data.xml"], | ||
"installable": True, | ||
"maintainers": ["victoralmau"], | ||
} |
26 changes: 26 additions & 0 deletions
26
product_attachment_zipped_download/data/ir_actions_server_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="action_download_product_product_attachements" model="ir.actions.server"> | ||
<field name="name">Download attachments</field> | ||
<field name="model_id" ref="product.model_product_product" /> | ||
<field name="binding_model_id" ref="product.model_product_product" /> | ||
<field name="binding_view_types">list,form</field> | ||
<field name="state">code</field> | ||
<field name="code"> | ||
action = records.action_download_attachments() | ||
</field> | ||
</record> | ||
<record | ||
id="action_download_product_template_attachements" | ||
model="ir.actions.server" | ||
> | ||
<field name="name">Download attachments</field> | ||
<field name="model_id" ref="product.model_product_template" /> | ||
<field name="binding_model_id" ref="product.model_product_template" /> | ||
<field name="binding_view_types">list,form</field> | ||
<field name="state">code</field> | ||
<field name="code"> | ||
action = records.action_download_attachments() | ||
</field> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_attachment_zipped_download | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2024-04-15 07:00+0000\n" | ||
"PO-Revision-Date: 2024-04-15 09:01+0200\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"Language: es\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"X-Generator: Poedit 3.0.1\n" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.actions.server,name:product_attachment_zipped_download.action_download_product_product_attachements | ||
#: model:ir.actions.server,name:product_attachment_zipped_download.action_download_product_template_attachements | ||
msgid "Download attachments" | ||
msgstr "Descargar adjuntos" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.model,name:product_attachment_zipped_download.model_product_product | ||
#, fuzzy | ||
msgid "Product" | ||
msgstr "Producto" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.model,name:product_attachment_zipped_download.model_product_template | ||
msgid "Product Template" | ||
msgstr "Plantilla de producto" |
30 changes: 30 additions & 0 deletions
30
product_attachment_zipped_download/i18n/product_attachment_zipped_download.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_attachment_zipped_download | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 15.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.actions.server,name:product_attachment_zipped_download.action_download_product_product_attachements | ||
#: model:ir.actions.server,name:product_attachment_zipped_download.action_download_product_template_attachements | ||
msgid "Download attachments" | ||
msgstr "" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.model,name:product_attachment_zipped_download.model_product_product | ||
msgid "Product" | ||
msgstr "" | ||
|
||
#. module: product_attachment_zipped_download | ||
#: model:ir.model,name:product_attachment_zipped_download.model_product_template | ||
msgid "Product Template" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import product_product | ||
from . import product_template |
23 changes: 23 additions & 0 deletions
23
product_attachment_zipped_download/models/product_product.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class Productproduct(models.Model): | ||
_name = "product.product" | ||
_inherit = ["product.product", "ir.attachment.action_download"] | ||
|
||
def _get_downloadable_attachments(self): | ||
"""Overwrite to get the attachments from template or variants.""" | ||
return self.env["ir.attachment"].search( | ||
[ | ||
"|", | ||
"&", | ||
("res_model", "=", "product.product"), | ||
("res_id", "in", self.ids), | ||
"&", | ||
("res_model", "=", "product.template"), | ||
("res_id", "in", self.product_tmpl_id.ids), | ||
] | ||
) |
23 changes: 23 additions & 0 deletions
23
product_attachment_zipped_download/models/product_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2024 Tecnativa - Víctor Martínez | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_name = "product.template" | ||
_inherit = ["product.template", "ir.attachment.action_download"] | ||
|
||
def _get_downloadable_attachments(self): | ||
"""Overwrite to get the attachments from template or variants.""" | ||
return self.env["ir.attachment"].search( | ||
[ | ||
"|", | ||
"&", | ||
("res_model", "=", "product.product"), | ||
("res_id", "in", self.product_variant_ids.ids), | ||
"&", | ||
("res_model", "=", "product.template"), | ||
("res_id", "in", self.ids), | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Víctor Martínez | ||
* Pedro M. Baeza |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module allows the possibility to download attachments in a .zip file of the selected products. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.