IDEMPIERE-1338:Create a record from Info window
don't show empty dialog issue relate city field
This commit is contained in:
parent
e8fa60dbe0
commit
3d57ffe127
|
|
@ -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_";
|
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 ConfirmPanel confirmPanel = new ConfirmPanel(true, false, false, false, false, false);
|
||||||
|
|
||||||
private int m_AD_Window_ID;
|
private int m_AD_Window_ID;
|
||||||
|
|
||||||
|
private boolean isHasField = false;
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* Requires call loadRecord
|
* Requires call loadRecord
|
||||||
|
|
@ -180,7 +181,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
if (! quickTabs.contains(gridtab)) {
|
if (! quickTabs.contains(gridtab)) {
|
||||||
quickTabs.add(gridtab);
|
quickTabs.add(gridtab);
|
||||||
}
|
}
|
||||||
|
isHasField = true;
|
||||||
newTab = false;
|
newTab = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -230,6 +231,15 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
centerPanel.appendChild(layout);
|
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
|
* Load Record_ID
|
||||||
* @param Record_ID - existing Record or 0 for new
|
* @param Record_ID - existing Record or 0 for new
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@ import org.adempiere.model.IInfoColumn;
|
||||||
import org.adempiere.model.MInfoProcess;
|
import org.adempiere.model.MInfoProcess;
|
||||||
import org.adempiere.model.MInfoRelated;
|
import org.adempiere.model.MInfoRelated;
|
||||||
import org.adempiere.webui.AdempiereWebUI;
|
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.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Borderlayout;
|
import org.adempiere.webui.component.Borderlayout;
|
||||||
import org.adempiere.webui.component.Button;
|
import org.adempiere.webui.component.Button;
|
||||||
|
|
@ -125,9 +127,11 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
protected TableInfo[] tableInfos;
|
protected TableInfo[] tableInfos;
|
||||||
protected MInfoColumn[] infoColumns;
|
protected MInfoColumn[] infoColumns;
|
||||||
protected String queryValue;
|
protected String queryValue;
|
||||||
|
protected WQuickEntry vqe;
|
||||||
|
|
||||||
private List<GridField> gridFields;
|
private List<GridField> gridFields;
|
||||||
private Checkbox checkAND;
|
private Checkbox checkAND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu contail process menu item
|
* Menu contail process menu item
|
||||||
*/
|
*/
|
||||||
|
|
@ -2041,10 +2045,13 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasNew() {
|
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
|
* Get id of window link with main table of this info window
|
||||||
* @param tableName
|
* @param tableName
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -2062,19 +2069,26 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void newRecordAction() {
|
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);
|
vqe.loadRecord (0);
|
||||||
|
|
||||||
|
final ISupportMask parent = LayoutUtils.showWindowWithMask(vqe, this, LayoutUtils.OVERLAP_TAB_PANEL);
|
||||||
|
|
||||||
vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
vqe.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
Clients.response(new AuEcho(InfoWindow.this, "onQueryCallback", null));
|
Clients.response(new AuEcho(InfoWindow.this, "onQueryCallback", null));
|
||||||
|
if (parent != null)
|
||||||
|
parent.hideMask();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
vqe.setVisible(true);
|
vqe.setVisible(true);
|
||||||
AEnv.showWindow(vqe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue