Multiple images base
(0)
142

Multiple images base

FREE

Technical name
base_multi_image
License
AGPL-3
Secure dependencies
N/A
Multiple images base

Multiple images base

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runboat

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

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_1920", 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.post_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 (
            uninstall_hook_for_submodules,
        )
    except ImportError:
        pass
    
    
    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

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. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.

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

Credits

Authors

  • Tecnativa
  • Antiun Ingeniería
  • S.L.
  • Sodexis
  • LasLabs
  • OpenFire

Contributors

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.

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.

This module is part of the OCA/server-tools project on GitHub.

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

0.0 / 5.0
based on 0 ratings

Python dependencies

Package Version Secured
requests 2.22.0
Pillow 11.2.1

Available languages

Language % translated
Italian / Italiano
100%
French / Français
69%
Croatian / hrvatski jezik
54%
Spanish (AR) / Español (AR)
54%
German / Deutsch
51%
Slovenian / slovenščina
48%
Chinese (Simplified) / 简体中文
42%
Finnish / Suomi
24%
Slovak / Slovenský jazyk
24%
Japanese / 日本語
24%
Hungarian / Magyar
24%
Spanish (VE) / Español (VE)
24%
English (UK)
24%
Estonian / Eesti keel
24%
Chinese (Traditional) / 繁體中文
24%
Portuguese (BR) / Português (BR)
24%
Turkish / Türkçe
24%
Thai / ภาษาไทย
24%
Spanish (EC) / Español (EC)
24%
Dutch / Nederlands
24%
Spanish (PE) / Español (PE)
24%
Dutch (BE) / Nederlands (BE)
24%
Bosnian / bosanski jezik
24%
Portuguese / Português
24%
Vietnamese / Tiếng Việt
24%
Ukrainian / українська
24%
Spanish (MX) / Español (MX)
24%
Spanish (CO) / Español (CO)
24%
Turkish / Türkçe
24%
Polish / Język polski
24%
Bulgarian / български език
24%
Romanian / română
24%
Mongolian / монгол
24%
Swedish / Svenska
24%
Macedonian / македонски јазик
24%
Hebrew / עִבְרִי
24%
Indonesian / Bahasa Indonesia
24%
Persian / فارس
24%
Dutch / Nederlands
24%
Spanish (CL) / Español (CL)
24%
Spanish (DO) / Español (DO)
24%
Arabic / الْعَرَبيّة
24%
Serbian (Latin) / srpski
24%
Spanish / Español
21%
Norwegian Bokmål / Norsk bokmål
21%
Croatian / hrvatski jezik
21%
Spanish / Español
21%
French (CH) / Français (CH)
21%
Portuguese / Português
21%
Greek / Ελληνικά
18%
French (CA) / Français (CA)
18%
Spanish (CR) / Español (CR)
18%
Russian / русский язык
18%
Latvian / latviešu valoda
18%
Spanish (PY) / Español (PY)
18%
Vietnamese / Tiếng Việt
15%
Lithuanian / Lietuvių kalba
15%
Lithuanian / Lietuvių kalba
15%
Galician / Galego
3%
Galician / Galego
3%