IDEMPIERE-1338:Create a record from Info window

don't show empty dialog
issue relate city field
This commit is contained in:
hieplq 2015-08-14 06:22:50 +08:00
parent e8fa60dbe0
commit 3d57ffe127
2 changed files with 33 additions and 9 deletions

View File

@ -63,7 +63,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
/**
*
*/
private static final long serialVersionUID = -949213040088881469L;
private static final long serialVersionUID = 6033101081045706748L;
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
@ -86,7 +86,8 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false);
private int m_AD_Window_ID;
private boolean isHasField = false;
/**
* Constructor.
* Requires call loadRecord
@ -180,7 +181,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
if (! quickTabs.contains(gridtab)) {
quickTabs.add(gridtab);
}
isHasField = true;
newTab = false;
}
}
@ -230,6 +231,15 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
centerPanel.appendChild(layout);
}
/**
* check table is editable in quick entry
* user must has write right and has at least a input field
* @return
*/
public boolean isAvailableQuickEdit (){
return isHasField && !m_readOnly;
}
/**
* Load Record_ID
* @param Record_ID - existing Record or 0 for new

View File

@ -18,6 +18,8 @@ import org.adempiere.model.IInfoColumn;
import org.adempiere.model.MInfoProcess;
import org.adempiere.model.MInfoRelated;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.ISupportMask;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Borderlayout;
import org.adempiere.webui.component.Button;
@ -125,9 +127,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
protected TableInfo[] tableInfos;
protected MInfoColumn[] infoColumns;
protected String queryValue;
protected WQuickEntry vqe;
private List<GridField> gridFields;
private Checkbox checkAND;
/**
* Menu contail process menu item
*/
@ -2041,10 +2045,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override
protected boolean hasNew() {
return getADWindowID () > 0;
boolean hasNew = getADWindowID () > 0;
if (hasNew && vqe == null)
vqe = new WQuickEntry (0, getADWindowID());
return hasNew && vqe.isAvailableQuickEdit();
}
/**
/**
* Get id of window link with main table of this info window
* @param tableName
* @return
@ -2062,19 +2069,26 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
@Override
protected void newRecordAction() {
final WQuickEntry vqe = new WQuickEntry (0, getADWindowID());
// each time close WQuickEntry dialog,
// window is un-registry, variable environment of this window as _QUICK_ENTRY_MODE_ is removed
// so if reuse WQuickEntry will let some field in child tab init at read only state
WQuickEntry vqe = new WQuickEntry (0, getADWindowID());
vqe.loadRecord (0);
final ISupportMask parent = LayoutUtils.showWindowWithMask(vqe, this, LayoutUtils.OVERLAP_TAB_PANEL);
vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
Clients.response(new AuEcho(InfoWindow.this, "onQueryCallback", null));
if (parent != null)
parent.hideMask();
}
});
vqe.setVisible(true);
AEnv.showWindow(vqe);
}
}