From ae98fa29f13849676af1bcce92fdf0b667531e93 Mon Sep 17 00:00:00 2001 From: trifonnt Date: Mon, 15 Feb 2010 11:54:46 +0000 Subject: [PATCH] BF [2947768] - Changing AttributeSet does not reset AttributeSetInstance https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2947768&group_id=176962 Tested with Postgres DB. --- base/src/org/compiere/model/MProduct.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/base/src/org/compiere/model/MProduct.java b/base/src/org/compiere/model/MProduct.java index cc3d4bbec8..e6efb5d23e 100644 --- a/base/src/org/compiere/model/MProduct.java +++ b/base/src/org/compiere/model/MProduct.java @@ -610,6 +610,19 @@ public class MProduct extends X_M_Product if (m_precision != null && is_ValueChanged("C_UOM_ID")) m_precision = null; + // AttributeSetInstance reset + if (is_ValueChanged(COLUMNNAME_M_AttributeSet_ID)) + { + MAttributeSetInstance asi = new MAttributeSetInstance(getCtx(),getM_AttributeSetInstance_ID(), get_TrxName()); + setM_AttributeSetInstance_ID(0); + // Delete the old m_attributesetinstance + if (!asi.delete(true, get_TrxName())) + { + log.saveError("Error", "Error deleting the AttributeSetInstance"); + return false; + } + } + return true; } // beforeSave