Browse Source
[FIX] base_multi_image: Adhere to image delete bypass
* Add catch in owner unlink to allow for image delete bypass via context
pull/628/head
Dave Lasley
8 years ago
No known key found for this signature in database
GPG Key ID: 7DDBA4BA81B934CF
3 changed files with
8 additions and
3 deletions
-
base_multi_image/README.rst
-
base_multi_image/__openerp__.py
-
base_multi_image/models/owner.py
|
@ -121,6 +121,7 @@ Contributors |
|
|
* Rafael Blasco <rafabn@antiun.com> |
|
|
* Rafael Blasco <rafabn@antiun.com> |
|
|
* Jairo Llopis <yajo.sk8@gmail.com> |
|
|
* Jairo Llopis <yajo.sk8@gmail.com> |
|
|
* Sodexis <dev@sodexis.com> |
|
|
* Sodexis <dev@sodexis.com> |
|
|
|
|
|
* Dave Lasley <dave@laslabs.com> |
|
|
|
|
|
|
|
|
Maintainer |
|
|
Maintainer |
|
|
---------- |
|
|
---------- |
|
|
|
@ -9,8 +9,9 @@ |
|
|
"name": "Multiple images base", |
|
|
"name": "Multiple images base", |
|
|
"summary": "Allow multiple images for database objects", |
|
|
"summary": "Allow multiple images for database objects", |
|
|
"version": "9.0.1.1.0", |
|
|
"version": "9.0.1.1.0", |
|
|
"author": "Serv. Tecnol. Avanzados - Pedro M. Baeza, " |
|
|
|
|
|
|
|
|
"author": "Tecnativa, " |
|
|
"Antiun Ingeniería, S.L., Sodexis, " |
|
|
"Antiun Ingeniería, S.L., Sodexis, " |
|
|
|
|
|
"LasLabs, " |
|
|
"Odoo Community Association (OCA)", |
|
|
"Odoo Community Association (OCA)", |
|
|
"license": "AGPL-3", |
|
|
"license": "AGPL-3", |
|
|
"website": "http://www.antiun.com", |
|
|
"website": "http://www.antiun.com", |
|
|
|
@ -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 |