Allow multiple images for database objects
Project description
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")
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
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>
-
Fernando La Chica <fernandolachica@gmail.com>
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file odoo_addon_base_multi_image-16.0.1.0.0.5-py3-none-any.whl
.
File metadata
- Download URL: odoo_addon_base_multi_image-16.0.1.0.0.5-py3-none-any.whl
- Upload date:
- Size: 333.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8a00fd45e57a6056d73b561583a1fb044e7ab0f276746b5f451229ca68758c7 |
|
MD5 | 266d798c50a237e9387a8ce25d83ac9c |
|
BLAKE2b-256 | dafa744e4bbe3d4cdcba5635670e52937bac2ef2fcd6f2985266fa1899ab47c8 |