Browse Source

[10.0][FIX] base_multi_image: Uninstall hook (#709)

12.0-mig-module_prototyper_last
Dave Lasley 7 years ago
committed by Vladislav Shepilov
parent
commit
f4afb49e4f
  1. 10
      base_multi_image/hooks.py

10
base_multi_image/hooks.py

@ -20,7 +20,7 @@ def pre_init_hook_for_submodules(cr, model, field):
Binary field that had the images in that :param:`model`, like
``image``.
"""
env = api.Environment(cr, SUPERUSER_ID, dict())
env = api.Environment(cr, SUPERUSER_ID, {})
with cr.savepoint():
table = env[model]._table
column_exists = table_has_column(cr, table, field)
@ -76,9 +76,11 @@ def uninstall_hook_for_submodules(cr, registry, model):
Model technical name, like "res.partner". All multi-images for that
model will be deleted
"""
Image = registry["base_multi_image.image"]
images = Image.search([("owner_model", "=", model)])
images.unlink()
env = api.Environment(cr, SUPERUSER_ID, {})
with cr.savepoint():
Image = env["base_multi_image.image"]
images = Image.search([("owner_model", "=", model)])
images.unlink()
def table_has_column(cr, table, field):

Loading…
Cancel
Save