IDEMPIERE-4106 Dependent fields not cleared when changing a parent field / IDEMPIERE-3961
This commit is contained in:
parent
9496b01a2b
commit
2286fb8f67
|
|
@ -2771,8 +2771,9 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
// Get dependent MFields (may be because of display or dynamic lookup)
|
// Get dependent MFields (may be because of display or dynamic lookup)
|
||||||
for (GridField dependentField : getDependantFields(columnName))
|
for (GridField dependentField : getDependantFields(columnName))
|
||||||
{
|
{
|
||||||
if (dependentField == null || dependentField.isLookupEditorSettingValue()) continue;
|
if (dependentField == null || dependentField.isLookupEditorSettingValue())
|
||||||
|
continue;
|
||||||
|
|
||||||
// if the field has a lookup
|
// if the field has a lookup
|
||||||
if (dependentField.getLookup() instanceof MLookup)
|
if (dependentField.getLookup() instanceof MLookup)
|
||||||
{
|
{
|
||||||
|
|
@ -2783,12 +2784,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
{
|
{
|
||||||
if (log.isLoggable(Level.FINE)) log.fine(columnName + " changed - "
|
if (log.isLoggable(Level.FINE)) log.fine(columnName + " changed - "
|
||||||
+ dependentField.getColumnName() + " set to null");
|
+ dependentField.getColumnName() + " set to null");
|
||||||
|
mLookup.refresh();
|
||||||
Object currentValue = dependentField.getValue();
|
Object currentValue = dependentField.getValue();
|
||||||
|
|
||||||
// invalidate current selection
|
// invalidate current selection
|
||||||
setValue(dependentField, null);
|
setValue(dependentField, null);
|
||||||
|
|
||||||
if (currentValue != null && mLookup.containsKey(currentValue))
|
if (currentValue != null && mLookup.containsKeyNoDirect(currentValue))
|
||||||
setValue(dependentField, currentValue);
|
setValue(dependentField, currentValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ import org.compiere.model.GridTable;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.I_AD_Preference;
|
import org.compiere.model.I_AD_Preference;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MLookup;
|
|
||||||
import org.compiere.model.MPreference;
|
import org.compiere.model.MPreference;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MSysConfig;
|
import org.compiere.model.MSysConfig;
|
||||||
|
|
@ -1369,27 +1368,12 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
|| (Core.findCallout(gridTab.getTableName(), mField.getColumnName())).size()>0
|
|| (Core.findCallout(gridTab.getTableName(), mField.getColumnName())).size()>0
|
||||||
|| gridTab.hasDependants(mField.getColumnName())))
|
|| gridTab.hasDependants(mField.getColumnName())))
|
||||||
{
|
{
|
||||||
|
// IDEMPIERE-4106 Refresh the list (lookup) on dependant fields was moved inside processFieldChange->processDependencies
|
||||||
String msg = gridTab.processFieldChange(mField); // Dependencies & Callout
|
String msg = gridTab.processFieldChange(mField); // Dependencies & Callout
|
||||||
if (msg.length() > 0)
|
if (msg.length() > 0)
|
||||||
{
|
{
|
||||||
FDialog.error(windowNo, this, msg);
|
FDialog.error(windowNo, this, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the list on dependant fields
|
|
||||||
for (GridField dependentField : gridTab.getDependantFields(mField.getColumnName()))
|
|
||||||
{
|
|
||||||
// if the field has a lookup
|
|
||||||
if (dependentField != null && dependentField.getLookup() instanceof MLookup)
|
|
||||||
{
|
|
||||||
MLookup mLookup = (MLookup)dependentField.getLookup();
|
|
||||||
// if the lookup is dynamic (i.e. contains this columnName as variable)
|
|
||||||
if (mLookup.getValidation().indexOf("@"+mField.getColumnName()+"@") != -1)
|
|
||||||
{
|
|
||||||
mLookup.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // for all dependent fields
|
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (col >= 0)
|
//if (col >= 0)
|
||||||
if (!uiCreated)
|
if (!uiCreated)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue