IDEMPIERE-1351 Quick Entry when Field can not zoom to 2 different windows (#829)

This commit is contained in:
hengsin 2021-08-17 22:07:13 +08:00 committed by GitHub
parent 7745d0f27e
commit f8fbf5f3bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 2 deletions

View File

@ -2631,6 +2631,12 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
}
if (changingRow && keyCalloutDelayed != null)
processCallout(keyCalloutDelayed);
//set isSOTrx context
if (changingRow) {
setIsSOTrxContext();
}
loadDependentInfo();
if (!fireEvents) // prevents informing twice
@ -2668,6 +2674,48 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
return m_currentRow;
} // setCurrentRow
private void setIsSOTrxContext() {
final String IsSOTrx = "IsSOTrx";
final String C_DocType_ID = "C_DocType_ID";
final String C_DocTypeTarget_ID = "C_DocTypeTarget_ID";
if (getField(IsSOTrx) != null || getField(C_DocType_ID) != null || getField(C_DocTypeTarget_ID) != null) {
String isSOTrx = null;
GridField field = getField(IsSOTrx);
if (field != null && field.getValue() != null) {
Object value = field.getValue();
if (value instanceof Boolean) {
isSOTrx = ((Boolean) value).booleanValue() ? "Y" : "N";
} else if (value instanceof String) {
isSOTrx = (String) value;
}
}
if (isSOTrx == null) {
field = getField(C_DocType_ID);
if (field != null && field.getValue() != null) {
int docTypeId = ((Number)field.getValue()).intValue();
if (docTypeId > 0) {
isSOTrx = MDocType.get(docTypeId).isSOTrx() ? "Y" : "N";
}
}
}
if (isSOTrx == null) {
field = getField(C_DocTypeTarget_ID);
if (field != null && field.getValue() != null) {
int docTypeId = ((Number)field.getValue()).intValue();
if (docTypeId > 0) {
isSOTrx = MDocType.get(docTypeId).isSOTrx() ? "Y" : "N";
}
}
}
if (isSOTrx != null) {
Env.setContext(Env.getCtx(), getWindowNo(), getTabNo(), IsSOTrx, isSOTrx);
if (m_vo.TabNo == 0) {
Env.setContext(Env.getCtx(), getWindowNo(), IsSOTrx, isSOTrx);
}
}
}
}
/**
* Set current row - used for deleteSelection

View File

@ -380,7 +380,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
gridTab.getTableModel().setChanged(false);
adTabbox.setSelectedIndex(0);
// all fields context for window is clear at AbstractADTab.prepareContext, set again IsSOTrx for window
// set again IsSOTrx for window if context for window is clear at AbstractADTab.prepareContext,
if (Env.getContext(ctx, curWindowNo, "IsSOTrx", true) == null)
Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
toolbar.enableTabNavigation(adTabbox.getTabCount() > 1);
toolbar.enableFind(true);