diff --git a/fs_base_multi_image/README.rst b/fs_base_multi_image/README.rst new file mode 100644 index 0000000000..798d4636af --- /dev/null +++ b/fs_base_multi_image/README.rst @@ -0,0 +1,119 @@ +=================== +Fs Base Multi Image +=================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:ad3bbeac958b6632a99fed3772704d6ac955048fc5657b64fdb3dd63e12e73f8 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fstorage-lightgray.png?logo=github + :target: https://github.com/OCA/storage/tree/17.0/fs_base_multi_image + :alt: OCA/storage +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/storage-17-0/storage-17-0-fs_base_multi_image + :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/storage&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon is a technical addon providing a set of models to ease the +creation of other models that need to be linked to multiple images +stored into external filesystems. + +The models provided by this addon are: + +- ``fs.image``: a model that stores a reference to an image stored into + an external filesystem. +- ``fs.image.relation.mixin``: an abstract model that can be used to as + base class for models created to store an image linked to a model. + This abstract model defines fields and methods to transparently + handle 2 cases: + + - the image is specific to the model. + - the image is shared between multiple models and therefore is a + ``fs.image`` instance linked to the mixin. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To be able to create and or manages shared images, you must have the +``Image Manager`` role. If you do not have this role, as an +authenticated user, you can only view the shared images. + +Known issues / Roadmap +====================== + +- Add dedicated widget to ease the addition of new images to a model + linked to multiple images. (As it's the case in the + *storage_image_product* addon) + +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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Laurent Mignon +- Nguyen Minh Chien + +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-lmignon| image:: https://github.com/lmignon.png?size=40px + :target: https://github.com/lmignon + :alt: lmignon + +Current `maintainer `__: + +|maintainer-lmignon| + +This module is part of the `OCA/storage `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fs_base_multi_image/__init__.py b/fs_base_multi_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/fs_base_multi_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/fs_base_multi_image/__manifest__.py b/fs_base_multi_image/__manifest__.py new file mode 100644 index 0000000000..8d663bfd95 --- /dev/null +++ b/fs_base_multi_image/__manifest__.py @@ -0,0 +1,34 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Fs Base Multi Image", + "summary": """ + Mulitple Images from External File System""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/storage", + "depends": [ + "fs_image", + ], + "data": [ + "security/res_groups.xml", + "security/fs_image.xml", + "views/fs_image.xml", + "views/fs_image_relation_mixin.xml", + ], + "assets": { + "web.assets_backend": [ + "fs_base_multi_image/static/src/fields/" + "fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js", + "fs_base_multi_image/static/src/fields/" + "fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.scss", + "fs_base_multi_image/static/src/fields/" + "fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml", + ], + }, + "demo": [], + "maintainers": ["lmignon"], + "development_status": "Alpha", +} diff --git a/fs_base_multi_image/i18n/es.po b/fs_base_multi_image/i18n/es.po new file mode 100644 index 0000000000..8ec4742f52 --- /dev/null +++ b/fs_base_multi_image/i18n/es.po @@ -0,0 +1,209 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_base_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-27 14:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\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: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js:0 +#, python-format +msgid "An error occurred during the images upload." +msgstr "Se ha producido un error durante la carga de imágenes." + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Choose how you want to store the new images:" +msgstr "Elige cómo quieres almacenar las nuevas imágenes:" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_uid +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Created by" +msgstr "Creado por" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fs_base_multi_image +#: model:ir.actions.act_window,name:fs_base_multi_image.fs_image_act_window +msgid "Fs Image" +msgstr "Imagen Fs" + +#. module: fs_base_multi_image +#: model:ir.ui.menu,name:fs_base_multi_image.fs_image_menu +msgid "Fs Images" +msgstr "Imágenes Fs" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Group By" +msgstr "Agrupar por" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_form_view +msgid "Image" +msgstr "Imagen" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_medium +msgid "Image (128)" +msgstr "Imagen (128)" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image +msgid "Image (original)" +msgstr "Imagen (original)" + +#. module: fs_base_multi_image +#: model:res.groups,name:fs_base_multi_image.group_image_manager +msgid "Image Manager" +msgstr "Administrador de Imágenes" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image_relation_mixin +msgid "Image Relation" +msgstr "Relación de Imágenes" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image_medium +msgid "Image medium" +msgstr "Imagen mediana" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_uid +msgid "Last Updated by" +msgstr "Última Actualización por" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__link_existing +msgid "Link Existing" +msgstr "Enlace Existente" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_id +msgid "Linked image" +msgstr "Imagen vinculada" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "MimeType" +msgstr "Tipo Mimo" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__mimetype +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__mimetype +msgid "Mimetype" +msgstr "Tipo Mimo" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__name +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__name +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Name" +msgstr "Nombre" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Reusable images" +msgstr "Imágenes reutilizables" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Specific" +msgstr "Específico" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image +msgid "Specific Image" +msgstr "Imagen Específica" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image_medium +msgid "Specific Image (128)" +msgstr "Imagen Específica (128)" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "You can drag and drop images to create new records or" +msgstr "Puede arrastrar y soltar imágenes para crear nuevos registros o" + +#. module: fs_base_multi_image +#. odoo-python +#: code:addons/fs_base_multi_image/models/fs_image_relation_mixin.py:0 +#, python-format +msgid "You must set an image" +msgstr "Usted debe establecer una imagen" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "click here" +msgstr "pulse aquí" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "to select image files." +msgstr "para seleccionar archivos de imagen." + +#, python-format +#~ msgid "Cannot set image on a linked image" +#~ msgstr "No se puede establecer la imagen en una imagen vinculada" + +#~ msgid "Image 128" +#~ msgstr "Imagen 128" + +#~ msgid "Specific Image 128" +#~ msgstr "Imagen Específica 128" diff --git a/fs_base_multi_image/i18n/fr.po b/fs_base_multi_image/i18n/fr.po new file mode 100644 index 0000000000..acde25a4c6 --- /dev/null +++ b/fs_base_multi_image/i18n/fr.po @@ -0,0 +1,201 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_base_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-19 10:34+0000\n" +"Last-Translator: \"Benjamin Willig (ACSONE)\" \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 4.17\n" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js:0 +#, python-format +msgid "An error occurred during the images upload." +msgstr "Une erreur est apparue lors de l'upload des images." + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Choose how you want to store the new images:" +msgstr "Choisissez où les images seront stockées :" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_uid +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Created by" +msgstr "Créé par" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_date +msgid "Created on" +msgstr "Crée le" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: fs_base_multi_image +#: model:ir.actions.act_window,name:fs_base_multi_image.fs_image_act_window +msgid "Fs Image" +msgstr "Image FS" + +#. module: fs_base_multi_image +#: model:ir.ui.menu,name:fs_base_multi_image.fs_image_menu +msgid "Fs Images" +msgstr "Images FS" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Group By" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__id +msgid "ID" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_form_view +msgid "Image" +msgstr "Image" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_medium +msgid "Image (128)" +msgstr "Image (128)" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image +msgid "Image (original)" +msgstr "Image (originale)" + +#. module: fs_base_multi_image +#: model:res.groups,name:fs_base_multi_image.group_image_manager +msgid "Image Manager" +msgstr "Gestionnaire des images" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image_relation_mixin +msgid "Image Relation" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image_medium +msgid "Image medium" +msgstr "Image moyenne" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__link_existing +msgid "Link Existing" +msgstr "Lier une image existante" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_id +msgid "Linked image" +msgstr "Image liée" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "MimeType" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__mimetype +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__mimetype +msgid "Mimetype" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__name +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__name +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Name" +msgstr "Nom" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Reusable images" +msgstr "Images réutilisables" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__sequence +msgid "Sequence" +msgstr "Séquence" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Specific" +msgstr "Spécifique" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image +msgid "Specific Image" +msgstr "Image Spécifique" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image_medium +msgid "Specific Image (128)" +msgstr "Image spécifique (128)" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "You can drag and drop images to create new records or" +msgstr "" +"Vous pouvez glisser/déposer des images pour créer des nouveaux " +"enregistrements où" + +#. module: fs_base_multi_image +#. odoo-python +#: code:addons/fs_base_multi_image/models/fs_image_relation_mixin.py:0 +#, python-format +msgid "You must set an image" +msgstr "Vous devez définir une image" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "click here" +msgstr "cliquez ici" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "to select image files." +msgstr "pour sélectionner des fichiers." diff --git a/fs_base_multi_image/i18n/fs_base_multi_image.pot b/fs_base_multi_image/i18n/fs_base_multi_image.pot new file mode 100644 index 0000000000..d19608beef --- /dev/null +++ b/fs_base_multi_image/i18n/fs_base_multi_image.pot @@ -0,0 +1,196 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_base_multi_image +# +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: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js:0 +#, python-format +msgid "An error occurred during the images upload." +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Choose how you want to store the new images:" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_uid +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Created by" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_date +msgid "Created on" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__display_name +msgid "Display Name" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.actions.act_window,name:fs_base_multi_image.fs_image_act_window +msgid "Fs Image" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.ui.menu,name:fs_base_multi_image.fs_image_menu +msgid "Fs Images" +msgstr "" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Group By" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__id +msgid "ID" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_form_view +msgid "Image" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_medium +msgid "Image (128)" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image +msgid "Image (original)" +msgstr "" + +#. module: fs_base_multi_image +#: model:res.groups,name:fs_base_multi_image.group_image_manager +msgid "Image Manager" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image_relation_mixin +msgid "Image Relation" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image_medium +msgid "Image medium" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__link_existing +msgid "Link Existing" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_id +msgid "Linked image" +msgstr "" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "MimeType" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__mimetype +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__mimetype +msgid "Mimetype" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__name +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__name +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Name" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Reusable images" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__sequence +msgid "Sequence" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Specific" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image +msgid "Specific Image" +msgstr "" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image_medium +msgid "Specific Image (128)" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "You can drag and drop images to create new records or" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-python +#: code:addons/fs_base_multi_image/models/fs_image_relation_mixin.py:0 +#, python-format +msgid "You must set an image" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "click here" +msgstr "" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "to select image files." +msgstr "" diff --git a/fs_base_multi_image/i18n/it.po b/fs_base_multi_image/i18n/it.po new file mode 100644 index 0000000000..b3c250495f --- /dev/null +++ b/fs_base_multi_image/i18n/it.po @@ -0,0 +1,209 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_base_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-01 07:22+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: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js:0 +#, python-format +msgid "An error occurred during the images upload." +msgstr "Si è verificato un errore durante il caricamento dell'immagine." + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Choose how you want to store the new images:" +msgstr "Scegliere come archiviare le nuove immagini:" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_uid +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Created by" +msgstr "Creato da" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: fs_base_multi_image +#: model:ir.actions.act_window,name:fs_base_multi_image.fs_image_act_window +msgid "Fs Image" +msgstr "Immagine FS" + +#. module: fs_base_multi_image +#: model:ir.ui.menu,name:fs_base_multi_image.fs_image_menu +msgid "Fs Images" +msgstr "Immagini FS" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Group By" +msgstr "Raggruppa per" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__id +msgid "ID" +msgstr "ID" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_form_view +msgid "Image" +msgstr "Immagine" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_medium +msgid "Image (128)" +msgstr "Immagine 128" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image +msgid "Image (original)" +msgstr "Immagine (originale)" + +#. module: fs_base_multi_image +#: model:res.groups,name:fs_base_multi_image.group_image_manager +msgid "Image Manager" +msgstr "Gestore immagine" + +#. module: fs_base_multi_image +#: model:ir.model,name:fs_base_multi_image.model_fs_image_relation_mixin +msgid "Image Relation" +msgstr "Relazione immagine" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__image_medium +msgid "Image medium" +msgstr "Immagine media" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__link_existing +msgid "Link Existing" +msgstr "Collegamento esistente" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__image_id +msgid "Linked image" +msgstr "Immagine collegata" + +#. module: fs_base_multi_image +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "MimeType" +msgstr "Tipo MIME" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__mimetype +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__mimetype +msgid "Mimetype" +msgstr "Tipo MIME" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image__name +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__name +#: model_terms:ir.ui.view,arch_db:fs_base_multi_image.fs_image_search_view +msgid "Name" +msgstr "Nome" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Reusable images" +msgstr "Immagini riutilizzabili" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__sequence +msgid "Sequence" +msgstr "Sequenza" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "Specific" +msgstr "Specifica" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image +msgid "Specific Image" +msgstr "Immagine specifica" + +#. module: fs_base_multi_image +#: model:ir.model.fields,field_description:fs_base_multi_image.field_fs_image_relation_mixin__specific_image_medium +msgid "Specific Image (128)" +msgstr "Immagine specifica (128)" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "You can drag and drop images to create new records or" +msgstr "Si possono trascinare e rilasciare immagini per creare nuovi record o" + +#. module: fs_base_multi_image +#. odoo-python +#: code:addons/fs_base_multi_image/models/fs_image_relation_mixin.py:0 +#, python-format +msgid "You must set an image" +msgstr "Bisogna impostare una immagine" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "click here" +msgstr "fare clic qui" + +#. module: fs_base_multi_image +#. odoo-javascript +#: code:addons/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml:0 +#, python-format +msgid "to select image files." +msgstr "per selezionare file immagine." + +#, python-format +#~ msgid "Cannot set image on a linked image" +#~ msgstr "Non si può impostare una immagin in una immagine collegata" + +#~ msgid "Image 128" +#~ msgstr "Immagine 128" + +#~ msgid "Specific Image 128" +#~ msgstr "Immagine specifica 128" diff --git a/fs_base_multi_image/models/__init__.py b/fs_base_multi_image/models/__init__.py new file mode 100644 index 0000000000..bada9ccdd2 --- /dev/null +++ b/fs_base_multi_image/models/__init__.py @@ -0,0 +1,2 @@ +from . import fs_image +from . import fs_image_relation_mixin diff --git a/fs_base_multi_image/models/fs_image.py b/fs_base_multi_image/models/fs_image.py new file mode 100644 index 0000000000..e2881ee682 --- /dev/null +++ b/fs_base_multi_image/models/fs_image.py @@ -0,0 +1,28 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image import fields as fs_fields + + +class FsImage(models.Model): + _name = "fs.image" + _inherit = "fs.image.mixin" + _description = "Image" + _order = "name, id" + _rec_name = "name" + + image = fs_fields.FSImage(required=True) # makes field required + name = fields.Char(compute="_compute_name", store=True, index=True) + mimetype = fields.Char(compute="_compute_mimetype", store=True) + + @api.depends("image") + def _compute_name(self): + for record in self: + record.name = record.image.name if record.image else None + + @api.depends("image") + def _compute_mimetypes(self): + for record in self: + record.mimetype = record.image.mimetype if record.image else None diff --git a/fs_base_multi_image/models/fs_image_relation_mixin.py b/fs_base_multi_image/models/fs_image_relation_mixin.py new file mode 100644 index 0000000000..bb6ebfeba4 --- /dev/null +++ b/fs_base_multi_image/models/fs_image_relation_mixin.py @@ -0,0 +1,101 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError + +from odoo.addons.fs_image import fields as fs_fields + + +class FsImageRelationMixin(models.AbstractModel): + _name = "fs.image.relation.mixin" + _description = "Image Relation" + _order = "sequence, name" + _rec_name = "name" + + sequence = fields.Integer() + image_id = fields.Many2one( + comodel_name="fs.image", + string="Linked image", + ) + specific_image = fs_fields.FSImage("Specific Image") + # resized fields stored (as attachment) for performance + specific_image_medium = fs_fields.FSImage( + "Specific Image (128)", + related="specific_image", + max_width=128, + max_height=128, + store=True, + ) + link_existing = fields.Boolean(default=False) + + image = fs_fields.FSImage( + "Image (original)", + compute="_compute_image", + inverse="_inverse_image", + store=False, + ) + # resized fields stored (as attachment) for performance + image_medium = fs_fields.FSImage( + "Image (128)", compute="_compute_image_medium", store=False + ) + + name = fields.Char(compute="_compute_name", store=True, index=True) + mimetype = fields.Char(compute="_compute_mimetype", store=True) + + @api.constrains("specific_image", "image_id") + def _check_image(self): + for record in self: + if not record.image_id and not record.specific_image: + raise ValidationError(_("You must set an image")) + + @api.depends("image") + def _compute_name(self): + for record in self: + record.name = record.image.name if record.image else None + + @api.depends("image") + def _compute_mimetypes(self): + for record in self: + record.mimetype = record.image.mimetype if record.image else None + + @api.depends("image_id", "specific_image", "link_existing") + def _compute_image(self): + for record in self: + if record.link_existing: + record.image = record.image_id.image + else: + record.image = record.specific_image + + @api.depends("image_id", "specific_image", "link_existing") + def _compute_image_medium(self): + for record in self: + if record.link_existing: + record.image_medium = record.image_id.image_medium + else: + record.image_medium = record.specific_image_medium + + def _inverse_image(self): + for record in self: + if not record.link_existing: + record.specific_image = record.image + + @api.model + def _cleanup_vals(self, vals): + if ( + "link_existing" in vals + and vals["link_existing"] + and "specific_image" in vals + ): + vals["specific_image"] = False + return vals + + @api.model_create_multi + def create(self, vals_list): + for vals in vals_list: + self._cleanup_vals(vals) + return super().create(vals_list) + + def write(self, vals): + self._cleanup_vals(vals) + return super().write(vals) diff --git a/fs_base_multi_image/pyproject.toml b/fs_base_multi_image/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/fs_base_multi_image/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/fs_base_multi_image/readme/CONTRIBUTORS.md b/fs_base_multi_image/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..da20decb6f --- /dev/null +++ b/fs_base_multi_image/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Laurent Mignon \<\> +- Nguyen Minh Chien \<\> diff --git a/fs_base_multi_image/readme/DESCRIPTION.md b/fs_base_multi_image/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a79b8da118 --- /dev/null +++ b/fs_base_multi_image/readme/DESCRIPTION.md @@ -0,0 +1,15 @@ +This addon is a technical addon providing a set of models to ease the +creation of other models that need to be linked to multiple images +stored into external filesystems. + +The models provided by this addon are: + +- `fs.image`: a model that stores a reference to an image stored into an + external filesystem. +- `fs.image.relation.mixin`: an abstract model that can be used to as + base class for models created to store an image linked to a model. + This abstract model defines fields and methods to transparently handle + 2 cases: + - the image is specific to the model. + - the image is shared between multiple models and therefore is a + `fs.image` instance linked to the mixin. diff --git a/fs_base_multi_image/readme/ROADMAP.md b/fs_base_multi_image/readme/ROADMAP.md new file mode 100644 index 0000000000..c85ff99dc1 --- /dev/null +++ b/fs_base_multi_image/readme/ROADMAP.md @@ -0,0 +1,3 @@ +- Add dedicated widget to ease the addition of new images to a model + linked to multiple images. (As it's the case in the + *storage_image_product* addon) diff --git a/fs_base_multi_image/readme/USAGE.md b/fs_base_multi_image/readme/USAGE.md new file mode 100644 index 0000000000..d49a937cdf --- /dev/null +++ b/fs_base_multi_image/readme/USAGE.md @@ -0,0 +1,3 @@ +To be able to create and or manages shared images, you must have the +`Image Manager` role. If you do not have this role, as an authenticated +user, you can only view the shared images. diff --git a/fs_base_multi_image/security/fs_image.xml b/fs_base_multi_image/security/fs_image.xml new file mode 100644 index 0000000000..b976e34f28 --- /dev/null +++ b/fs_base_multi_image/security/fs_image.xml @@ -0,0 +1,26 @@ + + + + + + fs.image access read + + + + + + + + + + fs.image access manage + + + + + + + + + diff --git a/fs_base_multi_image/security/res_groups.xml b/fs_base_multi_image/security/res_groups.xml new file mode 100644 index 0000000000..0986498120 --- /dev/null +++ b/fs_base_multi_image/security/res_groups.xml @@ -0,0 +1,10 @@ + + + + Image Manager + + + diff --git a/fs_base_multi_image/static/description/icon.png b/fs_base_multi_image/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/fs_base_multi_image/static/description/icon.png differ diff --git a/fs_base_multi_image/static/description/index.html b/fs_base_multi_image/static/description/index.html new file mode 100644 index 0000000000..381e3817cc --- /dev/null +++ b/fs_base_multi_image/static/description/index.html @@ -0,0 +1,461 @@ + + + + + +Fs Base Multi Image + + + +
+

Fs Base Multi Image

+ + +

Alpha License: AGPL-3 OCA/storage Translate me on Weblate Try me on Runboat

+

This addon is a technical addon providing a set of models to ease the +creation of other models that need to be linked to multiple images +stored into external filesystems.

+

The models provided by this addon are:

+
    +
  • fs.image: a model that stores a reference to an image stored into +an external filesystem.
  • +
  • fs.image.relation.mixin: an abstract model that can be used to as +base class for models created to store an image linked to a model. +This abstract model defines fields and methods to transparently +handle 2 cases:
      +
    • the image is specific to the model.
    • +
    • the image is shared between multiple models and therefore is a +fs.image instance linked to the mixin.
    • +
    +
  • +
+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

To be able to create and or manages shared images, you must have the +Image Manager role. If you do not have this role, as an +authenticated user, you can only view the shared images.

+
+
+

Known issues / Roadmap

+
    +
  • Add dedicated widget to ease the addition of new images to a model +linked to multiple images. (As it’s the case in the +storage_image_product addon)
  • +
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

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:

+

lmignon

+

This module is part of the OCA/storage project on GitHub.

+

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

+
+
+
+ + diff --git a/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js new file mode 100644 index 0000000000..7d0aed7446 --- /dev/null +++ b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.esm.js @@ -0,0 +1,228 @@ +/** @odoo-module **/ + +import {X2ManyField, x2ManyField} from "@web/views/fields/x2many/x2many_field"; +import {onWillRender, useRef, useState} from "@odoo/owl"; +import {registry} from "@web/core/registry"; + +export class FsImageRelationDndUploadField extends X2ManyField { + setup() { + super.setup(); + this.relationField = this.field.relation_field; + this.defaultTarget = this.props.crudOptions.target || "specific"; + this.state = useState({ + dragging: false, + target: this.defaultTarget, + }); + this.fileInput = useRef("fileInput"); + this.defaultSequence = 0; + + onWillRender(() => { + this.initDefaultSequence(); + }); + } + + get targetImage() { + return this.state.target; + } + + get displayDndZone() { + const activeActions = this.activeActions; + return ( + ("link" in activeActions ? activeActions.link : activeActions.create) && + !this.props.readonly + ); + } + + initDefaultSequence() { + let sequence = 0; + $.each(this.props.record.data[this.props.name].records, (i, record) => { + sequence = record.data.sequence; + if (sequence >= this.defaultSequence) { + this.defaultSequence = sequence + 1; + } + }); + } + + getNewSequence() { + const sequence = this.defaultSequence; + this.defaultSequence += 1; + return sequence; + } + + setDragging() { + this.state.dragging = true; + } + + setNotDragging() { + this.state.dragging = false; + } + + onDragEnter(ev) { + ev.preventDefault(); + this.setDragging(); + } + + onDragLeave(ev) { + ev.preventDefault(); + this.setNotDragging(); + } + + onClickSelectDocuments(ev) { + ev.preventDefault(); + this.fileInput.el.click(); + } + + onDrop(ev) { + ev.preventDefault(); + this.setNotDragging(); + this.uploadImages(ev.dataTransfer.files); + } + + onFilesSelected(ev) { + ev.preventDefault(); + this.uploadImages(ev.target.files); + } + + onChangeImageTarget(ev) { + this.state.target = ev.target.value; + } + + async uploadFsImage(imagesDesc) { + const self = this; + const createValues = []; + self.env.model.orm + .call("fs.image", "create", [imagesDesc]) + .then((fsImageIds) => { + let values = {}; + $.each(fsImageIds, (i, fsImageId) => { + values = self.getFsImageRelationValues(fsImageId); + createValues.push(values); + }); + }) + .then(() => { + self.createFieldRelationRecords(createValues); + }) + .catch(() => { + self.displayUploadError(); + }); + } + + displayUploadError() { + this.env.services.ui.unblock(); + this.env.services.notification.add( + this.env._t("An error occurred during the images upload."), + { + type: "danger", + sticky: true, + } + ); + } + + getFsImageRelationValues(fsImageId) { + let values = { + image_id: fsImageId, + link_existing: true, + }; + values = {...values, ...this.getRelationCommonValues()}; + return values; + } + + async uploadSpecificImage(imagesDesc) { + const self = this; + const createValues = []; + $.each(imagesDesc, (i, imageDesc) => { + createValues.push(self.getSpecificImageRelationValues(imageDesc)); + }); + self.createFieldRelationRecords(createValues); + } + + getSpecificImageRelationValues(imageDesc) { + return {...imageDesc, ...this.getRelationCommonValues()}; + } + + getRelationCommonValues() { + const values = { + sequence: this.getNewSequence(), + }; + values[this.relationField] = this.props.record.data.id; + return values; + } + + async createFieldRelationRecords(createValues) { + const self = this; + const model = self.env.model; + model.orm + .call(self.field.relation, "create", [createValues]) + .then(() => { + model.root.load(); + model.root.save(); + }) + .then(() => { + self.env.services.ui.unblock(); + }) + .catch(() => { + self.displayUploadError(); + }); + } + + async uploadImages(files) { + const self = this; + const promises = []; + this.env.services.ui.block(); + $.each(files, function (i, file) { + if (!file.type.includes("image")) { + return; + } + const filePromise = new Promise(function (resolve) { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = function (upload) { + let data = upload.target.result; + data = data.split(",")[1]; + resolve([file.name, data]); + }; + }); + promises.push(filePromise); + }); + return Promise.all(promises).then(function (fileContents) { + const imagesDesc = []; + $.each(fileContents, function (i, fileContent) { + imagesDesc.push(self.getFileImageDesc(fileContent)); + }); + if (imagesDesc.length > 0) { + switch (self.targetImage) { + case "fs_image": + self.uploadFsImage(imagesDesc); + break; + case "specific": + self.uploadSpecificImage(imagesDesc); + break; + default: + self.env.services.ui.unblock(); + } + } else { + self.env.services.ui.unblock(); + } + }); + } + + getFileImageDesc(fileContent) { + return { + image: { + filename: fileContent[0], + content: fileContent[1], + }, + }; + } +} + +FsImageRelationDndUploadField.template = "web.FsImageRelationDndUploadField"; + +export const fsImageRelationDndUploadField = { + ...x2ManyField, + component: FsImageRelationDndUploadField, +}; + +registry + .category("fields") + .add("fs_image_relation_dnd_upload", fsImageRelationDndUploadField); diff --git a/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.scss b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.scss new file mode 100644 index 0000000000..508fbe7833 --- /dev/null +++ b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.scss @@ -0,0 +1,37 @@ +.o_field_x2many { + .dnd-zone { + display: table; + padding: 10px; + width: 90%; + margin: 5px auto 10px; + min-height: 100px; + border: 1px solid transparent; + border-color: var(--notebook-link-border-color, transparent); + text-align: center; + + &.dragging-inside { + outline: 2px dashed #a096be; + outline-offset: -10px; + } + + .row { + display: table-row; + + div { + vertical-align: middle; + display: table-cell; + text-align: center; + + select[name="fs_image_target"] { + display: inline-block; + width: fit-content; + color: #01666b; + } + } + } + + input[name="files"] { + display: none; + } + } +} diff --git a/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml new file mode 100644 index 0000000000..574579b410 --- /dev/null +++ b/fs_base_multi_image/static/src/fields/fs_image_relation_dnd_upload/fs_image_relation_dnd_upload.xml @@ -0,0 +1,59 @@ + + + + + + +
+
+
+ You can drag and drop images to create new records or click here to select image files. +
+
+ +
+
+ Choose how you want to store the new images: + +
+
+ +
+
+
+
+ +
diff --git a/fs_base_multi_image/views/fs_image.xml b/fs_base_multi_image/views/fs_image.xml new file mode 100644 index 0000000000..0ecddb289d --- /dev/null +++ b/fs_base_multi_image/views/fs_image.xml @@ -0,0 +1,77 @@ + + + + + + fs.image.form (in fs_base_multi_image) + fs.image + +
+ + +
+
+
+ + + fs.image.search (in fs_base_multi_image) + fs.image + + + + + + + + + + + + + + + fs.image.tree (in fs_base_multi_image) + fs.image + + + + + + + + + + + Fs Image + fs.image + tree,form + [] + {} + + + + Fs Images + + + + +
diff --git a/fs_base_multi_image/views/fs_image_relation_mixin.xml b/fs_base_multi_image/views/fs_image_relation_mixin.xml new file mode 100644 index 0000000000..d8b8e8f486 --- /dev/null +++ b/fs_base_multi_image/views/fs_image_relation_mixin.xml @@ -0,0 +1,72 @@ + + + + + + fs.image.relation.mixin.form + fs.image.relation.mixin + +
+ + + + + + + + + + + + + +
+
+
+ + + fs.image.relation.mixin.kanban + fs.image.relation.mixin + + + + + + + +
+ X +
+
+
+
+ + + +
+
+
+
+
+ + + + + + + diff --git a/fs_product_multi_image/README.rst b/fs_product_multi_image/README.rst new file mode 100644 index 0000000000..be001ac278 --- /dev/null +++ b/fs_product_multi_image/README.rst @@ -0,0 +1,132 @@ +====================== +Fs Product Multi Image +====================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:395303e3e6bbfd77d4aa109ccfda96ceecd111fa11d146beeb941f147963995d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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%2Fstorage-lightgray.png?logo=github + :target: https://github.com/OCA/storage/tree/17.0/fs_product_multi_image + :alt: OCA/storage +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/storage-17-0/storage-17-0-fs_product_multi_image + :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/storage&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Attach images to products and categories and store them on an external +filesystem instead of the database. + +This addon is a drop-in replacement for the **storage_image_product** +addon. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +On the category and product form, a new tab allows you to add images to +the related object. The images can be specific to the model or you can +use an existing one. + +On the link forms, you can add an image tag in addition to the image. In +the specific case of the product template, you can also specify for +which variant attribute values the image is valid. + +On the product variant form, the image tag will be automatically filled +whith the image tag of the product template for the same variant +attribute values. + +In every case, a main image is computed and used as the default image +for the object. It depends on the sequence of the images (first one is +the main one). + +Changelog +========= + +16.0.1.0.2 (2023-10-04) +----------------------- + +**Bugfixes** + +- Ensures the variant_image_ids are sorted by sequence and name. Before + this change, the order was random and could change between runs. + (`#282 `__) + +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 +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Laurent Mignon +- Raphaël Reverdy +- Denis Roussel +- Quentin Groulard +- `Camptocamp `__ + + - Iván Todorovich + +- Nguyen Minh Chien + +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-lmignon| image:: https://github.com/lmignon.png?size=40px + :target: https://github.com/lmignon + :alt: lmignon + +Current `maintainer `__: + +|maintainer-lmignon| + +This module is part of the `OCA/storage `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/fs_product_multi_image/__init__.py b/fs_product_multi_image/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/fs_product_multi_image/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/fs_product_multi_image/__manifest__.py b/fs_product_multi_image/__manifest__.py new file mode 100644 index 0000000000..5babaf20dc --- /dev/null +++ b/fs_product_multi_image/__manifest__.py @@ -0,0 +1,26 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Fs Product Multi Image", + "summary": """ + Manage multi images from extenal file system on product""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/storage", + "depends": ["fs_base_multi_image", "product", "sales_team", "image_tag"], + "data": [ + "security/fs_product_category_image.xml", + "security/fs_product_image.xml", + "views/fs_product_category_image.xml", + "views/fs_product_image.xml", + "views/image_tag.xml", + "views/product_category.xml", + "views/product_product.xml", + "views/product_template.xml", + ], + "demo": [], + "maintainers": ["lmignon"], + "development_status": "Alpha", +} diff --git a/fs_product_multi_image/i18n/es.po b/fs_product_multi_image/i18n/es.po new file mode 100644 index 0000000000..940cf8fb33 --- /dev/null +++ b/fs_product_multi_image/i18n/es.po @@ -0,0 +1,227 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_product_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-27 14:36+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\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: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_image_tag__apply_on +msgid "Apply On" +msgstr "Aplicar en" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__attribute_value_ids +msgid "Attributes" +msgstr "Atributos" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__available_attribute_value_ids +msgid "Available Attributes" +msgstr "Atributos Disponibles" + +#. module: fs_product_multi_image +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__category +msgid "Category" +msgstr "Categoría" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__display_name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__display_name +msgid "Display Name" +msgstr "Mostrar Nombre" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__id +msgid "ID" +msgstr "ID (identificación)" + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +msgid "If you need to edit the images, do it from the product template." +msgstr "" +"Si necesita editar las imágenes, hágalo desde la plantilla del producto." + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.fs_product_image_kanban_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Image" +msgstr "Imagen" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_medium +msgid "Image (128)" +msgstr "Imagen (128)" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image +msgid "Image (original)" +msgstr "Imagen (original)" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_image_tag +#: model:ir.ui.menu,name:fs_product_multi_image.menu_image_tag +msgid "Image Tag" +msgstr "Etiqueta de la Imagen" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_ids +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_category_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Images" +msgstr "Imágenes" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image____last_update +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_uid +msgid "Last Updated by" +msgstr "Actualizado por Última vez por" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_date +msgid "Last Updated on" +msgstr "Última Actualización el" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__link_existing +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__link_existing +msgid "Link Existing" +msgstr "Enlace Existente" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_id +msgid "Linked image" +msgstr "Imagen vinculada" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__main_image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__main_image_id +msgid "Main Image" +msgstr "Imagen Principal" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__mimetype +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__mimetype +msgid "Mimetype" +msgstr "Tipo Mimo" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__name +msgid "Name" +msgstr "Nombre" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__product +msgid "Product" +msgstr "Producto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_category +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__product_categ_id +msgid "Product Category" +msgstr "Categoría de Producto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_category_image +msgid "Product Category Image" +msgstr "Imagen de Categoría de Producto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_image +msgid "Product Image" +msgstr "Imagen del Producto" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__product_tmpl_id +msgid "Product Template" +msgstr "Plantilla del Producto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template_attribute_line +msgid "Product Template Attribute Line" +msgstr "Plantilla de Línea de Atributo de Producto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_product +msgid "Product Variant" +msgstr "Variante del Producto" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__sequence +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image +msgid "Specific Image" +msgstr "Imagen Específica" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image_medium +msgid "Specific Image (128)" +msgstr "Imagen Específica (128)" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__tag_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__tag_id +msgid "Tag" +msgstr "Etiqueta" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__variant_image_ids +msgid "Variant Images" +msgstr "Imágenes de Variante" + +#~ msgid "Image 128" +#~ msgstr "Imagen 128" + +#~ msgid "Specific Image 128" +#~ msgstr "Imagen Específica 128" diff --git a/fs_product_multi_image/i18n/fr.po b/fs_product_multi_image/i18n/fr.po new file mode 100644 index 0000000000..6e27c17cc3 --- /dev/null +++ b/fs_product_multi_image/i18n/fr.po @@ -0,0 +1,220 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_product_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-19 10:34+0000\n" +"Last-Translator: \"Benjamin Willig (ACSONE)\" \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 4.17\n" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_image_tag__apply_on +msgid "Apply On" +msgstr "Appliqué à" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__attribute_value_ids +msgid "Attributes" +msgstr "Attributs" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__available_attribute_value_ids +msgid "Available Attributes" +msgstr "Attributs disponibles" + +#. module: fs_product_multi_image +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__category +msgid "Category" +msgstr "Catégorie" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_uid +msgid "Created by" +msgstr "Créé par" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_date +msgid "Created on" +msgstr "Créé le" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__display_name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__display_name +msgid "Display Name" +msgstr "Nom Affiché" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__id +msgid "ID" +msgstr "" + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +msgid "If you need to edit the images, do it from the product template." +msgstr "Pour éditer l'image, rendez vous sur la fiche template de produit." + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.fs_product_image_kanban_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Image" +msgstr "Image" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_medium +msgid "Image (128)" +msgstr "Image (128)" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image +msgid "Image (original)" +msgstr "Image (originale)" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_image_tag +#: model:ir.ui.menu,name:fs_product_multi_image.menu_image_tag +msgid "Image Tag" +msgstr "Tag d'image" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_ids +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_category_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Images" +msgstr "Images" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image____last_update +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__link_existing +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__link_existing +msgid "Link Existing" +msgstr "Lier une image existante" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_id +msgid "Linked image" +msgstr "Image liée" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__main_image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__main_image_id +msgid "Main Image" +msgstr "Image principale" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__mimetype +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__mimetype +msgid "Mimetype" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__name +msgid "Name" +msgstr "Nom" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__product +msgid "Product" +msgstr "Produit" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_category +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__product_categ_id +msgid "Product Category" +msgstr "Catégorie de produit" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_category_image +msgid "Product Category Image" +msgstr "Catégorie d'image de produit" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_image +msgid "Product Image" +msgstr "Image produit" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__product_tmpl_id +msgid "Product Template" +msgstr "Template d'article" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template_attribute_line +msgid "Product Template Attribute Line" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__sequence +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__sequence +msgid "Sequence" +msgstr "Séquence" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image +msgid "Specific Image" +msgstr "Image spécifique" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image_medium +msgid "Specific Image (128)" +msgstr "Image spécifique (128)" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__tag_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__tag_id +msgid "Tag" +msgstr "Tag" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__variant_image_ids +msgid "Variant Images" +msgstr "" diff --git a/fs_product_multi_image/i18n/fs_product_multi_image.pot b/fs_product_multi_image/i18n/fs_product_multi_image.pot new file mode 100644 index 0000000000..7d4543be0d --- /dev/null +++ b/fs_product_multi_image/i18n/fs_product_multi_image.pot @@ -0,0 +1,217 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_product_multi_image +# +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: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_image_tag__apply_on +msgid "Apply On" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__attribute_value_ids +msgid "Attributes" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__available_attribute_value_ids +msgid "Available Attributes" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__category +msgid "Category" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_uid +msgid "Created by" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_date +msgid "Created on" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__display_name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__display_name +msgid "Display Name" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__id +msgid "ID" +msgstr "" + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +msgid "If you need to edit the images, do it from the product template." +msgstr "" + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.fs_product_image_kanban_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_medium +msgid "Image (128)" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image +msgid "Image (original)" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_image_tag +#: model:ir.ui.menu,name:fs_product_multi_image.menu_image_tag +msgid "Image Tag" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_ids +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_category_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Images" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image____last_update +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image____last_update +msgid "Last Modified on" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_date +msgid "Last Updated on" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__link_existing +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__link_existing +msgid "Link Existing" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_id +msgid "Linked image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__main_image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__main_image_id +msgid "Main Image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__mimetype +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__mimetype +msgid "Mimetype" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__name +msgid "Name" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__product +msgid "Product" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_category +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__product_categ_id +msgid "Product Category" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_category_image +msgid "Product Category Image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_image +msgid "Product Image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__product_tmpl_id +msgid "Product Template" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template_attribute_line +msgid "Product Template Attribute Line" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_product +msgid "Product Variant" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__sequence +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__sequence +msgid "Sequence" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image +msgid "Specific Image" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image_medium +msgid "Specific Image (128)" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__tag_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__tag_id +msgid "Tag" +msgstr "" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__variant_image_ids +msgid "Variant Images" +msgstr "" diff --git a/fs_product_multi_image/i18n/it.po b/fs_product_multi_image/i18n/it.po new file mode 100644 index 0000000000..cba13ec583 --- /dev/null +++ b/fs_product_multi_image/i18n/it.po @@ -0,0 +1,226 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * fs_product_multi_image +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-01-18 11:33+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: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_image_tag__apply_on +msgid "Apply On" +msgstr "Applica a" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__attribute_value_ids +msgid "Attributes" +msgstr "Attributi" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__available_attribute_value_ids +msgid "Available Attributes" +msgstr "Attributi disponibili" + +#. module: fs_product_multi_image +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__category +msgid "Category" +msgstr "Categoria" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__create_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__display_name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__id +msgid "ID" +msgstr "ID" + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +msgid "If you need to edit the images, do it from the product template." +msgstr "Se è necessario modificare le immagini, farlo dal modello prodotto." + +#. module: fs_product_multi_image +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.fs_product_image_kanban_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Image" +msgstr "Immagine" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_medium +msgid "Image (128)" +msgstr "Immagine 128" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image +msgid "Image (original)" +msgstr "Immagine (originale)" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_image_tag +#: model:ir.ui.menu,name:fs_product_multi_image.menu_image_tag +msgid "Image Tag" +msgstr "Etichetta immagine" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_category__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__image_ids +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__image_ids +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_category_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_normal_form_view +#: model_terms:ir.ui.view,arch_db:fs_product_multi_image.product_template_only_form_view +msgid "Images" +msgstr "Immagini" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image____last_update +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_uid +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__write_date +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__link_existing +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__link_existing +msgid "Link Existing" +msgstr "Collegamento esistente" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__image_id +msgid "Linked image" +msgstr "Immagine collegata" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__main_image_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_template__main_image_id +msgid "Main Image" +msgstr "Immagine principale" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__mimetype +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__mimetype +msgid "Mimetype" +msgstr "Tipo MIME" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__name +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__name +msgid "Name" +msgstr "Nome" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template +#: model:ir.model.fields.selection,name:fs_product_multi_image.selection__image_tag__apply_on__product +msgid "Product" +msgstr "Prodotto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_category +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__product_categ_id +msgid "Product Category" +msgstr "Categoria prodotto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_category_image +msgid "Product Category Image" +msgstr "Immagine categoria prodotto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_fs_product_image +msgid "Product Image" +msgstr "Immagine prodotto" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__product_tmpl_id +msgid "Product Template" +msgstr "Modello prodotto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_template_attribute_line +msgid "Product Template Attribute Line" +msgstr "Riga attributo modello prodotto" + +#. module: fs_product_multi_image +#: model:ir.model,name:fs_product_multi_image.model_product_product +msgid "Product Variant" +msgstr "Variante prodotto" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__sequence +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__sequence +msgid "Sequence" +msgstr "Sequenza" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image +msgid "Specific Image" +msgstr "Immagine specifica" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__specific_image_medium +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__specific_image_medium +msgid "Specific Image (128)" +msgstr "Immagine specifica (128)" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_category_image__tag_id +#: model:ir.model.fields,field_description:fs_product_multi_image.field_fs_product_image__tag_id +msgid "Tag" +msgstr "Etichetta" + +#. module: fs_product_multi_image +#: model:ir.model.fields,field_description:fs_product_multi_image.field_product_product__variant_image_ids +msgid "Variant Images" +msgstr "Immagine variante" + +#~ msgid "Image 128" +#~ msgstr "Immagine 128" + +#~ msgid "Specific Image 128" +#~ msgstr "Immagine specifica 128" diff --git a/fs_product_multi_image/models/__init__.py b/fs_product_multi_image/models/__init__.py new file mode 100644 index 0000000000..17c75c0abd --- /dev/null +++ b/fs_product_multi_image/models/__init__.py @@ -0,0 +1,7 @@ +from . import fs_product_category_image +from . import fs_product_image +from . import image_tag +from . import product_category +from . import product_template +from . import product_product +from . import product_template_attribute_line diff --git a/fs_product_multi_image/models/fs_product_category_image.py b/fs_product_multi_image/models/fs_product_category_image.py new file mode 100644 index 0000000000..d0075cfd68 --- /dev/null +++ b/fs_product_multi_image/models/fs_product_category_image.py @@ -0,0 +1,24 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class FsProductCategoryImage(models.Model): + _name = "fs.product.category.image" + _inherit = "fs.image.relation.mixin" + _description = "Product Category Image" + + product_categ_id = fields.Many2one( + comodel_name="product.category", + string="Product Category", + ondelete="cascade", + index=True, + ) + + tag_id = fields.Many2one( + "image.tag", + string="Tag", + domain=[("apply_on", "=", "category")], + index=True, + ) diff --git a/fs_product_multi_image/models/fs_product_image.py b/fs_product_multi_image/models/fs_product_image.py new file mode 100644 index 0000000000..e5584be3a5 --- /dev/null +++ b/fs_product_multi_image/models/fs_product_image.py @@ -0,0 +1,50 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2018 Akretion (http://www.akretion.com). +# @author Raphaël Reverdy +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class FsProductImage(models.Model): + _name = "fs.product.image" + _inherit = "fs.image.relation.mixin" + _description = "Product Image" + + product_tmpl_id = fields.Many2one( + comodel_name="product.template", + string="Product Template", + ondelete="cascade", + index=True, + ) + attribute_value_ids = fields.Many2many( + "product.attribute.value", + string="Attributes", + domain="[('id', 'in', available_attribute_value_ids)]", + ) + # This field will list all attribute value used by the template + # in order to filter the attribute value available for the current image + available_attribute_value_ids = fields.Many2many( + "product.attribute.value", + string="Available Attributes", + compute="_compute_available_attribute", + ) + tag_id = fields.Many2one( + "image.tag", + string="Tag", + domain=[("apply_on", "=", "product")], + index=True, + ) + + @api.depends("product_tmpl_id.attribute_line_ids.value_ids") + def _compute_available_attribute(self): + for rec in self: + rec.available_attribute_value_ids = rec.product_tmpl_id.mapped( + "attribute_line_ids.value_ids" + ) + + def _match_variant(self, variant): + variant_attribute_values = variant.mapped( + "product_template_attribute_value_ids.product_attribute_value_id" + ) + return not bool(self.attribute_value_ids - variant_attribute_values) diff --git a/fs_product_multi_image/models/image_tag.py b/fs_product_multi_image/models/image_tag.py new file mode 100644 index 0000000000..e608eb21d2 --- /dev/null +++ b/fs_product_multi_image/models/image_tag.py @@ -0,0 +1,27 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2018 Akretion (http://www.akretion.com). +# @author Raphaël Reverdy +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + + +from odoo import api, fields, models + + +class ImageTag(models.Model): + _inherit = "image.tag" + + @api.model + def _get_default_apply_on(self): + active_model = self.env.context.get("active_model") + return ( + "product" + if active_model == "product.image.relation" + else "category" + if active_model == "category.image.relation" + else super()._get_default_apply_on() + ) + + apply_on = fields.Selection( + selection_add=[("product", "Product"), ("category", "Category")], + ondelete={"product": "cascade", "category": "cascade"}, + ) diff --git a/fs_product_multi_image/models/product_category.py b/fs_product_multi_image/models/product_category.py new file mode 100644 index 0000000000..5d3ba03887 --- /dev/null +++ b/fs_product_multi_image/models/product_category.py @@ -0,0 +1,18 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductCategory(models.Model): + _inherit = "product.category" + + image_ids = fields.One2many( + string="Images", + comodel_name="fs.product.category.image", + inverse_name="product_categ_id", + ) + image = FSImage(related="image_ids.image", readonly=True, store=False) + image_medium = FSImage(related="image_ids.image_medium", readonly=True, store=False) diff --git a/fs_product_multi_image/models/product_product.py b/fs_product_multi_image/models/product_product.py new file mode 100644 index 0000000000..a4fbbef167 --- /dev/null +++ b/fs_product_multi_image/models/product_product.py @@ -0,0 +1,66 @@ +# Copyright 2017 Akretion (http://www.akretion.com). +# @author Sébastien BEAU +# Copyright 2021 Camptocamp SA (http://www.camptocamp.com) +# @author Simone Orsi +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductProduct(models.Model): + _inherit = "product.product" + + variant_image_ids = fields.Many2many( + "fs.product.image", + compute="_compute_variant_image_ids", + store=True, + string="Variant Images", + ) + main_image_id = fields.Many2one( + string="Main Image", + comodel_name="fs.product.image", + compute="_compute_main_image_id", + # Store it to improve perfs + store=True, + ) + image = FSImage(related="main_image_id.image", readonly=True, store=False) + image_medium = FSImage( + related="main_image_id.image_medium", readonly=True, store=False + ) + + @api.depends( + "product_tmpl_id.image_ids", + "product_tmpl_id.image_ids.sequence", + "product_tmpl_id.image_ids.attribute_value_ids", + "product_template_attribute_value_ids", + ) + def _compute_variant_image_ids(self): + for variant in self: + variant_image_ids = variant.image_ids.filtered( + lambda i, v=variant: i._match_variant(v) + ) + variant_image_ids = variant_image_ids.sorted( + key=lambda i: (i.sequence, i.name) + ) + variant.variant_image_ids = variant_image_ids + + @api.depends("variant_image_ids", "variant_image_ids.sequence") + def _compute_main_image_id(self): + for record in self: + record.main_image_id = record._get_main_image() + + def _select_main_image(self, images): + return fields.first(images.sorted(key=lambda i: (i.sequence, i.id))).id + + def _get_main_image(self): + match_image = self.variant_image_ids.filtered( + lambda i: i.attribute_value_ids + == self.mapped( + "product_template_attribute_value_ids.product_attribute_value_id" + ) + ) + if match_image: + return self._select_main_image(match_image) + return self._select_main_image(self.variant_image_ids) diff --git a/fs_product_multi_image/models/product_template.py b/fs_product_multi_image/models/product_template.py new file mode 100644 index 0000000000..b052c47302 --- /dev/null +++ b/fs_product_multi_image/models/product_template.py @@ -0,0 +1,33 @@ +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + +from odoo.addons.fs_image.fields import FSImage + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + image_ids = fields.One2many( + string="Images", comodel_name="fs.product.image", inverse_name="product_tmpl_id" + ) + main_image_id = fields.Many2one( + string="Main Image", + comodel_name="fs.product.image", + compute="_compute_main_image_id", + # Store it to improve perfs + store=True, + ) + image = FSImage(related="main_image_id.image", readonly=True, store=False) + image_medium = FSImage( + related="main_image_id.image_medium", readonly=True, store=False + ) + + @api.depends("image_ids", "image_ids.sequence") + def _compute_main_image_id(self): + for record in self: + image_ids = record.image_ids.sorted( + key=lambda i: f"{i.sequence},{str(i.id)}" + ) + record.main_image_id = image_ids and image_ids[0] or None diff --git a/fs_product_multi_image/models/product_template_attribute_line.py b/fs_product_multi_image/models/product_template_attribute_line.py new file mode 100644 index 0000000000..13886628f5 --- /dev/null +++ b/fs_product_multi_image/models/product_template_attribute_line.py @@ -0,0 +1,30 @@ +# Copyright 2023 ACSONE SA/NV +# Copyright 2017 Akretion (http://www.akretion.com). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class ProductTemplateAttributeLine(models.Model): + _inherit = "product.template.attribute.line" + + def write(self, values): + res = super().write(values) + if "value_ids" in values: + product_image_attribute_value_ids = self.product_tmpl_id.image_ids.mapped( + "attribute_value_ids" + ).filtered(lambda x: x.attribute_id == self.attribute_id) + available_attribute_values_ids = self.value_ids + to_remove = product_image_attribute_value_ids.filtered( + lambda x: x not in available_attribute_values_ids + ) + if to_remove: + for image in self.product_tmpl_id.image_ids: + image.attribute_value_ids -= to_remove + return res + + def unlink(self): + for line in self: + for image in line.product_tmpl_id.image_ids: + image.attribute_value_ids -= line.value_ids + return super().unlink() diff --git a/fs_product_multi_image/pyproject.toml b/fs_product_multi_image/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/fs_product_multi_image/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/fs_product_multi_image/readme/CONTRIBUTORS.md b/fs_product_multi_image/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..59ab62bb12 --- /dev/null +++ b/fs_product_multi_image/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Laurent Mignon \<\> +- Raphaël Reverdy \<\> +- Denis Roussel \<\> +- Quentin Groulard \<\> +- [Camptocamp](https://www.camptocamp.com) + - Iván Todorovich \<\> +- Nguyen Minh Chien \<\> diff --git a/fs_product_multi_image/readme/DESCRIPTION.md b/fs_product_multi_image/readme/DESCRIPTION.md new file mode 100644 index 0000000000..28ccd6d7d7 --- /dev/null +++ b/fs_product_multi_image/readme/DESCRIPTION.md @@ -0,0 +1,5 @@ +Attach images to products and categories and store them on an external +filesystem instead of the database. + +This addon is a drop-in replacement for the **storage_image_product** +addon. diff --git a/fs_product_multi_image/readme/HISTORY.md b/fs_product_multi_image/readme/HISTORY.md new file mode 100644 index 0000000000..91997edda7 --- /dev/null +++ b/fs_product_multi_image/readme/HISTORY.md @@ -0,0 +1,7 @@ +## 16.0.1.0.2 (2023-10-04) + +**Bugfixes** + +- Ensures the variant_image_ids are sorted by sequence and name. Before + this change, the order was random and could change between runs. + ([\#282](https://github.com/OCA/storage/issues/282)) diff --git a/fs_product_multi_image/readme/USAGE.md b/fs_product_multi_image/readme/USAGE.md new file mode 100644 index 0000000000..b5c4257f94 --- /dev/null +++ b/fs_product_multi_image/readme/USAGE.md @@ -0,0 +1,15 @@ +On the category and product form, a new tab allows you to add images to +the related object. The images can be specific to the model or you can +use an existing one. + +On the link forms, you can add an image tag in addition to the image. In +the specific case of the product template, you can also specify for +which variant attribute values the image is valid. + +On the product variant form, the image tag will be automatically filled +whith the image tag of the product template for the same variant +attribute values. + +In every case, a main image is computed and used as the default image +for the object. It depends on the sequence of the images (first one is +the main one). diff --git a/fs_product_multi_image/readme/newsfragments/.gitignore b/fs_product_multi_image/readme/newsfragments/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/fs_product_multi_image/security/fs_product_category_image.xml b/fs_product_multi_image/security/fs_product_category_image.xml new file mode 100644 index 0000000000..20c6ec6d6b --- /dev/null +++ b/fs_product_multi_image/security/fs_product_category_image.xml @@ -0,0 +1,34 @@ + + + + + + fs.product.category.image access read + + + + + + + + + fs.product.category.image access system admin + + + + + + + + + fs.product.category.image access sales manager + + + + + + + + + diff --git a/fs_product_multi_image/security/fs_product_image.xml b/fs_product_multi_image/security/fs_product_image.xml new file mode 100644 index 0000000000..4ecbabac5d --- /dev/null +++ b/fs_product_multi_image/security/fs_product_image.xml @@ -0,0 +1,34 @@ + + + + + + fs.product.image access read + + + + + + + + + fs.product.image access erp manager + + + + + + + + + fs.product.image access sales manager + + + + + + + + + diff --git a/fs_product_multi_image/static/description/icon.png b/fs_product_multi_image/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/fs_product_multi_image/static/description/icon.png differ diff --git a/fs_product_multi_image/static/description/index.html b/fs_product_multi_image/static/description/index.html new file mode 100644 index 0000000000..dbd839cf31 --- /dev/null +++ b/fs_product_multi_image/static/description/index.html @@ -0,0 +1,471 @@ + + + + + +Fs Product Multi Image + + + +
+

Fs Product Multi Image

+ + +

Alpha License: AGPL-3 OCA/storage Translate me on Weblate Try me on Runboat

+

Attach images to products and categories and store them on an external +filesystem instead of the database.

+

This addon is a drop-in replacement for the storage_image_product +addon.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

On the category and product form, a new tab allows you to add images to +the related object. The images can be specific to the model or you can +use an existing one.

+

On the link forms, you can add an image tag in addition to the image. In +the specific case of the product template, you can also specify for +which variant attribute values the image is valid.

+

On the product variant form, the image tag will be automatically filled +whith the image tag of the product template for the same variant +attribute values.

+

In every case, a main image is computed and used as the default image +for the object. It depends on the sequence of the images (first one is +the main one).

+
+
+

Changelog

+
+

16.0.1.0.2 (2023-10-04)

+

Bugfixes

+
    +
  • Ensures the variant_image_ids are sorted by sequence and name. Before +this change, the order was random and could change between runs. +(#282)
  • +
+
+
+
+

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

+
    +
  • ACSONE SA/NV
  • +
+
+
+

Contributors

+ +
+
+

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:

+

lmignon

+

This module is part of the OCA/storage project on GitHub.

+

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

+
+
+
+ + diff --git a/fs_product_multi_image/tests/__init__.py b/fs_product_multi_image/tests/__init__.py new file mode 100644 index 0000000000..c686b22ff1 --- /dev/null +++ b/fs_product_multi_image/tests/__init__.py @@ -0,0 +1 @@ +from . import test_fs_product_multi_image diff --git a/fs_product_multi_image/tests/test_fs_product_multi_image.py b/fs_product_multi_image/tests/test_fs_product_multi_image.py new file mode 100644 index 0000000000..4d58f43116 --- /dev/null +++ b/fs_product_multi_image/tests/test_fs_product_multi_image.py @@ -0,0 +1,282 @@ +# Copyright 2017 Akretion (http://www.akretion.com). +# Copyright 2023 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import base64 +import io + +from PIL import Image + +from odoo.tests.common import TransactionCase + + +class TestFsProductMultiImage(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.white_image = cls._create_image(16, 16, color="#FFFFFF") + cls.black_image = cls._create_image(16, 16, color="#000000") + cls.logo_image = cls._create_image(16, 16, color="#FFA500") + cls.template = cls.env.ref("product.product_product_4_product_template") + cls.product_a = cls.env.ref("product.product_product_4") + cls.product_b = cls.env.ref("product.product_product_4b") + cls.product_c = cls.env.ref("product.product_product_4c") + cls.image_white = cls.env["fs.image"].create( + { + "image": { + "filename": "white.png", + "content": base64.b64encode(cls.white_image), + } + } + ) + cls.image_logo = cls.env["fs.image"].create( + { + "image": { + "filename": "logo.png", + "content": base64.b64encode(cls.logo_image), + } + } + ) + cls.image_black = cls.env["fs.image"].create( + { + "image": { + "filename": "black.png", + "content": base64.b64encode(cls.black_image), + } + } + ) + cls.is_sale_addon_installed = cls.env["ir.module.module"].search( + [("name", "=", "sale"), ("state", "=", "installed")] + ) + + def setUp(self): + super().setUp() + self.temp_dir = self.env["fs.storage"].create( + { + "name": "Temp FS Storage", + "protocol": "memory", + "code": "mem_dir", + "directory_path": "/tmp/", + "model_xmlids": "fs_product_multi_image.model_fs_product_category_image," + "fs_product_multi_image.model_fs_product_image", + } + ) + + @classmethod + def _create_image(cls, width, height, color="#4169E1", img_format="PNG"): + f = io.BytesIO() + Image.new("RGB", (width, height), color).save(f, img_format) + f.seek(0) + return f.read() + + def test_available_attribute_value(self): + # The template have already 5 attribute values + # see demo data of ipad + image = self.env["fs.product.image"].new({"product_tmpl_id": self.template.id}) + expected = 4 + if self.is_sale_addon_installed: + expected += 1 + self.assertEqual(len(image.available_attribute_value_ids), expected) + + def test_add_image_for_all_variant(self): + self.assertEqual(len(self.product_a.variant_image_ids), 0) + image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "specific_image": { + "filename": "white.png", + "content": base64.b64encode(self.white_image), + }, + } + ) + self.assertEqual(self.product_a.image.getvalue(), self.white_image) + self.assertEqual(self.product_a.variant_image_ids, image) + self.assertEqual(self.product_a.main_image_id, image) + self.assertEqual(self.product_b.image.getvalue(), self.white_image) + self.assertEqual(self.product_b.variant_image_ids, image) + self.assertEqual(self.product_b.main_image_id, image) + self.assertEqual(self.product_c.image.getvalue(), self.white_image) + self.assertEqual(self.product_c.variant_image_ids, image) + self.assertEqual(self.product_c.main_image_id, image) + + def test_add_image_for_white_variant(self): + image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_3").id]) + ], + } + ) + # White product should have the image + self.assertEqual(self.product_a.variant_image_ids, image) + self.assertEqual(self.product_a.main_image_id, image) + self.assertEqual(self.product_c.variant_image_ids, image) + self.assertEqual(self.product_c.main_image_id, image) + # Black product should not have the image + self.assertEqual(len(self.product_b.variant_image_ids), 0) + self.assertFalse(self.product_b.main_image_id) + + def _create_multiple_images(self): + logo = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_logo.id, + "sequence": 10, + "link_existing": True, + } + ) + image_wh = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_3").id]) + ], + "sequence": 2, + "link_existing": True, + } + ) + image_bk = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_black.id, + "attribute_value_ids": [ + (6, 0, [self.env.ref("product.product_attribute_value_4").id]) + ], + "sequence": 1, + "link_existing": True, + } + ) + return logo, image_wh, image_bk + + def test_add_image_for_white_and_black_variant(self): + logo, image_wh, image_bk = self._create_multiple_images() + # White product should have the white image and the logo + self.assertEqual(self.product_a.variant_image_ids, image_wh + logo) + self.assertEqual(self.product_c.variant_image_ids, image_wh + logo) + # Black product should have the black image and the logo + self.assertEqual(self.product_b.variant_image_ids, image_bk + logo) + + def test_image_variant_sequence(self): + logo, image_wh, image_bk = self._create_multiple_images() + # White product should have the white image and the logo + self.assertEqual(self.product_a.variant_image_ids, image_wh + logo) + # white product should have images sorted by sequence + self.assertListEqual( + self.product_a.variant_image_ids.mapped("sequence"), + [image_wh.sequence, logo.sequence], + ) + # change sequence + image_wh.sequence = 20 + logo.sequence = 10 + self.assertListEqual( + self.product_a.variant_image_ids.mapped("sequence"), + [logo.sequence, image_wh.sequence], + ) + + def _test_main_images(self, expected): + for image, products in expected: + for prod in products: + self.assertEqual(prod.image.getvalue(), image) + + def test_main_image_and_urls(self): + logo, image_wh, image_bk = self._create_multiple_images() + # Template should have the one w/ lower sequence + expected = ((self.black_image, self.template),) + self._test_main_images(expected) + # Should have different main images + expected = ( + (self.white_image, self.product_a + self.product_c), + (self.black_image, self.product_b), + ) + self._test_main_images(expected) + # Change image order, change main image + logo.sequence = 0 + image_wh.sequence = 10 + expected = ((self.logo_image, self.template),) + self._test_main_images(expected) + expected = ( + (self.logo_image, self.product_a + self.product_c), + (self.logo_image, self.product_b), + ) + self._test_main_images(expected) + + def test_main_image_attribute(self): + """ + Attach the image to the template and check the first image of the + variant is the one with same attributes + """ + self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_logo.id, + "sequence": 1, + "link_existing": True, + } + ) + self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_white.id, + "attribute_value_ids": [ + ( + 6, + 0, + [ + self.env.ref("product.product_attribute_value_4").id, + self.env.ref("product.product_attribute_value_1").id, + ], + ) + ], + "sequence": 10, + "link_existing": True, + } + ) + # The variant should not take the only with the lowest sequence but + # the one with same attributes + expected = ((self.white_image, self.product_b),) + self._test_main_images(expected) + expected = ((self.logo_image, self.product_c + self.product_a),) + self._test_main_images(expected) + + def test_drop_template_attribute_value_propagation_to_image(self): + black_image = self.env["fs.product.image"].create( + { + "product_tmpl_id": self.template.id, + "image_id": self.image_black.id, + "attribute_value_ids": [ + ( + 6, + 0, + [ + self.env.ref("product.product_attribute_value_4").id, + self.env.ref("product.product_attribute_value_1").id, + ], + ) + ], + "sequence": 10, + "link_existing": True, + } + ) + # Remove Color black from variant tab: + self.template.attribute_line_ids.sudo().filtered( + lambda x: x.display_name == "Color" + ).value_ids -= self.env.ref("product.product_attribute_value_4") + # Attribute black is removed from image: + self.assertTrue( + self.env.ref("product.product_attribute_value_4") + not in black_image.attribute_value_ids + ) + + # Remove Leg attribute line from variant tab: + self.template.attribute_line_ids.sudo().filtered( + lambda x: x.display_name == "Legs" + ).unlink() + # Product image attribute values from Legs are removed: + self.assertTrue( + self.env.ref("product.product_attribute_value_1") + not in black_image.attribute_value_ids + ) diff --git a/fs_product_multi_image/views/fs_product_category_image.xml b/fs_product_multi_image/views/fs_product_category_image.xml new file mode 100644 index 0000000000..acaba220aa --- /dev/null +++ b/fs_product_multi_image/views/fs_product_category_image.xml @@ -0,0 +1,21 @@ + + + + + + product.category.fs.image.form + fs.product.category.image + + primary + + + + + + + + diff --git a/fs_product_multi_image/views/fs_product_image.xml b/fs_product_multi_image/views/fs_product_image.xml new file mode 100644 index 0000000000..67c436b359 --- /dev/null +++ b/fs_product_multi_image/views/fs_product_image.xml @@ -0,0 +1,62 @@ + + + + + + fs.product.image.form + fs.product.image + + primary + + + + + + + + + + + fs.product.image.kanban + fs.product.image + + primary + + + + + +
+ Image +
+
+ +
+ +
+
+
+
+ +
diff --git a/fs_product_multi_image/views/image_tag.xml b/fs_product_multi_image/views/image_tag.xml new file mode 100644 index 0000000000..925ab53167 --- /dev/null +++ b/fs_product_multi_image/views/image_tag.xml @@ -0,0 +1,10 @@ + + + + + diff --git a/fs_product_multi_image/views/product_category.xml b/fs_product_multi_image/views/product_category.xml new file mode 100644 index 0000000000..c4e3757fd2 --- /dev/null +++ b/fs_product_multi_image/views/product_category.xml @@ -0,0 +1,35 @@ + + + + + + product.category.form + product.category + + +
+ +
+ + + + + + + + + + + +
+
+ + + +
diff --git a/fs_product_multi_image/views/product_product.xml b/fs_product_multi_image/views/product_product.xml new file mode 100644 index 0000000000..b7534f26ad --- /dev/null +++ b/fs_product_multi_image/views/product_product.xml @@ -0,0 +1,57 @@ + + + + + product.product + + + + + kanban_image('product.product', 'image_medium', record.id.raw_value) + + + + + product.product + + + + 1 + + + + + + +

+ If you need to edit the images, do it from the product template. +

+ +
+
+
+
+ + product.product + + + + 1 + + + + + + +
diff --git a/fs_product_multi_image/views/product_template.xml b/fs_product_multi_image/views/product_template.xml new file mode 100644 index 0000000000..98b4f0d2bf --- /dev/null +++ b/fs_product_multi_image/views/product_template.xml @@ -0,0 +1,59 @@ + + + + + product.template + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + product.template + + + + + kanban_image('product.template', 'image_medium', record.id.raw_value) + + + +