diff --git a/migration/i6.2/oracle/201905071815_IDEMPIERE-3961.sql b/migration/i6.2/oracle/201905071815_IDEMPIERE-3961.sql new file mode 100644 index 0000000000..9ce0960be6 --- /dev/null +++ b/migration/i6.2/oracle/201905071815_IDEMPIERE-3961.sql @@ -0,0 +1,10 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3961 GL Journal - Switching accounting schema removes PERIOD +-- May 7, 2019, 5:20:41 PM SGT +UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.acctSchema',Updated=TO_DATE('2019-05-07 17:20:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1632 +; + +SELECT register_migration_script('201905071815_IDEMPIERE-3961.sql') FROM dual +; diff --git a/migration/i6.2/postgresql/201905071815_IDEMPIERE-3961.sql b/migration/i6.2/postgresql/201905071815_IDEMPIERE-3961.sql new file mode 100644 index 0000000000..fdf7b73f9f --- /dev/null +++ b/migration/i6.2/postgresql/201905071815_IDEMPIERE-3961.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-3961 GL Journal - Switching accounting schema removes PERIOD +-- May 7, 2019, 5:20:41 PM SGT +UPDATE AD_Column SET Callout='org.compiere.model.CalloutGLJournal.acctSchema',Updated=TO_TIMESTAMP('2019-05-07 17:20:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=1632 +; + +SELECT register_migration_script('201905071815_IDEMPIERE-3961.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutGLJournal.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutGLJournal.java index 2f122a184f..479e53d29d 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutGLJournal.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutGLJournal.java @@ -294,4 +294,26 @@ public class CalloutGLJournal extends CalloutEngine } return ""; } + + /** + * Journal - Acct Schema + * Set Currency from C_AcctSchema_ID + * @param ctx context + * @param WindowNo window no + * @param mTab tab + * @param mField field + * @param value value + * @return null or error message + */ + public String acctSchema(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) + { + if (value == null) + return ""; + + int C_AcctSchema_ID = Env.getContextAsInt(ctx, WindowNo, "C_AcctSchema_ID"); + MAcctSchema as = MAcctSchema.get (ctx, C_AcctSchema_ID); + mTab.setValue("C_Currency_ID", as.getC_Currency_ID()); + + return ""; + } } // CalloutGLJournal diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 83826a7c9b..ca57300f76 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -2783,8 +2783,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable { if (log.isLoggable(Level.FINE)) log.fine(columnName + " changed - " + dependentField.getColumnName() + " set to null"); + Object currentValue = dependentField.getValue(); + // invalidate current selection setValue(dependentField, null); + + if (currentValue != null && mLookup.containsKey(currentValue)) + setValue(dependentField, currentValue); } } // if the field is a Virtual UI Column