[ 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:
parent
f1291de272
commit
464adfdec9
|
|
@ -292,24 +292,6 @@ public class VPAttribute extends JComponent
|
||||||
|
|
||||||
// Exclude ability to enter ASI
|
// Exclude ability to enter ASI
|
||||||
boolean exclude = true;
|
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)
|
if (M_Product_ID != 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -148,20 +148,32 @@ public class VPAttributeDialog extends CDialog
|
||||||
*/
|
*/
|
||||||
private boolean initAttributes ()
|
private boolean initAttributes ()
|
||||||
{
|
{
|
||||||
if (m_M_Product_ID == 0)
|
if (m_M_Product_ID == 0 && !m_productWindow)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get Model
|
MAttributeSet as = null;
|
||||||
m_masi = MAttributeSetInstance.get(Env.getCtx(), m_M_AttributeSetInstance_ID, m_M_Product_ID);
|
|
||||||
if (m_masi == 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);
|
// Get Model
|
||||||
return false;
|
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());
|
else
|
||||||
|
{
|
||||||
// Get Attribute Set
|
int M_AttributeSet_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, "M_AttributeSet_ID");
|
||||||
MAttributeSet as = m_masi.getMAttributeSet();
|
m_masi = new MAttributeSetInstance (Env.getCtx(), 0, M_AttributeSet_ID, null);
|
||||||
|
as = m_masi.getMAttributeSet();
|
||||||
|
}
|
||||||
|
|
||||||
// Product has no Attribute Set
|
// Product has no Attribute Set
|
||||||
if (as == null)
|
if (as == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue