|
@ -90,9 +90,12 @@ class Owner(models.AbstractModel): |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def unlink(self): |
|
|
def unlink(self): |
|
|
"""Mimic `ondelete="cascade"` for multi images.""" |
|
|
|
|
|
|
|
|
"""Mimic `ondelete="cascade"` for multi images. |
|
|
|
|
|
|
|
|
|
|
|
Will be skipped if ``env.context['bypass_image_removal']`` == True |
|
|
|
|
|
""" |
|
|
images = self.mapped("image_ids") |
|
|
images = self.mapped("image_ids") |
|
|
result = super(Owner, self).unlink() |
|
|
result = super(Owner, self).unlink() |
|
|
if result: |
|
|
|
|
|
|
|
|
if result and not self.env.context.get('bypass_image_removal'): |
|
|
images.unlink() |
|
|
images.unlink() |
|
|
return result |
|
|
return result |