IDEMPIERE-1026 Button on table to create automatically the window (#775)

* IDEMPIERE-1026 Button on table to create automatically the window

Set relevant fields for translation tabs

* Set better order by for translation tables

* Minor performance fix found when testing this - the callout is visiting the database even on null column
This commit is contained in:
Carlos Ruiz 2021-07-09 11:50:34 +02:00 committed by GitHub
parent 0b3e307d86
commit 53ef632ecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,8 @@ public class Callout_AD_Column extends CalloutEngine
{
public String columnName (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{ // IDEMPIERE-1011 - dup code on MColumn.setmartDefaults
if (value == null)
return "";
I_AD_Column column = GridTabWrapper.create(mTab, I_AD_Column.class);
if (MColumn.isSuggestSelectionColumn(column.getColumnName(), true))
column.setIsSelectionColumn(true);

View File

@ -180,7 +180,7 @@ public class CreateWindowFromTable extends SvrProcess
tab.setAD_Table_ID(p_AD_Table_ID);
tab.setTabLevel(p_TabLevel);
tab.setIsSingleRow(true); //Default
//Set order by
if (table.columnExistsInDB("Value"))
tab.setOrderByClause(table.getTableName() + ".Value");
@ -189,6 +189,13 @@ public class CreateWindowFromTable extends SvrProcess
else
tab.setOrderByClause(table.getTableName() + ".Created DESC");
if (table.getTableName().toLowerCase().endsWith("_trl")) {
tab.setIsTranslationTab(true);
tab.setIsInsertRecord(false);
if (table.columnExistsInDB("AD_Language"))
tab.setOrderByClause(table.getTableName() + ".AD_Language");
}
tab.saveEx();
addLog(tab.getAD_Tab_ID(), null, null, "@AD_Tab_ID@: " + tab.getName(),
tab.get_Table_ID(), tab.getAD_Tab_ID());