forked from OCA/server-tools
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[17.0][MIG] base_multi_image: Migration to 17.0
- Loading branch information
Showing
20 changed files
with
208 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,19 +17,19 @@ Multiple images base | |
: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 | ||
:target: https://github.com/OCA/server-tools/tree/17.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 | ||
:target: https://translation.odoo-community.org/projects/server-tools-17-0/server-tools-17-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=16.0 | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-tools&target_branch=17.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. | ||
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** | ||
|
||
|
@@ -39,96 +39,104 @@ This module extends the functionality of any model to support multiple images | |
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. | ||
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*. | ||
- 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. | ||
- 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"] | ||
|
||
* You have to inherit model ``base_multi_image.owner`` to the model that needs | ||
the gallery:: | ||
# 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) | ||
|
||
class MyOwner(models.Model): | ||
_name = "my.model.name" | ||
_inherit = ["my.model.name", "base_multi_image.owner"] | ||
- Somewhere in the owner view, add: | ||
|
||
# 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"/> | ||
|
||
<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: | ||
|
||
* 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 | ||
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") | ||
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| | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: 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. | ||
- *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**>`_. | ||
`feedback <https://github.com/OCA/server-tools/issues/new?body=module:%20base_multi_image%0Aversion:%2017.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 | ||
|
@@ -138,28 +146,29 @@ Authors | |
* OpenFire | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Pedro M. Baeza <[email protected]> | ||
* Rafael Blasco <[email protected]> | ||
* Jairo Llopis <[email protected]> | ||
* Sodexis <[email protected]> | ||
* Dave Lasley <[email protected]> | ||
* Shepilov Vladislav <[email protected]> | ||
* `Greenice <https://www.greenice.com>`_: | ||
|
||
* Fernando La Chica <[email protected]> | ||
------------ | ||
|
||
- Pedro M. Baeza <[email protected]> | ||
- Rafael Blasco <[email protected]> | ||
- Jairo Llopis <[email protected]> | ||
- Sodexis <[email protected]> | ||
- Dave Lasley <[email protected]> | ||
- Shepilov Vladislav <[email protected]> | ||
- `Greenice <https://www.greenice.com>`__: | ||
- Fernando La Chica <[email protected]> | ||
- Ugne Sinkeviciene <[email protected]> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
------------- | ||
|
||
Original implementation | ||
----------------------- | ||
This module is inspired in previous module *product_images* from OpenLabs | ||
and Akretion. | ||
~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
This module is inspired in previous module *product_images* from | ||
OpenLabs and Akretion. | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
|
@@ -171,6 +180,6 @@ 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. | ||
This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/17.0/base_multi_image>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ msgstr "" | |
"Project-Id-Version: Odoo Server 10.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-01-06 02:24+0000\n" | ||
"PO-Revision-Date: 2024-09-09 10:06+0000\n" | ||
"PO-Revision-Date: 2024-09-11 09:06+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n" | ||
"Language: it\n" | ||
|
@@ -150,12 +150,12 @@ msgstr "Ultima modifica il" | |
#. module: base_multi_image | ||
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__write_uid | ||
msgid "Last Updated by" | ||
msgstr "Last Updated by" | ||
msgstr "Ultimo aggiornamento di" | ||
|
||
#. module: base_multi_image | ||
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__write_date | ||
msgid "Last Updated on" | ||
msgstr "Last Updated on" | ||
msgstr "Ultimo aggiornamento il" | ||
|
||
#. module: base_multi_image | ||
#: model:ir.model.fields,field_description:base_multi_image.field_base_multi_image_image__load_from | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
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](https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas)](https://runbot.odoo-community.org/runbot/149/10.0) |
Oops, something went wrong.