[FIX] product: _check_valid_attribute

To check if the values set for the attribute are valid.

opw:653945
This commit is contained in:
Goffin Simon 2015-11-13 17:28:47 +01:00
parent c054350dac
commit 856b31719c
1 changed files with 8 additions and 0 deletions

View File

@ -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