diff --git a/.copier-answers.yml b/.copier-answers.yml index fea8fb19cf..3c1afbf3fd 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.22 +_commit: v1.24 _src_path: gh:oca/oca-addons-repo-template additional_ruff_rules: [] ci: GitHub diff --git a/.gitignore b/.gitignore index 0090721f5d..2b045db399 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,15 @@ var/ *.egg *.eggs +# Debian packages +*.deb + +# Redhat packages +*.rpm + +# MacOS packages +*.dmg + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38fc2b8621..4e81dbf4d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: hooks: - id: whool-init - repo: https://github.com/oca/maintainer-tools - rev: 9a170331575a265c092ee6b24b845ec508e8ef75 + rev: d5fab7ee87fceee858a3d01048c78a548974d935 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons diff --git a/website_sale_product_attachment/README.rst b/website_sale_product_attachment/README.rst new file mode 100644 index 0000000000..5ff49bbbaf --- /dev/null +++ b/website_sale_product_attachment/README.rst @@ -0,0 +1,162 @@ +============================= +eCommerce product attachments +============================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:fce91d1fd7ce1e8d6453585605b5807b844470a247a80848571c78ec2d573cef + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/17.0/website_sale_product_attachment + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-17-0/e-commerce-17-0-website_sale_product_attachment + :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/e-commerce&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module lets you publish downloadable attachments in a product page. + +This is useful if you want to publish firmwares, manuals, specs, +warranties, or whatever document related to the product. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Instead of configuring attachments per product, to configure products +per attachment: + +1. You need permissions to access system settings. +2. Go to *Settings > Dashboard > Activate the developer mode*. +3. Go to *Settings > Technical > Database Structure > Attachments*. +4. Pick or create one. +5. Enable *Attached To > Is public document*. +6. Use the field *Attached in products* to choose the products. + +|image1| + +To be able to filter attachments per website: + +1. Go to *Website > Configuration > Settings > Website*. +2. Create more than one. +3. Go to *Settings > Technical > Database Structure > Attachments* +4. Pick or create one. +5. Select a website. +6. Save + +To toggle attachment icons in the website: + +1. Go to any product in your eCommerce. +2. Toggle *Customize > Product downloads > Download icons*. + +|image2| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/e-commerce/17.0/website_sale_product_attachment/static/description/backend-attachment.png +.. |image2| image:: https://raw.githubusercontent.com/OCA/e-commerce/17.0/website_sale_product_attachment/static/description/frontend-icons.png + +Usage +===== + +To add publicly downloadable attachments to a product template: + +1. Go to a *Website > Products > Products* in backend. +2. Pick or create one. +3. Go to the *eCommerce* tab > *Website Attachments*. +4. Add any downloadable attachments you want there. They can exist + before or be new. They must be public. +5. Save. + +|image1| + +Once you set up the product attachments, public users will be able to +download them: + +1. Go to the product eCommerce page. +2. Below the product price and description, you will find a dropdown + labeled as *Product downloads*. Click it. +3. Users will download those attachments from there. +4. Attachments will appear in name order. + +|image2| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/e-commerce/17.0/website_sale_product_attachment/static/description/backend-product.png +.. |image2| image:: https://raw.githubusercontent.com/OCA/e-commerce/17.0/website_sale_product_attachment/static/description/frontend-download.gif + +Known issues / Roadmap +====================== + +- Make translatable the name of the attachment in the e-commerce. This + will mean to deal with the sorting of the translated terms. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__: + + - Jairo Llopis + - Víctor Martínez + +- `Sygel `__: + + - Ángel García de la Chica Herrera + +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-Yajo| image:: https://github.com/Yajo.png?size=40px + :target: https://github.com/Yajo + :alt: Yajo + +Current `maintainer `__: + +|maintainer-Yajo| + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_product_attachment/__init__.py b/website_sale_product_attachment/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_sale_product_attachment/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_sale_product_attachment/__manifest__.py b/website_sale_product_attachment/__manifest__.py new file mode 100644 index 0000000000..4a174c230e --- /dev/null +++ b/website_sale_product_attachment/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2020 Tecnativa - Jairo Llopis +# Copyright 2021 Tecnativa - Víctor Martínez +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "eCommerce product attachments", + "summary": "Let visitors download attachments from a product page", + "version": "17.0.1.0.0", + "development_status": "Beta", + "category": "Website", + "website": "https://github.com/OCA/e-commerce", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["Yajo"], + "license": "LGPL-3", + "installable": True, + "depends": ["website_sale"], + "data": [ + "templates/product_template.xml", + "views/ir_attachment.xml", + "views/product_template.xml", + ], + "assets": { + "web.assets_tests": [ + "website_sale_product_attachment/static/tests/tours/website_tour.js", + ] + }, +} diff --git a/website_sale_product_attachment/i18n/ca.po b/website_sale_product_attachment/i18n/ca.po new file mode 100644 index 0000000000..f7ccf409c6 --- /dev/null +++ b/website_sale_product_attachment/i18n/ca.po @@ -0,0 +1,108 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2022-03-02 12:17+0000\n" +"Last-Translator: Noel estudillo \n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" +"\n" +" Descàrregues de productes" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created " +"here.\n" +" Removing one attachment from this list does not " +"delete\n" +" or unpublish it from your database." +msgstr "" +"\n" +" Aquí només es poden utilitzar o crear fitxers " +"adjunts públics.\n" +" L'eliminació d'un fitxer adjunt d'aquesta llista no " +"se suprimeix\n" +" o anul·leu la publicació de la vostra base de dades." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "Adjunt als productes" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "Adjunts" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" +"Adjunt que es pot baixar públicament de pàgines de comerç electrònic en " +"aquestes plantilles de producte." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "Nom del 'arxiu" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "" +"Adjunt que es pot baixar públicament de pàgines de comerç electrònic en " +"aquestes plantilles de producte." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "Nom al comerç electrònic" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" +"El nom de la descàrrega que es mostrarà a la pàgina del producte de comerç " +"electrònic. Si no s'omple, el nom del fitxer es mostrarà per defecte." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "Website Attachments" +msgstr "Adjunts del lloc web" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Website attachments" +msgstr "Adjunts del lloc web" + +#~ msgid "Product Template" +#~ msgstr "Plantilla de producte" diff --git a/website_sale_product_attachment/i18n/es.po b/website_sale_product_attachment/i18n/es.po new file mode 100644 index 0000000000..8c042213ea --- /dev/null +++ b/website_sale_product_attachment/i18n/es.po @@ -0,0 +1,108 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-09-28 07:24+0000\n" +"PO-Revision-Date: 2023-10-12 11:36+0000\n" +"Last-Translator: Ivorra78 \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: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" +"\n" +" Descargas del producto" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created " +"here.\n" +" Removing one attachment from this list does not " +"delete\n" +" or unpublish it from your database." +msgstr "" +"\n" +" Aquí solo se pueden usar o crear adjuntos públicos.\n" +" Quitar un adjunto de esta lista no lo borra\n" +" ni despublica de su base de datos." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "Adjunto en los productos" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "Adjunto" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" +"Archivo descargable públicamente desde las páginas de estas plantillas de " +"producto en la tienda del sitio web." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "Nombre del archivo" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "" +"Archivos descargables públicamente desde la página del producto en la tienda " +"del sitio web." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "Nombre en comercio electrónico" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "Producto" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" +"El nombre de la descarga que será mostrado en la página de producto del " +"comercio electrónico. Si no está rellenado, se mostrará el nombre del " +"archivo por defecto." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "Website Attachments" +msgstr "Adjuntos del sitio web" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Website attachments" +msgstr "Adjuntos del sitio web" + +#~ msgid "Product Template" +#~ msgstr "Plantilla de producto" diff --git a/website_sale_product_attachment/i18n/fr.po b/website_sale_product_attachment/i18n/fr.po new file mode 100644 index 0000000000..a2cf80c1a7 --- /dev/null +++ b/website_sale_product_attachment/i18n/fr.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-11-23 15:36+0000\n" +"Last-Translator: Yann Papouin \n" +"Language-Team: none\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" +"\n" +" Téléchargements" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created " +"here.\n" +" Removing one attachment from this list does not " +"delete\n" +" or unpublish it from your database." +msgstr "" +"\n" +" Seules les pièces jointes publiques peuvent être " +"utilisées ici\n" +" Enlever une pièce jointe de cette liste ne la " +"supprime pas\n" +" de votre base de données." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "Attaché aux produits" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "Pièce jointe" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" +"Pièce jointe téléchargeable publiquement à partir des pages de e-commerce de " +"ces modèles d'articles." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "" +"Fichiers téléchargeables publiquement à partir de la page e-commerce de " +"l'article." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "Website Attachments" +msgstr "Pièces jointes de site Web" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Website attachments" +msgstr "Pièces jointes de site Web" + +#~ msgid "Product Template" +#~ msgstr "Modèle d'article" diff --git a/website_sale_product_attachment/i18n/it.po b/website_sale_product_attachment/i18n/it.po new file mode 100644 index 0000000000..caa606a4d4 --- /dev/null +++ b/website_sale_product_attachment/i18n/it.po @@ -0,0 +1,101 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-05-08 16:34+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" +"\n" +" Allegati prodotto" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created here.\n" +" Removing one attachment from this list does not delete\n" +" or unpublish it from your database." +msgstr "" +"\n" +" Solo allegati pubblici possono essere usati o creati " +"qui.\n" +" Rimuovendo un allegato dalla lista non verrà " +"cancellato\n" +" o tolto dalla pubblicazione nel vostro database." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "Allegato nei prodotti" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "Allegato" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" +"Allegato pubblicamente scaricabile dalle pagine di e-commerce in questi " +"modelli prodotto." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "Nome file" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "Files pubblicamente scaricabili dalla pagina prodotto e-commerce." + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "Nome in e-commerce" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "Prodotto" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" +"Il nome del file che verrà mostrato nella pagina e-commerce del prodotto. Se " +"non compilato, verrà mostrato come predefinito il nome file." + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "Website Attachments" +msgstr "Allegati sito web" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Website attachments" +msgstr "Allegati sito web" diff --git a/website_sale_product_attachment/i18n/nl.po b/website_sale_product_attachment/i18n/nl.po new file mode 100644 index 0000000000..65591c9379 --- /dev/null +++ b/website_sale_product_attachment/i18n/nl.po @@ -0,0 +1,98 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-12-15 17:19+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" +"\n" +" Product downloads" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created " +"here.\n" +" Removing one attachment from this list does not " +"delete\n" +" or unpublish it from your database." +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "Bijlage" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +#, fuzzy +msgid "Website Attachments" +msgstr "Website bijlagen" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +#, fuzzy +msgid "Website attachments" +msgstr "Website bijlagen" + +#~ msgid "Product Template" +#~ msgstr "Product Sjabloon" diff --git a/website_sale_product_attachment/i18n/website_sale_product_attachment.pot b/website_sale_product_attachment/i18n/website_sale_product_attachment.pot new file mode 100644 index 0000000000..49349c49b8 --- /dev/null +++ b/website_sale_product_attachment/i18n/website_sale_product_attachment.pot @@ -0,0 +1,86 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_product_attachment +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.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: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_attachments +msgid "" +"\n" +" Product downloads" +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "" +"\n" +" Only public attachments can be used or created here.\n" +" Removing one attachment from this list does not delete\n" +" or unpublish it from your database." +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "Attached in products" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_ir_attachment +msgid "Attachment" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__attached_in_product_tmpl_ids +msgid "" +"Attachment publicly downladable from eCommerce pages in these product " +"templates." +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "File Name" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,help:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Files publicly downloadable from the product eCommerce page." +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_ir_attachment__website_name +msgid "Name in e-commerce" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model,name:website_sale_product_attachment.model_product_template +msgid "Product" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,help:website_sale_product_attachment.field_ir_attachment__website_name +msgid "" +"The name of the download that will be displayed on the e-commerce product " +"page. If not filled, the filename will be shown by default." +msgstr "" + +#. module: website_sale_product_attachment +#: model_terms:ir.ui.view,arch_db:website_sale_product_attachment.product_template_form_view +msgid "Website Attachments" +msgstr "" + +#. module: website_sale_product_attachment +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_product__website_attachment_ids +#: model:ir.model.fields,field_description:website_sale_product_attachment.field_product_template__website_attachment_ids +msgid "Website attachments" +msgstr "" diff --git a/website_sale_product_attachment/models/__init__.py b/website_sale_product_attachment/models/__init__.py new file mode 100644 index 0000000000..00d8df87cc --- /dev/null +++ b/website_sale_product_attachment/models/__init__.py @@ -0,0 +1,2 @@ +from . import ir_attachment +from . import product_template diff --git a/website_sale_product_attachment/models/ir_attachment.py b/website_sale_product_attachment/models/ir_attachment.py new file mode 100644 index 0000000000..23ba63f105 --- /dev/null +++ b/website_sale_product_attachment/models/ir_attachment.py @@ -0,0 +1,21 @@ +# Copyright 2020 Tecnativa - Jairo Llopis +# Copyright 2021 Tecnativa - Pedro M. Baeza +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class IrAttachment(models.Model): + _inherit = "ir.attachment" + + attached_in_product_tmpl_ids = fields.Many2many( + string="Attached in products", + comodel_name="product.template", + help="Attachment publicly downladable from eCommerce pages " + "in these product templates.", + ) + website_name = fields.Char( + string="Name in e-commerce", + help="The name of the download that will be displayed on the e-commerce " + "product page. If not filled, the filename will be shown by default.", + ) diff --git a/website_sale_product_attachment/models/product_template.py b/website_sale_product_attachment/models/product_template.py new file mode 100644 index 0000000000..f4fa5bea49 --- /dev/null +++ b/website_sale_product_attachment/models/product_template.py @@ -0,0 +1,48 @@ +# Copyright 2020 Tecnativa - Jairo Llopis +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + +from odoo.addons.website.models import ir_http + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + website_attachment_ids = fields.Many2many( + string="Website attachments", + comodel_name="ir.attachment", + context={"default_public": True, "hide_attachment_products": True}, + domain=lambda self, *args, **kwargs: ( + self._domain_website_attachment_ids(*args, **kwargs) + ), + help="Files publicly downloadable from the product eCommerce page.", + ) + + @api.model + def _domain_website_attachment_ids(self): + """Get domain for website attachments.""" + domain = [ + # Only use public attachments + ("public", "=", True), + # Exclude Odoo asset files to avoid confusing the user + "!", + ("name", "=ilike", "%.assets%.js"), + "!", + ("name", "=ilike", "%.assets%.css"), + "!", + ("name", "=ilike", "web_editor%"), + "!", + ("name", "=ilike", "/web/content/%.assets%.js"), + "!", + ("name", "=ilike", "/web/content/%.assets%.css"), + "!", + ("name", "=ilike", r"/web/content/%/web\_editor.summernote%.js"), + "!", + ("name", "=ilike", r"/web/content/%/web\_editor.summernote%.css"), + ] + # Filter by website domain in frontend + if ir_http.get_request_website(): + website = self.env["website"].get_current_website() + domain += website.website_domain() + return domain diff --git a/website_sale_product_attachment/pyproject.toml b/website_sale_product_attachment/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_sale_product_attachment/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_sale_product_attachment/readme/CONFIGURE.md b/website_sale_product_attachment/readme/CONFIGURE.md new file mode 100644 index 0000000000..e333dc2b6c --- /dev/null +++ b/website_sale_product_attachment/readme/CONFIGURE.md @@ -0,0 +1,27 @@ +Instead of configuring attachments per product, to configure products +per attachment: + +1. You need permissions to access system settings. +2. Go to *Settings \> Dashboard \> Activate the developer mode*. +3. Go to *Settings \> Technical \> Database Structure \> Attachments*. +4. Pick or create one. +5. Enable *Attached To \> Is public document*. +6. Use the field *Attached in products* to choose the products. + +![](../static/description/backend-attachment.png) + +To be able to filter attachments per website: + +1. Go to *Website \> Configuration \> Settings \> Website*. +2. Create more than one. +3. Go to *Settings \> Technical \> Database Structure \> Attachments* +4. Pick or create one. +5. Select a website. +6. Save + +To toggle attachment icons in the website: + +1. Go to any product in your eCommerce. +2. Toggle *Customize \> Product downloads \> Download icons*. + +![](../static/description/frontend-icons.png) diff --git a/website_sale_product_attachment/readme/CONTRIBUTORS.md b/website_sale_product_attachment/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..01a8d11c04 --- /dev/null +++ b/website_sale_product_attachment/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Tecnativa](https://www.tecnativa.com): + - Jairo Llopis + - Víctor Martínez +- [Sygel](https://www.sygel.es): + - Ángel García de la Chica Herrera diff --git a/website_sale_product_attachment/readme/DESCRIPTION.md b/website_sale_product_attachment/readme/DESCRIPTION.md new file mode 100644 index 0000000000..3fd288d8f8 --- /dev/null +++ b/website_sale_product_attachment/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module lets you publish downloadable attachments in a product page. + +This is useful if you want to publish firmwares, manuals, specs, +warranties, or whatever document related to the product. diff --git a/website_sale_product_attachment/readme/ROADMAP.md b/website_sale_product_attachment/readme/ROADMAP.md new file mode 100644 index 0000000000..6a0824f021 --- /dev/null +++ b/website_sale_product_attachment/readme/ROADMAP.md @@ -0,0 +1,2 @@ +- Make translatable the name of the attachment in the e-commerce. This + will mean to deal with the sorting of the translated terms. diff --git a/website_sale_product_attachment/readme/USAGE.md b/website_sale_product_attachment/readme/USAGE.md new file mode 100644 index 0000000000..e37a120722 --- /dev/null +++ b/website_sale_product_attachment/readme/USAGE.md @@ -0,0 +1,21 @@ +To add publicly downloadable attachments to a product template: + +1. Go to a *Website \> Products \> Products* in backend. +2. Pick or create one. +3. Go to the *eCommerce* tab \> *Website Attachments*. +4. Add any downloadable attachments you want there. They can exist + before or be new. They must be public. +5. Save. + +![](../static/description/backend-product.png) + +Once you set up the product attachments, public users will be able to +download them: + +1. Go to the product eCommerce page. +2. Below the product price and description, you will find a dropdown + labeled as *Product downloads*. Click it. +3. Users will download those attachments from there. +4. Attachments will appear in name order. + +![](../static/description/frontend-download.gif) diff --git a/website_sale_product_attachment/static/description/backend-attachment.png b/website_sale_product_attachment/static/description/backend-attachment.png new file mode 100644 index 0000000000..19ce9d905b Binary files /dev/null and b/website_sale_product_attachment/static/description/backend-attachment.png differ diff --git a/website_sale_product_attachment/static/description/backend-product.png b/website_sale_product_attachment/static/description/backend-product.png new file mode 100644 index 0000000000..bc2b890dfb Binary files /dev/null and b/website_sale_product_attachment/static/description/backend-product.png differ diff --git a/website_sale_product_attachment/static/description/frontend-download.gif b/website_sale_product_attachment/static/description/frontend-download.gif new file mode 100644 index 0000000000..05ca938a11 Binary files /dev/null and b/website_sale_product_attachment/static/description/frontend-download.gif differ diff --git a/website_sale_product_attachment/static/description/frontend-icons.png b/website_sale_product_attachment/static/description/frontend-icons.png new file mode 100644 index 0000000000..e8b897a0b3 Binary files /dev/null and b/website_sale_product_attachment/static/description/frontend-icons.png differ diff --git a/website_sale_product_attachment/static/description/icon.png b/website_sale_product_attachment/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/website_sale_product_attachment/static/description/icon.png differ diff --git a/website_sale_product_attachment/static/description/index.html b/website_sale_product_attachment/static/description/index.html new file mode 100644 index 0000000000..0b24a18676 --- /dev/null +++ b/website_sale_product_attachment/static/description/index.html @@ -0,0 +1,500 @@ + + + + + + +eCommerce product attachments + + + +
+

eCommerce product attachments

+ + +

Beta License: LGPL-3 OCA/e-commerce Translate me on Weblate Try me on Runboat

+

This module lets you publish downloadable attachments in a product page.

+

This is useful if you want to publish firmwares, manuals, specs, warranties, +or whatever document related to the product.

+

Table of contents

+ +
+

Configuration

+

Instead of configuring attachments per product, to configure products per attachment:

+
    +
  1. You need permissions to access system settings.
  2. +
  3. Go to Settings > Dashboard > Activate the developer mode.
  4. +
  5. Go to Settings > Technical > Database Structure > Attachments.
  6. +
  7. Pick or create one.
  8. +
  9. Enable Attached To > Is public document.
  10. +
  11. Use the field Attached in products to choose the products.
  12. +
+
+Attachments view in backend +
+

To be able to filter attachments per website:

+
    +
  1. Go to Website > Configuration > Settings > Website.
  2. +
  3. Create more than one.
  4. +
  5. Go to Settings > Technical > Database Structure > Attachments
  6. +
  7. Pick or create one.
  8. +
  9. Select a website.
  10. +
  11. Save
  12. +
+

To toggle attachment icons in the website:

+
    +
  1. Go to any product in your eCommerce.
  2. +
  3. Toggle Customize > Product downloads > Download icons.
  4. +
+
+Toggle icons in frontend +
+
+
+

Usage

+

To add publicly downloadable attachments to a product template:

+
    +
  1. Go to a Website > Products > Products in backend.
  2. +
  3. Pick or create one.
  4. +
  5. Go to the eCommerce tab > Website Attachments.
  6. +
  7. Add any downloadable attachments you want there. They can exist before or be new. +They must be public.
  8. +
  9. Save.
  10. +
+
+Products view in backend +
+

Once you set up the product attachments, public users will be able to download them:

+
    +
  1. Go to the product eCommerce page.
  2. +
  3. Below the product price and description, you will find a dropdown labeled as Product downloads. Click it.
  4. +
  5. Users will download those attachments from there.
  6. +
  7. Attachments will appear in name order.
  8. +
+
+Attachments view in backend +
+
+
+

Known issues / Roadmap

+
    +
  • Make translatable the name of the attachment in the e-commerce. This will +mean to deal with the sorting of the translated terms.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Jairo Llopis
    • +
    • Víctor Martínez
    • +
    +
  • +
  • Sygel:
      +
    • Ángel García de la Chica Herrera
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

Current maintainer:

+

Yajo

+

This module is part of the OCA/e-commerce project on GitHub.

+

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

+
+
+
+ + diff --git a/website_sale_product_attachment/static/tests/tours/website_tour.js b/website_sale_product_attachment/static/tests/tours/website_tour.js new file mode 100644 index 0000000000..7c2ef26a51 --- /dev/null +++ b/website_sale_product_attachment/static/tests/tours/website_tour.js @@ -0,0 +1,27 @@ +odoo.define( + "website_sale_product_attachment.tour", + ["web_tour.tour"], + function (require) { + "use strict"; + + var tour = require("web_tour.tour"); + + tour.register( + "website_sale_product_attachment_tour", + { + test: true, + url: "/shop", + stepDelay: 500, + }, + [ + { + trigger: "a:contains('Customizable Desk')", + }, + { + trigger: "a:contains('Product downloads')", + }, + ] + ); + return {}; + } +); diff --git a/website_sale_product_attachment/templates/product_template.xml b/website_sale_product_attachment/templates/product_template.xml new file mode 100644 index 0000000000..f2ce7edd89 --- /dev/null +++ b/website_sale_product_attachment/templates/product_template.xml @@ -0,0 +1,83 @@ + + + + + + diff --git a/website_sale_product_attachment/tests/__init__.py b/website_sale_product_attachment/tests/__init__.py new file mode 100644 index 0000000000..f49429ef69 --- /dev/null +++ b/website_sale_product_attachment/tests/__init__.py @@ -0,0 +1 @@ +from . import test_tour diff --git a/website_sale_product_attachment/tests/test_tour.py b/website_sale_product_attachment/tests/test_tour.py new file mode 100644 index 0000000000..2995bb0b81 --- /dev/null +++ b/website_sale_product_attachment/tests/test_tour.py @@ -0,0 +1,13 @@ +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) +# Copyright 2021 Tecnativa - Víctor Martínez + +from odoo.tests import HttpCase, tagged + + +@tagged("post_install", "-at_install") +class TestWebsiteSaleProductAttachmentTourl(HttpCase): + def test_tour(self): + attachment = self.env.ref("website.library_image_11") + product = self.env.ref("product.product_product_4_product_template") + product.website_attachment_ids = [(6, 0, [attachment.id])] + self.start_tour("/shop", "website_sale_product_attachment_tour", login="demo") diff --git a/website_sale_product_attachment/views/ir_attachment.xml b/website_sale_product_attachment/views/ir_attachment.xml new file mode 100644 index 0000000000..c8d6adf328 --- /dev/null +++ b/website_sale_product_attachment/views/ir_attachment.xml @@ -0,0 +1,26 @@ + + + + + ir.attachment.form.inherit.website - Attached to product templates + ir.attachment + + + + + + + + + + + diff --git a/website_sale_product_attachment/views/product_template.xml b/website_sale_product_attachment/views/product_template.xml new file mode 100644 index 0000000000..7c7a3aa36a --- /dev/null +++ b/website_sale_product_attachment/views/product_template.xml @@ -0,0 +1,34 @@ + + + + + Website attachments + product.template + + + + + + + + + + + + + + + + + +