diff --git a/addons/product/product.py b/addons/product/product.py index 6979947b5c0..13602f107d5 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -690,7 +690,7 @@ class product_product(osv.osv): 'default_code' : fields.char('Internal Reference', size=64, select=True), 'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the product without removing it."), 'variants': fields.char('Variants', size=64, translate=True), - 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="restrict", select=True), + 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True, ondelete="cascade", select=True), 'ean13': fields.char('EAN13 Barcode', size=13, help="International Article Number used for product identification."), 'packaging' : fields.one2many('product.packaging', 'product_id', 'Logistical Units', help="Gives the different ways to package the same product. This has no impact on the picking order and is mainly used if you use the EDI module."), 'price_extra': fields.float('Variant Price Extra', digits_compute=dp.get_precision('Product Price'), help="Price Extra: Extra price for the variant on sale price. eg. 200 price extra, 1000 + 200 = 1200."), @@ -936,8 +936,12 @@ class product_product(osv.osv): context=context) def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): - if context and context.get('search_default_categ_id'): + if context is None: + context = {} + if context.get('search_default_categ_id'): args.append((('categ_id', 'child_of', context['search_default_categ_id']))) + if context.get('search_variants'): + args.append(('variants', '!=', '')) return super(product_product, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count) diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index ac1646d6e7e..8d9048f7ae5 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -849,9 +849,9 @@ - + - + @@ -956,6 +956,7 @@ product.template kanban,tree,form form + {'search_variants': 1}