IDEMPIERE-4745 Fixes order by SQL generation error (#638)

Co-authored-by: Andreas <sumerauer@kanzlei-wmv.de>
This commit is contained in:
Andreas Sumerauer 2021-03-25 20:46:28 +01:00 committed by GitHub
parent da171627ed
commit 0fb7bc9a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -43,6 +43,7 @@ import org.compiere.util.Trx;
* Create Menu - Window/tab & field from a table
*
* @author Diego Ruiz - BX Service GmbH
* @contributor Andreas Sumerauer IDEMPIERE-4745
*/
public class CreateWindowFromTable extends SvrProcess
{
@ -182,9 +183,9 @@ public class CreateWindowFromTable extends SvrProcess
tab.setIsSingleRow(true); //Default
//Set order by
if (table.getColumnIndex("Value") > 0)
if (table.getColumnIndex("Value") > 0 && !table.getColumn("Value").isVirtualColumn())
tab.setOrderByClause(table.getTableName() + ".Value");
else if (table.getColumnIndex("Name") > 0)
else if (table.getColumnIndex("Name") > 0 && !table.getColumn("Name").isVirtualColumn())
tab.setOrderByClause(table.getTableName() + ".Name");
else
tab.setOrderByClause(table.getTableName() + ".Created DESC");