Hi Cedk,

On 19 Aug 2010, at 12:18, Cédric Krier wrote:

> On 18/08/10 18:25 +0200, Mathias Behrle wrote:
>> * Betr.: " [tryton-dev] Product Attributes EAV model" (Wed, 18 Aug 2010
>>  13:46:55 +0100):
>> 
>>> Hello All,
>>> 
>>> We have built a POC for the EAV [1] model of storing product attibutes. 
>>> Quite
>>> often we have to add extra fields to product depending on specific customer
>>> installations. Like color, manufacturer etc.
>>> 
>>> This is a general approach to the problem by having a relationship between
>>> products and attributes just like contact mechanisms of party.
>>> 
>>> I request your comments and code review on the same.
>>> 
>>> [1] http://en.wikipedia.org/wiki/Entity-attribute-value_model
>> 
>> Very interesting concept, thanks a lot!
>> 
>> For an even more generic generic way, I would even favor to put models
>> 
>> ProductAttributes -> Attribute
>> ProductAttributeOptions -> AttributeOption
>> 
>> in a separate module attribute (thus they could be (re)used on a number of
>> different objects where the same concept could be required (like party in 
>> [1]))
>> 
>> and to do only the product specific implementation in module 
>> product_attribute
>> containing models
> 
> But what will be the advantage to have all atributes in one table?
> Because you will have the same attribute available for any Model, I find it
> strange.
> 
Not exactly:

Attribute
======
model: - The model for which the attribute is valid for
name: - Name of attribute
type: - Data type of the attribute
options: o2m Attribute option

AttributeOption
============
attribute m2o attribute
values - the option value

AttributeValue
===========

entity: reference field (model, id)
attribute: m2o Attribute
value: value of attribute

So infact the attribute is domain[ed] on the model. So only relevant attributes 
should get displayed in the corresponding object.

Hope it sounds ok ?

Thanks,

> 
> -- 
> Cédric Krier
> 
> B2CK SPRL
> Rue de Rotterdam, 4
> 4000 Liège
> Belgium
> Tel: +32 472 54 46 59
> Email/Jabber: [email protected]
> Website: http://www.b2ck.com/

-- 
[email protected] mailing list

Reply via email to