[ 1753074 ] Can't open attribute instance window for new product

- better fix, don't have to auto save product first.
This commit is contained in:
Heng Sin Low 2007-12-06 15:50:14 +00:00
parent f1291de272
commit 464adfdec9
2 changed files with 23 additions and 29 deletions

View File

@ -292,24 +292,6 @@ public class VPAttribute extends JComponent
// Exclude ability to enter ASI
boolean exclude = true;
//auto save for new product
if (M_Product_ID == 0)
{
JFrame frame = Env.getWindow(m_WindowNo);
if (frame instanceof AWindow)
{
AWindow aWindow = (AWindow)frame;
if (aWindow.getAPanel().getCurrentTab().getTableName().equalsIgnoreCase("M_Product"))
{
if (aWindow.getAPanel().cmd_save(true))
{
Object value = aWindow.getAPanel().getCurrentTab().getValue("M_Product_ID");
if (value != null && value instanceof Integer)
M_Product_ID = ((Integer)value).intValue();
}
}
}
}
if (M_Product_ID != 0)
{

View File

@ -148,20 +148,32 @@ public class VPAttributeDialog extends CDialog
*/
private boolean initAttributes ()
{
if (m_M_Product_ID == 0)
if (m_M_Product_ID == 0 && !m_productWindow)
return false;
// Get Model
m_masi = MAttributeSetInstance.get(Env.getCtx(), m_M_AttributeSetInstance_ID, m_M_Product_ID);
if (m_masi == null)
MAttributeSet as = null;
if (m_M_Product_ID != 0)
{
log.severe ("No Model for M_AttributeSetInstance_ID=" + m_M_AttributeSetInstance_ID + ", M_Product_ID=" + m_M_Product_ID);
return false;
// Get Model
m_masi = MAttributeSetInstance.get(Env.getCtx(), m_M_AttributeSetInstance_ID, m_M_Product_ID);
if (m_masi == null)
{
log.severe ("No Model for M_AttributeSetInstance_ID=" + m_M_AttributeSetInstance_ID + ", M_Product_ID=" + m_M_Product_ID);
return false;
}
Env.setContext(Env.getCtx(), m_WindowNo, "M_AttributeSet_ID", m_masi.getM_AttributeSet_ID());
// Get Attribute Set
as = m_masi.getMAttributeSet();
}
Env.setContext(Env.getCtx(), m_WindowNo, "M_AttributeSet_ID", m_masi.getM_AttributeSet_ID());
// Get Attribute Set
MAttributeSet as = m_masi.getMAttributeSet();
else
{
int M_AttributeSet_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, "M_AttributeSet_ID");
m_masi = new MAttributeSetInstance (Env.getCtx(), 0, M_AttributeSet_ID, null);
as = m_masi.getMAttributeSet();
}
// Product has no Attribute Set
if (as == null)
{