IDEMPIERE-1997 Wrong values when selecting a Invoice at Payment Window

This commit is contained in:
Carlos Ruiz 2014-06-11 11:51:20 -05:00
parent 4c92c76c46
commit 66e3e69111
4 changed files with 41 additions and 44 deletions

View File

@ -3,16 +3,17 @@
*/
package org.adempiere.webui.info;
import org.compiere.util.Env;
/**
* @author hengsin
*
*/
public class InfoAssetWindow extends InfoWindow {
/**
*
*/
private static final long serialVersionUID = 623767863373135404L;
private static final long serialVersionUID = 8671986505516245911L;
/**
* @param WindowNo
@ -49,4 +50,17 @@ public class InfoAssetWindow extends InfoWindow {
// TODO Auto-generated constructor stub
}
@Override
protected void saveSelectionDetail() {
int row = contentPanel.getSelectedRow();
if (row == -1)
return;
super.saveSelectionDetail();
// publish for Callout to read
Integer ID = getSelectedRowKey();
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "A_Asset_ID", ID == null ? "0" : ID.toString());
}
}

View File

@ -6,7 +6,6 @@ package org.adempiere.webui.info;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.panel.InvoiceHistory;
import org.compiere.util.Env;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Util;
/**
@ -17,10 +16,7 @@ public class InfoBPartnerWindow extends InfoWindow {
/**
*
*/
private static final long serialVersionUID = -7970170769665110830L;
private int m_AD_User_ID_index = -1;
private int m_C_BPartner_Location_ID_index = -1;
private static final long serialVersionUID = 126054851491958589L;
/**
* @param WindowNo
@ -116,44 +112,11 @@ public class InfoBPartnerWindow extends InfoWindow {
if (row == -1)
return;
int AD_User_ID = 0;
int C_BPartner_Location_ID = 0;
super.saveSelectionDetail();
if (m_AD_User_ID_index != -1)
{
Object data =contentPanel.getValueAt(row, m_AD_User_ID_index);
if (data instanceof KeyNamePair)
AD_User_ID = ((KeyNamePair)data).getKey();
}
//
if (m_C_BPartner_Location_ID_index != -1)
{
Object data =contentPanel.getValueAt(row, m_C_BPartner_Location_ID_index);
if (data instanceof KeyNamePair)
C_BPartner_Location_ID = ((KeyNamePair)data).getKey();
}
// publish for Callout to read
Integer ID = getSelectedRowKey();
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_ID", ID == null ? "0" : ID.toString());
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "AD_User_ID", String.valueOf(AD_User_ID));
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_BPartner_Location_ID", String.valueOf(C_BPartner_Location_ID));
super.saveSelectionDetail();
}
@Override
protected void prepareTable() {
super.prepareTable();
// Get indexes
for (int i = 0; i < p_layout.length; i++)
{
if (p_layout[i].getKeyPairColSQL().indexOf("AD_User_ID") != -1)
m_AD_User_ID_index = i;
//
if (p_layout[i].getKeyPairColSQL().indexOf("C_BPartner_Location_ID") != -1)
m_C_BPartner_Location_ID_index = i;
}
}
}

View File

@ -12,11 +12,10 @@ import org.compiere.util.Util;
*
*/
public class InfoInvoiceWindow extends InfoWindow {
/**
*
*/
private static final long serialVersionUID = 3413423439591833575L;
private static final long serialVersionUID = -5614659763247990639L;
/**
* @param WindowNo
@ -81,4 +80,17 @@ public class InfoInvoiceWindow extends InfoWindow {
dynamicDisplay(null);
}
@Override
protected void saveSelectionDetail() {
int row = contentPanel.getSelectedRow();
if (row == -1)
return;
super.saveSelectionDetail();
// publish for Callout to read
Integer ID = getSelectedRowKey();
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_Invoice_ID", ID == null ? "0" : ID.toString());
}
}

View File

@ -823,7 +823,12 @@ public class InfoProductWindow extends InfoWindow {
@Override
protected void saveSelectionDetail() {
int row = contentPanel.getSelectedRow();
if (row == -1)
return;
super.saveSelectionDetail();
if (m_M_AttributeSetInstance_ID == -1) // not selected
{
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_AttributeSetInstance_ID", "0");
@ -836,6 +841,9 @@ public class InfoProductWindow extends InfoWindow {
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Locator_ID",
String.valueOf(m_M_Locator_ID));
}
// publish for Callout to read
Integer ID = getSelectedRowKey();
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "M_Product_ID", ID == null ? "0" : ID.toString());
}
@Override