IDEMPIERE-1744 after import record. in detail tab, parent key is not load

This commit is contained in:
Carlos Ruiz 2019-02-15 16:57:47 +01:00
parent 5f1c8e0860
commit b65e393e33
3 changed files with 26 additions and 5 deletions

View File

@ -43,7 +43,7 @@ public abstract class Lookup extends AbstractListModel<Object>
/** /**
* *
*/ */
private static final long serialVersionUID = -28200392264647953L; private static final long serialVersionUID = -2500275921218601088L;
/** /**
* Lookup * Lookup
@ -468,8 +468,14 @@ public abstract class Lookup extends AbstractListModel<Object>
* @param key key * @param key key
* @param saveInCache save in cache for r/w * @param saveInCache save in cache for r/w
* @param cacheLocal cache locally for r/o * @param cacheLocal cache locally for r/o
* @param trxName the transaction name
* @return value * @return value
*/ */
public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal, String trxName)
{
return get (key);
} // getDirect
public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal) public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal)
{ {
return get (key); return get (key);

View File

@ -56,7 +56,7 @@ public final class MLookup extends Lookup implements Serializable
/** /**
* *
*/ */
private static final long serialVersionUID = 2228200000988048623L; private static final long serialVersionUID = 2288661955135689187L;
/** /**
* MLookup Constructor * MLookup Constructor
@ -488,6 +488,11 @@ public final class MLookup extends Lookup implements Serializable
private Object m_directNullKey = null; private Object m_directNullKey = null;
private Future<?> m_loaderFuture; private Future<?> m_loaderFuture;
public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal)
{
return getDirect(key, saveInCache, cacheLocal, null);
} // getDirect
/** /**
* Get Data Direct from Table. * Get Data Direct from Table.
* @param key key * @param key key
@ -495,7 +500,7 @@ public final class MLookup extends Lookup implements Serializable
* @param cacheLocal cache locally for r/o * @param cacheLocal cache locally for r/o
* @return value * @return value
*/ */
public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal) public NamePair getDirect (Object key, boolean saveInCache, boolean cacheLocal, String trxName)
{ {
// Nothing to query // Nothing to query
if (key == null || m_info.QueryDirect == null || m_info.QueryDirect.length() == 0) if (key == null || m_info.QueryDirect == null || m_info.QueryDirect.length() == 0)
@ -520,7 +525,7 @@ public final class MLookup extends Lookup implements Serializable
try try
{ {
// SELECT Key, Value, Name FROM ... // SELECT Key, Value, Name FROM ...
pstmt = DB.prepareStatement(m_info.QueryDirect, null); pstmt = DB.prepareStatement(m_info.QueryDirect, trxName);
if (isNumber) if (isNumber)
pstmt.setInt(1, Integer.parseInt(key.toString())); pstmt.setInt(1, Integer.parseInt(key.toString()));
else else

View File

@ -39,6 +39,7 @@ import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.WFieldRecordInfo; import org.adempiere.webui.window.WFieldRecordInfo;
import org.adempiere.webui.window.WLocationDialog; import org.adempiere.webui.window.WLocationDialog;
import org.compiere.model.GridField; import org.compiere.model.GridField;
import org.compiere.model.GridTable;
import org.compiere.model.Lookup; import org.compiere.model.Lookup;
import org.compiere.model.MBPartnerLocation; import org.compiere.model.MBPartnerLocation;
import org.compiere.model.MLocation; import org.compiere.model.MLocation;
@ -413,7 +414,16 @@ ContextMenuListener, IZoomableEditor
{ {
if (lookup != null) if (lookup != null)
{ {
NamePair pair = lookup.getDirect(oldValue, false, false); String trxName = null;
if ( gridField != null
&& gridField.getGridTab() != null
&& gridField.getGridTab().getTableModel() != null) {
GridTable gt = gridField.getGridTab().getTableModel();
if (gt.isImporting()) {
trxName = gt.get_TrxName();
}
}
NamePair pair = lookup.getDirect(oldValue, false, false, trxName);
if (pair != null) { if (pair != null) {
if (pair instanceof KeyNamePair) { if (pair instanceof KeyNamePair) {
int key = ((KeyNamePair)pair).getKey(); int key = ((KeyNamePair)pair).getKey();