Metadata-Version: 2.1
Name: odoo-addon-base_multi_image
Version: 18.0.1.0.0.4
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Allow multiple images for database objects
Home-page: https://github.com/OCA/server-tools
License: AGPL-3
Author: =?utf-8?q?Tecnativa=2C_Antiun_Ingenier=C3=ADa=2C_S=2EL=2E=2C_Sodexis=2C_LasLabs=2C_Omal_Bastin_=28O4ODOO=29=2C_Odoo_Community_Association_=28OCA=29?=
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

====================
Multiple images base
====================

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

.. |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/license-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%2Fserver--tools-lightgray.png?logo=github
    :target: https://github.com/OCA/server-tools/tree/18.0/base_multi_image
    :alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/server-tools-18-0/server-tools-18-0-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/server-tools&target_branch=18.0
    :alt: Try me on Runboat

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

This module extends the functionality of any model to support multiple
images (a gallery) attached to it and allow you to manage them.

**Table of contents**

.. contents::
   :local:

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

This module adds abstract models to work on. Its sole purpose is to
serve as base for other modules that implement galleries, so if you
install this one manually you will notice no change. You should install
any other module based on this one and this will get installed
automatically.

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

To manage all stored images, you need to:

- Go to *Settings > Technical > Multi images*.

... but you probably prefer to manage them from the forms supplied by
submodules that inherit this behavior.

Development
-----------

To develop a module based on this one:

- See module ``product_multi_image`` as an example.

- You have to inherit model ``base_multi_image.owner`` to the model that
  needs the gallery:

  ::

     class MyOwner(models.Model):
         _name = "my.model.name"
         _inherit = ["my.model.name", "base_multi_image.owner"]

         # If you need this, you will need ``pre_init_hook_for_submodules`` and
           ``uninstall_hook_for_submodules`` as detailed below.
         old_image_field = fields.Binary(related="image_main", store=False)

- Somewhere in the owner view, add:

  ::

     <field
         name="image_ids"
         nolabel="1"
         context="{
             'default_owner_model': 'my.model.name',
             'default_owner_id': id,
         }"
         mode="kanban"/>

- If the model you are extending already had an image field, and you
  want to trick Odoo to make those images to multi-image mode, you will
  need to make use of the provided ~.hooks.pre_init_hook_for_submodules
  and ~.hooks.uninstall_hook_for_submodules, like the
  ``product_multi_image`` module does:

  ::

     try:
         from odoo.addons.base_multi_image.hooks import (
             pre_init_hook_for_submodules,
             uninstall_hook_for_submodules,
         )
     except ImportError:
         pass


     def pre_init_hook(cr):
         """Transform single into multi images."""
         pre_init_hook_for_submodules(cr, "product.template", "image")
         pre_init_hook_for_submodules(cr, "product.product", "image_variant")


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

|Try me on Runbot|

.. |Try me on Runbot| image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
   :target: https://runbot.odoo-community.org/runbot/149/10.0

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

- *OS file* storage mode for images is meant to provide a path where
  Odoo has read access and the image is already found, **not for making
  the module store images there**. It would be nice to add that feature
  though.

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

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

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

Credits
=======

Authors
-------

* Tecnativa
* Antiun Ingeniería
* S.L.
* Sodexis
* LasLabs
* Omal Bastin (O4ODOO)

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

- Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
- Rafael Blasco <rafabn@antiun.com>
- Jairo Llopis <yajo.sk8@gmail.com>
- Sodexis <dev@sodexis.com>
- Dave Lasley <dave@laslabs.com>
- Shepilov Vladislav <shepilov.v@protonmail.com>
- `Greenice <https://www.greenice.com>`__:

  - Fernando La Chica <fernandolachica@gmail.com>

- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`__

  - Bhavesh Heliconia

Other credits
-------------

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/server-tools <https://github.com/OCA/server-tools/tree/18.0/base_multi_image>`_ project on GitHub.

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