diff --git a/addons/product/product.py b/addons/product/product.py index 8a2765a05f3..b4db0ba4cae 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -432,6 +432,14 @@ class product_attribute_line(osv.osv): 'value_ids': fields.many2many('product.attribute.value', id1='line_id', id2='val_id', string='Product Attribute Value'), } + def _check_valid_attribute(self, cr, uid, ids, context=None): + obj_pal = self.browse(cr, uid, ids[0], context=context) + return obj_pal.value_ids <= obj_pal.attribute_id.value_ids + + _constraints = [ + (_check_valid_attribute, 'Error ! You cannot use this attribute with the following value.', ['attribute_id']) + ] + #---------------------------------------------------------- # Products