diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index 96d54721ad..2703ac68ea 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -71,7 +71,6 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.WebDoc; -import org.jpedal.parser.Cmd; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.HtmlBasedComponent; @@ -146,6 +145,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private IADTabpanel embeddedTabPanel; + private boolean m_findCreateNew; + /** * Constructor for non-embedded mode * @param ctx @@ -407,6 +408,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } } } + + if (tabIndex == 0) { + if (curTab.isHighVolume() && m_findCreateNew) + onNew(); + else if (query == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo)) + onNew(); + } } /** @@ -459,6 +467,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (require) { m_findCancelled = false; + m_findCreateNew = false; GridField[] findFields = mTab.getFields(); FindWindow find = new FindWindow(curWindowNo, mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), @@ -468,7 +477,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To find.setVisible(true); AEnv.showWindow(find); if (!find.isCancel()) + { query = find.getQuery(); + m_findCreateNew = find.isCreateNew(); + } else m_findCancelled = true; find = null; diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index 5beb059c66..3f971d148d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -92,7 +92,7 @@ import org.zkoss.zul.Vbox; public class FindWindow extends Window implements EventListener,ValueChangeListener { /** - * + * */ private static final long serialVersionUID = 7893948607004510173L; /** Main Window for the Lookup Panel */ @@ -159,6 +159,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe private Row pnlDescription; private Row pnlValue; private Row pnlName; + private boolean m_createNew = false; /** Index ColumnName = 0 */ public static final int INDEX_COLUMNNAME = 0; @@ -760,6 +761,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe { m_query = MQuery.getNoRecordQuery(m_tableName, true); m_total = 0; + m_createNew = true; dispose(); } } @@ -1688,6 +1690,14 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe public boolean isCancel() { return m_isCancel; } + + /** + * @return true if user press the new button + */ + public boolean isCreateNew() { + return m_createNew; + } + @Override public boolean setVisible(boolean visible) { boolean ret = super.setVisible(visible);