diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java index e9a0ed8da2..d75fa50d5d 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java @@ -193,7 +193,17 @@ public class CalloutInOut extends CalloutEngine String DocBaseType = rs.getString("DocBaseType"); // BF [2708789] Read IsSOTrx from C_DocType String trxFlag = rs.getString("IsSOTrx"); - if (!(trxFlag.equals(mTab.getValue("IsSOTrx")))) + Object isSOTrxValue = mTab.getValue("IsSOTrx"); + String isSOTrxValueStr = null; + if (isSOTrxValue != null) + { + if (isSOTrxValue instanceof Boolean) + isSOTrxValueStr = (Boolean)isSOTrxValue ? "Y" : "N"; + else + isSOTrxValueStr = (String)isSOTrxValue; + } + + if (!(trxFlag.equals(isSOTrxValueStr))) mTab.setValue("IsSOTrx", trxFlag); if (DocBaseType.equals("MMS")) // Material Shipments /**solve 1648131 bug vpj-cd e-evolution */ diff --git a/org.adempiere.base/src/org/compiere/model/GridField.java b/org.adempiere.base/src/org/compiere/model/GridField.java index c32dd2f082..92d7a4c3e4 100644 --- a/org.adempiere.base/src/org/compiere/model/GridField.java +++ b/org.adempiere.base/src/org/compiere/model/GridField.java @@ -102,6 +102,12 @@ public class GridField private GridTab m_gridTab; + /** + * Use by lookup editor to indicate setting of new value is in progress. + * GridTab.processDependentFields will check this flag to avoid clearing of lookup field value that just have been set. + **/ + private boolean m_lookupEditorSettingValue = false; + /** * Dispose */ @@ -2051,5 +2057,21 @@ public class GridField } } + + /** + * @param b + */ + public void setLookupEditorSettingValue(boolean b) + { + m_lookupEditorSettingValue = b; + } + + /** + * @return true if the setting value of this field by UI is in progress + */ + public boolean isLookupEditorSettingValue() + { + return m_lookupEditorSettingValue; + } } // GridField diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 6e8122bc03..b5f1b4aca6 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -2676,8 +2676,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable // Get dependent MFields (may be because of display or dynamic lookup) for (GridField dependentField : getDependantFields(columnName)) { + if (dependentField == null || dependentField.isLookupEditorSettingValue()) continue; + // if the field has a lookup - if (dependentField != null && dependentField.getLookup() instanceof MLookup) + if (dependentField.getLookup() instanceof MLookup) { MLookup mLookup = (MLookup)dependentField.getLookup(); // if the lookup is dynamic (i.e. contains this columnName as variable) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index 031acda05a..7c30d3667c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -449,35 +449,37 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value { if (log.isLoggable(Level.FINE)) log.fine("Value=" + value); - - ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value); - // -> ADTabpanel - valuechange - fireValueChange(evt); - - // is the value updated ? - boolean updated = false; - if (value instanceof Object[] && ((Object[])value).length > 0) + + try { - value = ((Object[])value)[0]; - } - - if (value == null && getValue() == null) - updated = true; - else if (value != null && value.equals(getValue())) - updated = true; - if (!updated) - { - setValue(value); - if (gridTab != null && gridField != null) { - if (value == null && gridField.getValue() != null) { - gridTab.setValue(gridField, value); - } else if (value != null && gridField.getValue() == null) { - gridTab.setValue(gridField, value); - } else if (value != null && !value.equals(gridField.getValue())) { - gridTab.setValue(gridField, value); - } + if (gridField != null) + gridField.setLookupEditorSettingValue(true); + + ValueChangeEvent evt = new ValueChangeEvent(this, this.getColumnName(), getValue(), value); + // -> ADTabpanel - valuechange + fireValueChange(evt); + + // is the value updated ? + boolean updated = false; + if (value instanceof Object[] && ((Object[])value).length > 0) + { + value = ((Object[])value)[0]; } - } + + if (value == null && getValue() == null) + updated = true; + else if (value != null && value.equals(getValue())) + updated = true; + if (!updated) + { + setValue(value); + } + } + finally + { + if (gridField != null) + gridField.setLookupEditorSettingValue(false); + } } // actionCombo diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java index e173bd9f59..e33b365af4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WTableDirEditor.java @@ -399,10 +399,17 @@ ContextMenuListener, IZoomableEditor onselecting = true; Object newValue = getValue(); if (isValueChange(newValue)) { - ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); - super.fireValueChange(changeEvent); - oldValue = newValue; - getComponent().setValue(newValue); + try { + if (gridField != null) + gridField.setLookupEditorSettingValue(true); + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); + super.fireValueChange(changeEvent); + oldValue = newValue; + getComponent().setValue(newValue); + } finally { + if (gridField != null) + gridField.setLookupEditorSettingValue(false); + } } } finally { onselecting = false; @@ -422,9 +429,16 @@ ContextMenuListener, IZoomableEditor { Object newValue = getValue(); if (isValueChange(newValue)) { - ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); - super.fireValueChange(changeEvent); - oldValue = newValue; + try { + if (gridField != null) + gridField.setLookupEditorSettingValue(true); + ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); + super.fireValueChange(changeEvent); + oldValue = newValue; + } finally { + if (gridField != null) + gridField.setLookupEditorSettingValue(false); + } } } }