Skip to content
Snippets Groups Projects
Commit 397e8355 authored by Thomas Groutars's avatar Thomas Groutars Committed by Martin Trigaux
Browse files

[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).
parent 97d097a2
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment