IDEMPIERE-1338:Create a record from Info window

fix NPE when user don't has right access to QuickEntry
testcase:open product info with system admin role
This commit is contained in:
hieplq 2015-08-14 14:57:28 +08:00
parent 8589e0ab04
commit 09077a1e83
2 changed files with 10 additions and 4 deletions

View File

@ -60,6 +60,7 @@ import org.compiere.model.AccessSqlParser;
import org.compiere.model.AccessSqlParser.TableInfo; import org.compiere.model.AccessSqlParser.TableInfo;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.GridFieldVO; import org.compiere.model.GridFieldVO;
import org.compiere.model.GridWindow;
import org.compiere.model.MInfoColumn; import org.compiere.model.MInfoColumn;
import org.compiere.model.MInfoWindow; import org.compiere.model.MInfoWindow;
import org.compiere.model.MLookupFactory; import org.compiere.model.MLookupFactory;
@ -2046,9 +2047,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override @Override
protected boolean hasNew() { protected boolean hasNew() {
boolean hasNew = getADWindowID () > 0; boolean hasNew = getADWindowID () > 0;
if (hasNew && vqe == null) if (hasNew && vqe == null && hasRightQuickEntry){
vqe = new WQuickEntry (0, getADWindowID()); GridWindow gridwindow = GridWindow.get(Env.getCtx(), 0, getADWindowID());
return hasNew && vqe.isAvailableQuickEdit(); hasRightQuickEntry = gridwindow != null;
if (hasRightQuickEntry)
vqe = new WQuickEntry (0, getADWindowID());
}
return hasNew && vqe != null && vqe.isAvailableQuickEdit();
} }
/** /**

View File

@ -145,7 +145,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
protected int indexKeyOfView = -1; protected int indexKeyOfView = -1;
protected boolean isIDColumnKeyOfView = false; protected boolean isIDColumnKeyOfView = false;
protected boolean hasRightQuickEntry = true;
/** /**
* store selected record info * store selected record info
* key of map is value of column play as keyView * key of map is value of column play as keyView