From: Thomas Groutars Date: Thu, 14 Aug 2014 14:47:01 +0000 (+0200) Subject: [FIX] product: make sure unlinked product still exists X-Git-Tag: 8.0.0~25^2~24^2~7^2~7 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=397e83554b09357a227b4d4b4758739a4778748f;p=odoo%2Fodoo.git [FIX] product: make sure unlinked product still exists When uninstalling/updating a module, we may execute unlink method on product.template before product.product. In such cases, the product is already removed after removeing the template (_inherits) and the chained unlink of the product would fail (traceback when browsing). --- diff --git a/addons/product/product.py b/addons/product/product.py index ce17af7..83ab818 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -589,6 +589,9 @@ class product_product(osv.osv): unlink_ids = [] unlink_product_tmpl_ids = [] for product in self.browse(cr, uid, ids, context=context): + # Check if product still exists, in case it has been unlinked by unlinking its template + if not product.exists(): + continue tmpl_id = product.product_tmpl_id.id # Check if the product is last product of this template other_product_ids = self.search(cr, uid, [('product_tmpl_id', '=', tmpl_id), ('id', '!=', product.id)], context=context)