From 8ff18bfc3c7c2bff5d5ee9c815bf796de403e9a2 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 31 May 2017 13:40:03 +0200 Subject: [PATCH] Add pre and post init hook for product multi image --- product_multi_image/__init__.py | 1 + product_multi_image/__openerp__.py | 3 ++- product_multi_image/hooks.py | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/product_multi_image/__init__.py b/product_multi_image/__init__.py index 8516734f727..e2336366dbe 100644 --- a/product_multi_image/__init__.py +++ b/product_multi_image/__init__.py @@ -3,3 +3,4 @@ from . import models from .hooks import pre_init_hook +from .hooks import post_init_hook diff --git a/product_multi_image/__openerp__.py b/product_multi_image/__openerp__.py index ab4df5a5c7a..fc5ce7ff072 100644 --- a/product_multi_image/__openerp__.py +++ b/product_multi_image/__openerp__.py @@ -13,7 +13,8 @@ "license": "AGPL-3", "website": "http://www.serviciosbaeza.com", "category": "Sales Management", - #"pre_init_hook": "pre_init_hook", + "pre_init_hook": "pre_init_hook", + "post_init_hook": "post_init_hook", "depends": [ "storage_image", "product", diff --git a/product_multi_image/hooks.py b/product_multi_image/hooks.py index 976450afe76..ff15ab2739d 100644 --- a/product_multi_image/hooks.py +++ b/product_multi_image/hooks.py @@ -3,8 +3,9 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). try: - from openerp.addons.base_multi_image.hooks import ( - pre_init_hook_for_submodules) + from openerp.addons.storage_image.hooks import ( + pre_init_hook_for_submodules, + post_init_hook_for_submodules) except ImportError: # Don't complain, as this will be solved as dependency when needed pass @@ -12,3 +13,6 @@ def pre_init_hook(cr): pre_init_hook_for_submodules(cr, "product.template", "image") + +def post_init_hook(cr, registry): + post_init_hook_for_submodules(cr, "product.template", "image", "name")