Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions product_multi_image/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
===========================
Multiple Images in Products
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/14.0/product_multi_image
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_multi_image
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/135/14.0
:alt: Try me on Runbot

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

This module implements the possibility to have multiple images for a product
template, a.k.a. an image gallery.

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you need to:

* Install ``base_multi_image`` from
`OCA/server-tools <https://github.com/OCA/server-tools>`_.

Configuration
=============

You can manage your images at Product template level:

#. Go to *Sales > Products > Products* and choose a product template.
#. Go to the *Images* tab.
#. Add a new image or edit the existing ones.
#. You can select for which variants you want to make available the image.
Keep it empty for making visible in all.
#. Refresh the page.
#. The first image in the collection is the main image for the product
template.

Going to product variants form, you can manage also your images, but take
into account this behaviour:

#. Go to *Sales > Products > Product Variants* and choose a product variant.
#. If you add an image here, the image is actually added to the product
template, and restricted to this variant.
#. When editing an existing image, the image is changed generally for all
the variants where is enabled, not only for this variant.
#. When removing an image from this form, if the image is only in this variant,
the image is removed. Otherwise, the image gets restricted to the rest of
the variants where is available.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/135/9.0

Known issues / Roadmap
======================

* When you change the image on the product variant, the preview image of the
*Images* tab doesn't get refreshed until you refresh the browser, or if you
go to its template, but the image has been actually saved!
* The field "Available in these variants" appears when opening the image
from the product variant.
* Add logic for handling to add images with the same name that another variant
of the same template, renaming the new image to a unique name.
* Add logic for handling to add the same image in several variants to a
already in another variant for not duplicating bytes.
* Provide proper migration scripts from module product_images from 7.0.
* Migrate to v8 api when https://github.com/odoo/odoo/issues/10799 gets fixed.
* If you try to sort images before saving the product variant or template, you
will get an error similar to ``DataError: invalid input syntax for integer:
"one2many_v_id_62"``. This bug has not been fixed yet, but a workaround is to
save and edit again to sort images.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_multi_image%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Antiun Ingeniería
* Tecnativa
* LasLabs

Contributors
~~~~~~~~~~~~

* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Rafael Blasco <rafabn@antiun.com>
* Jairo Llopis <yajo.sk8@gmail.com>
* Dave Lasley <dave@laslabs.com>
* Shepilov Vladislav <shepilov.v@protonmail.com>
* Marc Poch Mallandrich <mpoch@planetatic.com>
* Hai Lang <hailn@trobz.com>

Other credits
~~~~~~~~~~~~~

* The migration of this module from 12.0 to 14.0 was financially supported by
Camptocamp.

Original implementation
-----------------------
* This module is inspired in previous module *product_images* from OpenLabs
and Akretion.

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

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

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/14.0/product_multi_image>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions product_multi_image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3).

from . import models
from .hooks import pre_init_hook, uninstall_hook
32 changes: 32 additions & 0 deletions product_multi_image/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# © 2014-2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Multiple Images in Products",
"version": "15.0.1.0.0",
"author": "Antiun Ingeniería, "
"Tecnativa, "
"LasLabs, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/product-attribute",
"category": "Sales Management",
"pre_init_hook": "pre_init_hook",
"uninstall_hook": "uninstall_hook",
"depends": [
"base_multi_image",
"product",
],
"data": [
"views/image_view.xml",
"views/product_template_view.xml",
],
"installable": True,
"images": [
"images/product.png",
"images/db.png",
"images/file.png",
"images/url.png",
],
}
25 changes: 25 additions & 0 deletions product_multi_image/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# © 2016 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import logging

_logger = logging.getLogger(__name__)


try:
from odoo.addons.base_multi_image.hooks import (
pre_init_hook_for_submodules,
uninstall_hook_for_submodules,
)
except ImportError:
_logger.info("Cannot import base_multi_image hooks")


def pre_init_hook(cr):
pre_init_hook_for_submodules(cr, "product.template", "image_1920")
pre_init_hook_for_submodules(cr, "product.product", "image_variant_1920")


def uninstall_hook(cr, registry):
"""Remove multi images for models that no longer use them."""
uninstall_hook_for_submodules(cr, registry, "product.template")
uninstall_hook_for_submodules(cr, registry, "product.product")
118 changes: 118 additions & 0 deletions product_multi_image/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_multi_image
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-05-21 10:58+0000\n"
"PO-Revision-Date: 2021-05-21 10:58+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_multi_image
#: model:ir.model,name:product_multi_image.model_base_multi_image_image
msgid " image model for multiple image functionality "
msgstr ""

#. module: product_multi_image
#: model_terms:ir.ui.view,arch_db:product_multi_image.image_form_view
msgid "(keep empty for being visible for all variants)"
msgstr "(dejar vacío para hacerlo visible para todas las variantes)"

#. module: product_multi_image
#: model_terms:ir.ui.view,arch_db:product_multi_image.image_kanban_view
msgid "<i>Visible in all variants</i>"
msgstr "<i>Visible en todas las variantes</i>"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_base_multi_image_image__display_name
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__display_name
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__display_name
msgid "Display Name"
msgstr ""

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_base_multi_image_image__id
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__id
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__id
msgid "ID"
msgstr ""

#. module: product_multi_image
#: model:ir.model.fields,help:product_multi_image.field_base_multi_image_image__product_variant_ids
msgid ""
"If you leave it empty, all variants will show this image. Selecting one or "
"several of the available variants, you restrict the availability of the "
"image to those variants."
msgstr ""
"Si lo deja vacío, todas las variantes mostrarán esta imagen. Seleccionando "
"una o más de las variantes disponibles, restringirá la disponibilidad de la "
"imagen a esas variantes."

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__image_ids
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__image_ids
#: model_terms:ir.ui.view,arch_db:product_multi_image.view_product_template_form_img_inh
msgid "Images"
msgstr "Imágenes"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_base_multi_image_image____last_update
#: model:ir.model.fields,field_description:product_multi_image.field_product_product____last_update
#: model:ir.model.fields,field_description:product_multi_image.field_product_template____last_update
msgid "Last Modified on"
msgstr ""

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__image_main
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__image_main
msgid "Main image"
msgstr "Imagen principal"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__image_main_medium
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__image_main_medium
msgid "Medium image"
msgstr "Imagen media"

#. module: product_multi_image
#: model:ir.model,name:product_multi_image.model_product_product
msgid "Product"
msgstr "Producto"

#. module: product_multi_image
#: model:ir.model,name:product_multi_image.model_product_template
msgid "Product Template"
msgstr "Plantilla de producto"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_base_multi_image_image__product_variant_count
msgid "Product Variant Count"
msgstr "Nº de variantes"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_product_product__image_main_small
#: model:ir.model.fields,field_description:product_multi_image.field_product_template__image_main_small
msgid "Small image"
msgstr "Imagen pequeña"

#. module: product_multi_image
#: model_terms:ir.ui.view,arch_db:product_multi_image.image_kanban_view
msgid "Visible in"
msgstr "Visible en"

#. module: product_multi_image
#: model:ir.model.fields,field_description:product_multi_image.field_base_multi_image_image__product_variant_ids
msgid "Visible in these variants"
msgstr "Visible en estas variantes"

#. module: product_multi_image
#: model_terms:ir.ui.view,arch_db:product_multi_image.image_kanban_view
msgid "variant(s)"
msgstr "variante(s)"
Loading