|
|
@ -57,18 +57,26 @@ To develop a module based on this one: |
|
|
|
|
|
|
|
* 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 :meth:`~.hooks.pre_init_hook_for_submodules`, like |
|
|
|
the ``product_multi_image`` module does:: |
|
|
|
use of the provided :meth:`~.hooks.pre_init_hook_for_submodules` and |
|
|
|
:meth:`~.hooks.uninstall_hook_for_submodules`, like the |
|
|
|
``product_multi_image`` module does:: |
|
|
|
|
|
|
|
from openerp.addons.base_multi_image.hooks import \ |
|
|
|
pre_init_hook_for_submodules |
|
|
|
|
|
|
|
|
|
|
|
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/9.0 |
|
|
|