Browse Source

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

pull/713/head
Dave Lasley 8 years ago
committed by Pedro M. Baeza
parent
commit
5d71aafb12
  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