[ 1756793 ] RMA Feature

- Incorporate bug fix from client production site.
This commit is contained in:
Heng Sin Low 2008-01-17 06:10:33 +00:00
parent ab6e911dad
commit 4d45c2eb8a
5 changed files with 63 additions and 47 deletions

View File

@ -145,35 +145,9 @@ public class InvoiceGenerateRMA extends SvrProcess
}
MInvoice invoice = new MInvoice(getCtx(), 0, get_TrxName());
invoice.setRMA(rma);
invoice.setM_RMA_ID(rma.getM_RMA_ID());
invoice.setAD_Org_ID(rma.getAD_Org_ID());
invoice.setDescription(rma.getDescription());
invoice.setC_BPartner_ID(rma.getC_BPartner_ID());
invoice.setSalesRep_ID(rma.getSalesRep_ID());
invoice.setC_DocTypeTarget_ID(docTypeId);
invoice.setGrandTotal(rma.getAmt());
invoice.setIsSOTrx(rma.isSOTrx());
invoice.setTotalLines(rma.getAmt());
MInvoice originalInvoice = rma.getOriginalInvoice();
if (originalInvoice == null)
{
throw new IllegalStateException("Not invoiced - RMA: " + rma.getDocumentNo());
}
invoice.setC_BPartner_Location_ID(originalInvoice.getC_BPartner_Location_ID());
invoice.setAD_User_ID(originalInvoice.getAD_User_ID());
invoice.setC_Currency_ID(originalInvoice.getC_Currency_ID());
invoice.setIsTaxIncluded(originalInvoice.isTaxIncluded());
invoice.setM_PriceList_ID(originalInvoice.getM_PriceList_ID());
invoice.setC_Project_ID(originalInvoice.getC_Project_ID());
invoice.setC_Activity_ID(originalInvoice.getC_Activity_ID());
invoice.setC_Campaign_ID(originalInvoice.getC_Campaign_ID());
invoice.setUser1_ID(originalInvoice.getUser1_ID());
invoice.setUser2_ID(originalInvoice.getUser2_ID());
if (!invoice.save())
{
throw new IllegalStateException("Could not create invoice");
@ -197,22 +171,7 @@ public class InvoiceGenerateRMA extends SvrProcess
}
MInvoiceLine invLine = new MInvoiceLine(invoice);
invLine.setAD_Org_ID(rmaLine.getAD_Org_ID());
invLine.setM_RMALine_ID(rmaLine.getM_RMALine_ID());
invLine.setDescription(rmaLine.getDescription());
invLine.setLine(rmaLine.getLine());
invLine.setC_Charge_ID(rmaLine.getC_Charge_ID());
invLine.setM_Product_ID(rmaLine.getM_Product_ID());
invLine.setC_UOM_ID(rmaLine.getC_UOM_ID());
invLine.setC_Tax_ID(rmaLine.getC_Tax_ID());
invLine.setPrice(rmaLine.getAmt());
invLine.setQty(rmaLine.getQty());
invLine.setLineNetAmt();
invLine.setTaxAmt();
invLine.setLineTotalAmt(rmaLine.getLineNetAmt());
invLine.setC_Project_ID(rmaLine.getC_Project_ID());
invLine.setC_Activity_ID(rmaLine.getC_Activity_ID());
invLine.setC_Campaign_ID(rmaLine.getC_Campaign_ID());
invLine.setRMALine(rmaLine);
if (!invLine.save())
{

View File

@ -947,7 +947,7 @@ public class MInOut extends X_M_InOut implements DocAction
return false;
}
if (!isSOTrx() && getM_RMA_ID() != 0)
if (isSOTrx() && getM_RMA_ID() != 0)
{
// Set Document and Movement type for this Receipt
MRMA rma = new MRMA(getCtx(), getM_RMA_ID(), get_TrxName());
@ -1348,11 +1348,11 @@ public class MInOut extends X_M_InOut implements DocAction
{
if (isSOTrx())
{
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().subtract(Qty));
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().add(Qty));
}
else
{
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().add(Qty));
rmaLine.setQtyDelivered(rmaLine.getQtyDelivered().subtract(Qty));
}
if (!rmaLine.save())
{

View File

@ -2319,5 +2319,39 @@ public class MInvoice extends X_C_Invoice implements DocAction
return getGrandTotal();
} // getApprovalAmt
/**
*
* @param rma
*/
public void setRMA(MRMA rma)
{
setM_RMA_ID(rma.getM_RMA_ID());
setAD_Org_ID(rma.getAD_Org_ID());
setDescription(rma.getDescription());
setC_BPartner_ID(rma.getC_BPartner_ID());
setSalesRep_ID(rma.getSalesRep_ID());
setGrandTotal(rma.getAmt());
setIsSOTrx(rma.isSOTrx());
setTotalLines(rma.getAmt());
MInvoice originalInvoice = rma.getOriginalInvoice();
if (originalInvoice == null)
{
throw new IllegalStateException("Not invoiced - RMA: " + rma.getDocumentNo());
}
setC_BPartner_Location_ID(originalInvoice.getC_BPartner_Location_ID());
setAD_User_ID(originalInvoice.getAD_User_ID());
setC_Currency_ID(originalInvoice.getC_Currency_ID());
setIsTaxIncluded(originalInvoice.isTaxIncluded());
setM_PriceList_ID(originalInvoice.getM_PriceList_ID());
setC_Project_ID(originalInvoice.getC_Project_ID());
setC_Activity_ID(originalInvoice.getC_Activity_ID());
setC_Campaign_ID(originalInvoice.getC_Campaign_ID());
setUser1_ID(originalInvoice.getUser1_ID());
setUser2_ID(originalInvoice.getUser2_ID());
}
} // MInvoice

View File

@ -1169,4 +1169,27 @@ public class MInvoiceLine extends X_C_InvoiceLine
return count;
} // copyLinesFrom
// end MZ
/**
* @param rmaline
*/
public void setRMALine(MRMALine rmaLine)
{
setAD_Org_ID(rmaLine.getAD_Org_ID());
setM_RMALine_ID(rmaLine.getM_RMALine_ID());
setDescription(rmaLine.getDescription());
setLine(rmaLine.getLine());
setC_Charge_ID(rmaLine.getC_Charge_ID());
setM_Product_ID(rmaLine.getM_Product_ID());
setC_UOM_ID(rmaLine.getC_UOM_ID());
setC_Tax_ID(rmaLine.getC_Tax_ID());
setPrice(rmaLine.getAmt());
setQty(rmaLine.getQty());
setLineNetAmt();
setTaxAmt();
setLineTotalAmt(rmaLine.getLineNetAmt());
setC_Project_ID(rmaLine.getC_Project_ID());
setC_Activity_ID(rmaLine.getC_Activity_ID());
setC_Campaign_ID(rmaLine.getC_Campaign_ID());
}
} // MInvoiceLine

View File

@ -134,7 +134,7 @@ public class MRMA extends X_M_RMA implements DocAction
public MOrder getOriginalOrder()
{
MInOut shipment = getShipment();
if (shipment == null)
if (shipment == null || shipment.getC_Order_ID() == 0)
{
return null;
}