IDEMPIERE-1052 Improve Performance using Search instead of Table/Table Direct (#159)

WSearchEditor broken when importing detail CSV

Merging this pull request tested locally (without peer review) as an emergency.
This commit is contained in:
Carlos Ruiz 2020-07-03 20:56:48 +02:00 committed by GitHub
parent 4f09cc5a7a
commit d6e5cdc26a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 7 deletions

View File

@ -50,6 +50,7 @@ import org.compiere.model.Lookup;
import org.compiere.model.MColumn;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
import org.compiere.model.X_AD_CtxHelp;
import org.compiere.util.CLogger;
@ -246,13 +247,38 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
}
else
{
getComponent().setText("");
if (curValue == null)
curValue = value;
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
fireValueChange(changeEvent);
this.value = null;
}
if (value instanceof Integer && gridField != null && gridField.getDisplayType() != DisplayType.ID &&
(gridTab==null || !gridTab.getTableModel().isImporting())) // for IDs is ok to be out of the list
{
//if it is problem with record lock, just keep value (no trigger change) and set field readonly
MRole role = MRole.getDefault(Env.getCtx(), false);
int refTableID = -1;
if (gridTab != null) // fields process para don't represent a column ID
{
MColumn col = MColumn.get(Env.getCtx(), gridField.getAD_Column_ID());
if (col.get_ID() > 0) {
String refTable = col.getReferenceTableName();
if (refTable != null) {
MTable table = MTable.get(Env.getCtx(), refTable);
refTableID = table.getAD_Table_ID();
}
}
}
if (refTableID > 0 && ! role.isRecordAccess(refTableID, (int)value, false))
{
setReadWrite(false);
}
else
{
getComponent().setText("");
if (curValue == null)
curValue = value;
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), curValue, null);
super.fireValueChange(changeEvent);
this.value = null;
}
}
}
}
else
{