BF [ 2804142 ] MInvoice.setRMALine should work only for CreditMemo invoices

https://sourceforge.net/tracker/?func=detail&aid=2804142&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2009-06-10 13:30:40 +00:00
parent 08b24cc689
commit 17d3b90aa6
1 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -35,6 +36,10 @@ import org.compiere.util.Msg;
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: MInvoiceLine.java,v 1.5 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MInvoiceLine.java,v 1.5 2006/07/30 00:51:03 jjanke Exp $
*
* @author Teo Sarca, www.arhipac.ro
* <li>BF [ 2804142 ] MInvoice.setRMALine should work only for CreditMemo invoices
* https://sourceforge.net/tracker/?func=detail&aid=2804142&group_id=176962&atid=879332
*/ */
public class MInvoiceLine extends X_C_InvoiceLine public class MInvoiceLine extends X_C_InvoiceLine
{ {
@ -1213,6 +1218,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
*/ */
public void setRMALine(MRMALine rmaLine) public void setRMALine(MRMALine rmaLine)
{ {
// Check if this invoice is CreditMemo - teo_sarca [ 2804142 ]
if (!getParent().isCreditMemo())
{
throw new AdempiereException("InvoiceNotCreditMemo");
}
setAD_Org_ID(rmaLine.getAD_Org_ID()); setAD_Org_ID(rmaLine.getAD_Org_ID());
setM_RMALine_ID(rmaLine.getM_RMALine_ID()); setM_RMALine_ID(rmaLine.getM_RMALine_ID());
setDescription(rmaLine.getDescription()); setDescription(rmaLine.getDescription());