Same Attribute Instance on many Products

Description

1. Select T-Shirt attribute set on Product 1 and save
2. Create Attribute Instance for Product 1 and save
3. Select T-Shirt attribute set on Product 2 and save
4. Select Attribute Instance created in second step for Product 2 and save

Now is same attribute instance attached to two products. Try to select other Attribute Set on Product 1 > cant change it because there is a log with error:

Aug 04, 2015 8:12:47 AM org.compiere.util.CLogger saveError
SEVERE: DeleteErrorDependent - ERROR: update or delete on table "m_attributesetinstance" violates foreign key constraint "mattrsetinst_mproduct" on table "m_product"
Detail: Key (m_attributesetinstance_id)=(1103825) is still referenced from table "m_product".

The reason is that attribute instance is deleted when changing attribute set on product. I am wondering why should products share same attribute instances even if they are not instancable?

I suggest one simple change which should solve this conceptual (in my opinion) mistake
> modify Attribute Instance dialog to select exisitng attribute instances which are currently not attached to any products.

Environment

None

Assignee

Carlos Ruiz

Reporter

Tomáš Švikruha

Labels

Tested By

None

Priority

Major
Configure