Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] base_multi_image #2618

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
874e1b9
Split model in abstract & concrete.
yajo Nov 6, 2015
6b39c2f
Extend model example.
yajo Mar 3, 2016
243143d
Tenames and typos.
yajo Mar 3, 2016
3ebb723
No default value for storage.
yajo Mar 3, 2016
895fc92
Do not require a name.
yajo Mar 3, 2016
4643cf4
Add sequence to images.
yajo Mar 3, 2016
c0a9286
Reduce methods.
yajo Mar 3, 2016
dfa3012
Cache images' URL.
yajo Mar 3, 2016
a8b56ac
Remove wrong copyright.
yajo Mar 3, 2016
d4e41ab
Add known issues section.
yajo Mar 9, 2016
920f121
Fix bug that made previous images to disappear.
yajo Mar 11, 2016
8ef1e47
[MIG][9.0] base_multi_image
atchuthan Mar 30, 2016
947ed37
[FIX] base_multi_image - New storage backend 'Filestore' to link an e…
sebalix Jun 29, 2016
c6fa135
[IMP] base_multi_image - Select only images as attachments
sebalix Jun 29, 2016
1d37f98
[FIX] base_multi_image - Clean up + updated comments
sebalix Jun 30, 2016
6603df7
[FIX] base_multi_image - Make validation error messages translatable
sebalix Jun 30, 2016
2eeb63f
[FIX] base_multi_image - Fix method name
sebalix Jun 30, 2016
65b9379
Use v9 ormcache.
yajo Jul 20, 2016
a45270d
Add a reference field to get to the owner with 1 click.
yajo Jul 20, 2016
3e0d0e9
Add uninstall hook to avoid garbage images hanging around after submo…
yajo Jul 20, 2016
1bf861d
Raise version.
yajo Jul 20, 2016
5aa044b
Add ondelete attribute, required for Many2one fields in v9.
yajo Jul 21, 2016
bc72ec4
[FIX] base_multi_image: Correct README instructions
pedrobaeza Jul 29, 2016
c01b24a
[FIX] remove en.po that was erroneously created by transbot
sbidoul Aug 15, 2016
e73fc59
[FIX] adapt to changes in binary attachment branch
hbrunn Sep 15, 2016
fdc4592
[MIG] Make modules uninstallable
pedrobaeza Oct 6, 2016
5725e1e
[MIG] Rename manifest files
pedrobaeza Oct 6, 2016
39703db
base_multi_image: Fix hook example * Add uninstall hook import to Rea…
lasley Nov 4, 2016
23859ce
[MIG] base_multi_image: Upgrade to v10
lasley Nov 10, 2016
0ccc401
[FIX] base_multi_image: Adhere to image delete bypass
lasley Nov 30, 2016
ca381ee
[FIX] base_multi_image: Use env in uninstall_hook (#677)
lasley Jan 16, 2017
02ee9dc
[10.0][FIX] base_multi_image: Uninstall hook (#709)
lasley Jan 23, 2017
f1eea43
[10.0] [IMP] base_multi_image: improve uninstall hook (#1286)
FFernandez-PlanetaTIC Jun 22, 2018
7c743fe
[MIG] base_multi_image: Migration to 12.0
Nov 8, 2019
d591b23
[FIX]base_multi_image: Fix image url in locales with thousand separator.
MPoch-PlanetaTIC Jun 11, 2020
c37c1a0
[MIG][13.0]base_multi_image: Migrated to v13
javierjcf Sep 9, 2020
20ef3ff
[IMP] base_multi_image: black, isort, prettier
hailangvn May 16, 2021
299bb96
[MIG] base_multi_image: Migration to 14.0
hailangvn May 21, 2021
c227ca6
Translated using Weblate (Spanish (Argentina))
ibuioli Mar 19, 2022
0b5b432
[15.0][MIG] base_multi_image
flachica May 6, 2022
ece3590
[UPD] Update base_multi_image.pot
Aug 8, 2022
2b95cb6
[UPD] README.rst
OCA-git-bot Aug 8, 2022
9aa270f
Translated using Weblate (Italian)
mymage Mar 23, 2023
47743ee
Translated using Weblate (Slovenian)
sysadminmatmoz Mar 31, 2023
1d93249
Translated using Weblate (Italian)
mymage Apr 10, 2023
5ee1077
Translated using Weblate (Italian)
mymage Apr 17, 2023
08ed4f0
[IMP] base_multi_image: pre-commit stuff
yibudak Apr 26, 2023
d39c0a3
[MIG] base_multi_image: Migration to 16.0
yibudak Apr 26, 2023
2a59785
[16.0][FIX] Authors as a string
yibudak Apr 26, 2023
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
183 changes: 183 additions & 0 deletions base_multi_image/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
====================
Multiple images base
====================

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

.. |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%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/16.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-16-0/server-tools-16-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/webui/builds.html?repo=OCA/server-tools&target_branch=16.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")


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
: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:%2016.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
* Yigit Budak

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>

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/16.0/base_multi_image>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 6 additions & 0 deletions base_multi_image/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# © 2014 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

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

{
"name": "Multiple images base",
"summary": "Allow multiple images for database objects",
"version": "16.0.1.0.0",
"author": "Tecnativa, "
"Antiun Ingeniería, S.L., Sodexis, "
"LasLabs, "
"Yigit Budak, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/server-tools",
"category": "Tools",
"depends": ["base"],
"installable": True,
"data": [
"security/ir.model.access.csv",
"views/image_view.xml",
],
"images": [
"images/form.png",
"images/kanban.png",
],
}
Loading