[ 2002318 ] Context WINDOW_INFO bug
https://sourceforge.net/tracker/index.php?func=detail&aid=2002318&group_id=176962&atid=879332 Same issue on Internal Use Inventory: * when selecting a product by "actionText", the TAB_INFO and windows's ASI is not reseting Please review.
This commit is contained in:
parent
9186b12bba
commit
054d256ac3
|
@ -1,5 +1,5 @@
|
|||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
|
@ -73,13 +73,20 @@ public class CalloutInventory extends CalloutEngine
|
|||
if (ASI != null)
|
||||
M_AttributeSetInstance_ID = ASI.intValue();
|
||||
// Product Selection
|
||||
if (Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Product_ID") == M_Product_ID)
|
||||
if (MInventoryLine.COLUMNNAME_M_Product_ID.equals(mField.getColumnName()))
|
||||
{
|
||||
M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID");
|
||||
if (M_AttributeSetInstance_ID != 0)
|
||||
mTab.setValue("M_AttributeSetInstance_ID", new Integer(M_AttributeSetInstance_ID));
|
||||
if (Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_Product_ID") == M_Product_ID)
|
||||
{
|
||||
M_AttributeSetInstance_ID = Env.getContextAsInt(ctx, WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID");
|
||||
}
|
||||
else
|
||||
mTab.setValue("M_AttributeSetInstance_ID", null);
|
||||
{
|
||||
M_AttributeSetInstance_ID = 0;
|
||||
}
|
||||
if (M_AttributeSetInstance_ID != 0)
|
||||
mTab.setValue(MInventoryLine.COLUMNNAME_M_AttributeSetInstance_ID, M_AttributeSetInstance_ID);
|
||||
else
|
||||
mTab.setValue(MInventoryLine.COLUMNNAME_M_AttributeSetInstance_ID, null);
|
||||
}
|
||||
|
||||
// Set QtyBook from first storage location
|
||||
|
|
|
@ -809,9 +809,7 @@ public class VLookup extends JComponent
|
|||
else if (col.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Lookup_ID", "0");
|
||||
resetTabInfo();
|
||||
// Replace Value with name if no value exists
|
||||
if (queryValue.length() == 0 && m_text.getText().length() > 0)
|
||||
queryValue = "@" + m_text.getText() + "@"; // Name indicator - otherwise Value
|
||||
|
@ -935,9 +933,7 @@ public class VLookup extends JComponent
|
|||
if (m_columnName.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Locator_ID", "0");
|
||||
resetTabInfo();
|
||||
//
|
||||
sql.append(" AND (UPPER(p.Value) LIKE ")
|
||||
.append(DB.TO_STRING(text))
|
||||
|
@ -1049,6 +1045,7 @@ public class VLookup extends JComponent
|
|||
}
|
||||
log.fine(m_columnName + " - Unique ID=" + id);
|
||||
m_value = null; // forces re-display if value is unchanged but text updated and still unique
|
||||
resetTabInfo();
|
||||
actionCombo (new Integer(id)); // data binding
|
||||
//
|
||||
// Don't request focus if value was solved - teo_sarca [ 2552901 ]
|
||||
|
@ -1080,9 +1077,7 @@ public class VLookup extends JComponent
|
|||
if (m_columnName.equals("M_Product_ID"))
|
||||
{
|
||||
// Reset
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Product_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, "M_Locator_ID", "0");
|
||||
resetTabInfo();
|
||||
//
|
||||
sql.append("SELECT M_Product_ID FROM M_Product WHERE (UPPER(Value) LIKE ")
|
||||
.append(DB.TO_STRING(text))
|
||||
|
@ -1525,6 +1520,32 @@ public class VLookup extends JComponent
|
|||
m_combo.setToolTipText(text);
|
||||
} // setToolTipText
|
||||
|
||||
/**
|
||||
* Reset Env.TAB_INFO context variables
|
||||
* @param columnName
|
||||
*/
|
||||
private void resetTabInfo()
|
||||
{
|
||||
if (this.m_lookup == null)
|
||||
return;
|
||||
String columnName = m_columnName;
|
||||
//
|
||||
// TODO : hardcoded
|
||||
final String[] infoNames;
|
||||
if ("M_Product_ID".equals(columnName))
|
||||
{
|
||||
infoNames = new String[]{"M_Product_ID","M_AttributeSetInstance_ID","M_Locator_ID","M_Lookup_ID"};
|
||||
}
|
||||
else
|
||||
{
|
||||
infoNames = new String[]{};
|
||||
}
|
||||
for (String name : infoNames)
|
||||
{
|
||||
Env.setContext(Env.getCtx(), m_lookup.getWindowNo(), Env.TAB_INFO, name, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh Query
|
||||
* @return count
|
||||
|
|
|
@ -331,6 +331,7 @@ public class VPAttribute extends JComponent
|
|||
int M_AttributeSetInstance_ID = oldValueInt;
|
||||
int M_Product_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_Product_ID");
|
||||
int M_ProductBOM_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_ProductBOM_ID");
|
||||
int M_Locator_ID = -1;
|
||||
|
||||
log.config("M_Product_ID=" + M_Product_ID + "/" + M_ProductBOM_ID
|
||||
+ ",M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID
|
||||
|
@ -372,48 +373,13 @@ public class VPAttribute extends JComponent
|
|||
{
|
||||
m_text.setText(vad.getM_AttributeSetInstanceName());
|
||||
M_AttributeSetInstance_ID = vad.getM_AttributeSetInstance_ID();
|
||||
if (m_GridTab != null && !productWindow && vad.getM_Locator_ID() > 0)
|
||||
m_GridTab.setValue("M_Locator_ID", vad.getM_Locator_ID());
|
||||
if (!productWindow && vad.getM_Locator_ID() > 0)
|
||||
{
|
||||
M_Locator_ID = vad.getM_Locator_ID();
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
/** Selection
|
||||
{
|
||||
// Get Model
|
||||
MAttributeSetInstance masi = MAttributeSetInstance.get(Env.getCtx(), M_AttributeSetInstance_ID, M_Product_ID);
|
||||
if (masi == null)
|
||||
{
|
||||
log.log(Level.SEVERE, "No Model for M_AttributeSetInstance_ID=" + M_AttributeSetInstance_ID + ", M_Product_ID=" + M_Product_ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
Env.setContext(Env.getCtx(), m_WindowNo, "M_AttributeSet_ID", masi.getM_AttributeSet_ID());
|
||||
// Get Attribute Set
|
||||
MAttributeSet as = masi.getMAttributeSet();
|
||||
// Product has no Attribute Set
|
||||
if (as == null)
|
||||
ADialog.error(m_WindowNo, this, "PAttributeNoAttributeSet");
|
||||
// Product has no Instance Attributes
|
||||
else if (!as.isInstanceAttribute())
|
||||
ADialog.error(m_WindowNo, this, "PAttributeNoInstanceAttribute");
|
||||
else
|
||||
{
|
||||
int M_Warehouse_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_Warehouse_ID");
|
||||
int M_Locator_ID = Env.getContextAsInt (Env.getCtx (), m_WindowNo, "M_Locator_ID");
|
||||
String title = "";
|
||||
PAttributeInstance pai = new PAttributeInstance (
|
||||
Env.getFrame(this), title,
|
||||
M_Warehouse_ID, M_Locator_ID, M_Product_ID, m_C_BPartner_ID);
|
||||
if (pai.getM_AttributeSetInstance_ID() != -1)
|
||||
{
|
||||
m_text.setText(pai.getM_AttributeSetInstanceName());
|
||||
M_AttributeSetInstance_ID = pai.getM_AttributeSetInstance_ID();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
**/
|
||||
|
||||
// Set Value
|
||||
if (changed)
|
||||
|
@ -424,6 +390,13 @@ public class VPAttribute extends JComponent
|
|||
setValue(null);
|
||||
else
|
||||
setValue(new Integer(M_AttributeSetInstance_ID));
|
||||
// Change Locator
|
||||
if (m_GridTab != null && M_Locator_ID > 0)
|
||||
{
|
||||
log.finest("Change M_Locator_ID="+M_Locator_ID);
|
||||
m_GridTab.setValue("M_Locator_ID", M_Locator_ID);
|
||||
}
|
||||
//
|
||||
try
|
||||
{
|
||||
String columnName = "M_AttributeSetInstance_ID";
|
||||
|
|
Loading…
Reference in New Issue