IDEMPIERE-837 Zk: Zoom to purchase order from invoice (vendor) doesn't work for new record.

This commit is contained in:
Heng Sin Low 2013-04-09 14:17:17 +08:00
parent 3fd80354bf
commit 3a922e95a4
3 changed files with 22 additions and 4 deletions

View File

@ -428,6 +428,15 @@ public abstract class Lookup extends AbstractListModel
return 0;
} // getZoom
/**
* @param isSOTrx
* @return Zoom AD_Window_ID
*/
public int getZoom(boolean isSOTrx)
{
return 0;
}
/**
* Get Zoom - default implementation
* @param query query

View File

@ -563,6 +563,7 @@ public final class MLookup extends Lookup implements Serializable
* @param query query
* @return Zoom Window
*/
@Override
public int getZoom(MQuery query)
{
if (m_info.ZoomWindowPO == 0 || query == null)
@ -570,11 +571,18 @@ public final class MLookup extends Lookup implements Serializable
// Need to check SO/PO
boolean isSOTrx = DB.isSOTrx(m_info.TableName, query.getWhereClause(false));
//
if (!isSOTrx)
return m_info.ZoomWindowPO;
return m_info.ZoomWindow;
return getZoom(isSOTrx);
} // getZoom
@Override
public int getZoom(boolean isSOTrx)
{
if (m_info.ZoomWindowPO == 0)
return m_info.ZoomWindow;
return isSOTrx ? m_info.ZoomWindow : m_info.ZoomWindowPO;
}
/**
* Get Zoom Query String
* @return Zoom SQL Where Clause

View File

@ -303,7 +303,8 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
query.addRestriction("1=2");
query.setRecordCount(0);
SessionManager.getAppDesktop().openWindow(lookup.getZoom(query), query, new Callback<ADWindow>() {
int zoomWindowId = gridField != null ? lookup.getZoom(Env.isSOTrx(Env.getCtx(), gridField.getWindowNo())) : lookup.getZoom(Env.isSOTrx(Env.getCtx()));
SessionManager.getAppDesktop().openWindow(zoomWindowId, query, new Callback<ADWindow>() {
@Override
public void onCallback(ADWindow result) {
if(result == null)