Carlos Ruiz 2009-09-15 03:39:23 +00:00
parent d5e8cf1176
commit 4849879b62
7 changed files with 300 additions and 18 deletions

View File

@ -24,24 +24,24 @@ import org.compiere.model.MRMALine;
import org.compiere.process.SvrProcess;
/**
* Creates Sales Order from RMA document
* Creates Order from RMA document
*
* @author Ashley Ramdass
*/
public class RMACreateOrder extends SvrProcess
{
private int rmaId = 0;
@Override
protected void prepare()
{
rmaId = getRecord_ID();
}
@Override
protected String doIt() throws Exception
{
int rmaId = getRecord_ID();
// Load RMA
MRMA rma = new MRMA(getCtx(), rmaId, get_TrxName());
@ -115,8 +115,6 @@ public class RMACreateOrder extends SvrProcess
throw new IllegalStateException("Could not update RMA document");
}
commit();
return "Order Created: " + order.getDocumentNo();
}

View File

@ -85,6 +85,55 @@ public class CalloutInOut extends CalloutEngine
return "";
} // order
/**
* M_RMA - RMA Defaults.
* @param ctx
* @param WindowNo
* @param mTab
* @param mField
* @param value
* @return error message or ""
*/
public String rma (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer M_RMA_ID = (Integer)value;
if (M_RMA_ID == null || M_RMA_ID.intValue() == 0)
return "";
// No Callout Active to fire dependent values
if (isCalloutActive()) // prevent recursive
return "";
// Get Details
MRMA rma = new MRMA (ctx, M_RMA_ID.intValue(), null);
MInOut originalReceipt = rma.getShipment();
if (rma.get_ID() != 0)
{
mTab.setValue("DateOrdered", originalReceipt.getDateOrdered());
mTab.setValue("POReference", originalReceipt.getPOReference());
mTab.setValue("AD_Org_ID", new Integer(originalReceipt.getAD_Org_ID()));
mTab.setValue("AD_OrgTrx_ID", new Integer(originalReceipt.getAD_OrgTrx_ID()));
mTab.setValue("C_Activity_ID", new Integer(originalReceipt.getC_Activity_ID()));
mTab.setValue("C_Campaign_ID", new Integer(originalReceipt.getC_Campaign_ID()));
mTab.setValue("C_Project_ID", new Integer(originalReceipt.getC_Project_ID()));
mTab.setValue("User1_ID", new Integer(originalReceipt.getUser1_ID()));
mTab.setValue("User2_ID", new Integer(originalReceipt.getUser2_ID()));
mTab.setValue("M_Warehouse_ID", new Integer(originalReceipt.getM_Warehouse_ID()));
//
mTab.setValue("DeliveryRule", originalReceipt.getDeliveryRule());
mTab.setValue("DeliveryViaRule", originalReceipt.getDeliveryViaRule());
mTab.setValue("M_Shipper_ID", new Integer(originalReceipt.getM_Shipper_ID()));
mTab.setValue("FreightCostRule", originalReceipt.getFreightCostRule());
mTab.setValue("FreightAmt", originalReceipt.getFreightAmt());
mTab.setValue("C_BPartner_ID", new Integer(originalReceipt.getC_BPartner_ID()));
//[ 1867464 ]
mTab.setValue("C_BPartner_Location_ID", new Integer(originalReceipt.getC_BPartner_Location_ID()));
mTab.setValue("AD_User_ID", new Integer(originalReceipt.getAD_User_ID()));
}
return "";
} // rma
/**
* InOut - DocType.
@ -366,6 +415,51 @@ public class CalloutInOut extends CalloutEngine
return "";
} // orderLine
/**************************************************************************
* RMALine Callout
* @param ctx context
* @param WindowNo window no
* @param mTab tab model
* @param mField field model
* @param value new value
* @return error message or ""
*/
public String rmaLine (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
Integer M_RMALine_id = (Integer)value;
if (M_RMALine_id == null || M_RMALine_id.intValue() == 0)
return "";
// Get Details
MRMALine rl = new MRMALine (ctx, M_RMALine_id.intValue(), null);
if (rl.get_ID() != 0)
{
if (rl.getC_Charge_ID() > 0 && rl.getM_Product_ID() <= 0) {
mTab.setValue("C_Charge_ID", new Integer(rl.getC_Charge_ID()));
}
else {
mTab.setValue("M_Product_ID", new Integer(rl.getM_Product_ID()));
mTab.setValue("M_AttributeSetInstance_ID", new Integer(rl.getM_AttributeSetInstance_ID()));
}
//
mTab.setValue("C_UOM_ID", new Integer(rl.getC_UOM_ID()));
BigDecimal MovementQty = rl.getQty().subtract(rl.getQtyDelivered());
mTab.setValue("MovementQty", MovementQty);
BigDecimal QtyEntered = MovementQty;
mTab.setValue("QtyEntered", QtyEntered);
//
mTab.setValue("C_Activity_ID", new Integer(rl.getC_Activity_ID()));
mTab.setValue("C_Campaign_ID", new Integer(rl.getC_Campaign_ID()));
mTab.setValue("C_Project_ID", new Integer(rl.getC_Project_ID()));
mTab.setValue("C_ProjectPhase_ID", new Integer(rl.getC_ProjectPhase_ID()));
mTab.setValue("C_ProjectTask_ID", new Integer(rl.getC_ProjectTask_ID()));
mTab.setValue("AD_OrgTrx_ID", new Integer(rl.getAD_OrgTrx_ID()));
mTab.setValue("User1_ID", new Integer(rl.getUser1_ID()));
mTab.setValue("User2_ID", new Integer(rl.getUser2_ID()));
}
return "";
} // rmaLine
/**
* M_InOutLine - Default UOM/Locator for Product.
* @param ctx context

View File

@ -532,24 +532,27 @@ public class MInvoice extends X_C_Invoice implements DocAction
// Check if Shipment/Receipt is based on RMA
if (ship.getM_RMA_ID() != 0)
{
MRMA rma = new MRMA(getCtx(), ship.getM_RMA_ID(), get_TrxName());
MOrder rmaOrder = rma.getOriginalOrder();
setM_RMA_ID(ship.getM_RMA_ID());
setIsSOTrx(rma.isSOTrx());
setM_PriceList_ID(rmaOrder.getM_PriceList_ID());
setIsTaxIncluded(rmaOrder.isTaxIncluded());
setC_Currency_ID(rmaOrder.getC_Currency_ID());
setC_ConversionType_ID(rmaOrder.getC_ConversionType_ID());
setPaymentRule(rmaOrder.getPaymentRule());
setC_PaymentTerm_ID(rmaOrder.getC_PaymentTerm_ID());
MRMA rma = new MRMA(getCtx(), ship.getM_RMA_ID(), get_TrxName());
// Retrieves the invoice DocType
MDocType dt = MDocType.get(getCtx(), rma.getC_DocType_ID());
if (dt.getC_DocTypeInvoice_ID() != 0)
{
setC_DocTypeTarget_ID(dt.getC_DocTypeInvoice_ID());
}
setC_BPartner_Location_ID(rmaOrder.getBill_Location_ID());
setIsSOTrx(rma.isSOTrx());
MOrder rmaOrder = rma.getOriginalOrder();
if (rmaOrder != null) {
setM_PriceList_ID(rmaOrder.getM_PriceList_ID());
setIsTaxIncluded(rmaOrder.isTaxIncluded());
setC_Currency_ID(rmaOrder.getC_Currency_ID());
setC_ConversionType_ID(rmaOrder.getC_ConversionType_ID());
setPaymentRule(rmaOrder.getPaymentRule());
setC_PaymentTerm_ID(rmaOrder.getC_PaymentTerm_ID());
setC_BPartner_Location_ID(rmaOrder.getBill_Location_ID());
}
}
} // setShipment

View File

@ -101,7 +101,8 @@ public class MRMALine extends X_M_RMALine
if (m_ioLine != null)
{
// Get pricing details (Based on invoice if found, on order otherwise)
if (m_ioLine.isInvoiced() && getInvoiceLineId() != 0)
// --> m_ioLine.isInvoiced just work for sales orders - so it doesn't work for purchases
if (getInvoiceLineId() != 0)
{
MInvoiceLine invoiceLine = new MInvoiceLine(getCtx(), getInvoiceLineId(), get_TrxName());
precision = invoiceLine.getPrecision();

View File

@ -80,7 +80,7 @@ public class InOutCreateInvoice extends SvrProcess
MInvoice invoice = new MInvoice (ship, null);
// Should not override pricelist for RMA
if (p_M_PriceList_ID != 0 && ship.getM_RMA_ID() != 0)
if (p_M_PriceList_ID != 0 && ship.getM_RMA_ID() == 0)
invoice.setM_PriceList_ID(p_M_PriceList_ID);
if (p_InvoiceDocumentNo != null && p_InvoiceDocumentNo.length() > 0)
invoice.setDocumentNo(p_InvoiceDocumentNo);

View File

@ -0,0 +1,93 @@
-- Sep 14, 2009 9:34:00 PM COT
-- FR1756793 - RMA Feature
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInOut.rma',Updated=TO_DATE('2009-09-14 21:34:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52009
;
-- Sep 14, 2009 9:34:39 PM COT
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_DATE('2009-09-14 21:34:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57847
;
-- Sep 14, 2009 9:34:49 PM COT
UPDATE AD_Field SET DisplayLogic='@C_Order_ID@!0',Updated=TO_DATE('2009-09-14 21:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57845
;
-- Sep 14, 2009 9:34:51 PM COT
UPDATE AD_Field SET DisplayLogic='@C_Order_ID@!0',Updated=TO_DATE('2009-09-14 21:34:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57846
;
-- Sep 14, 2009 9:35:15 PM COT
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_DATE('2009-09-14 21:35:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57713
;
-- Sep 14, 2009 9:43:31 PM COT
UPDATE AD_Field SET DisplayLogic='@MovementType@=''V-''',Updated=TO_DATE('2009-09-14 21:43:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57875
;
-- Sep 14, 2009 9:49:38 PM COT
UPDATE AD_Table SET PO_Window_ID=53099,Updated=TO_DATE('2009-09-14 21:49:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=661
;
-- Sep 14, 2009 9:49:43 PM COT
UPDATE AD_Table SET PO_Window_ID=53099,Updated=TO_DATE('2009-09-14 21:49:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=660
;
-- Sep 14, 2009 10:17:19 PM COT
UPDATE AD_Field SET IsReadOnly='N',Updated=TO_DATE('2009-09-14 22:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57713
;
-- Sep 14, 2009 10:18:53 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInOut.rmaLine',Updated=TO_DATE('2009-09-14 22:18:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52010
;
-- Sep 14, 2009 10:19:02 PM COT
UPDATE AD_Field SET AD_Column_ID=52010, Description='Return Material Authorization Line', DisplayLogic=NULL, Help='Detail information about the returned goods', IsReadOnly='N', Name='RMA Line',Updated=TO_DATE('2009-09-14 22:19:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57762
;
-- Sep 14, 2009 10:19:02 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57762
;
-- Sep 14, 2009 10:19:31 PM COT
UPDATE AD_Field SET AD_Column_ID=52010, Description='Return Material Authorization Line', Help='Detail information about the returned goods', Name='RMA Line',Updated=TO_DATE('2009-09-14 22:19:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57901
;
-- Sep 14, 2009 10:19:31 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57901
;
-- Sep 14, 2009 10:25:37 PM COT
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52067,'(IsSOTrx=''@IsSOTrx@'' AND DocStatus=''CO'')',TO_DATE('2009-09-14 22:25:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','M_RMA in M_InOut (Complete and IsSOTrx)','S',TO_DATE('2009-09-14 22:25:36','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 14, 2009 10:26:08 PM COT
UPDATE AD_Column SET AD_Reference_ID=30, AD_Val_Rule_ID=52067,Updated=TO_DATE('2009-09-14 22:26:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52009
;
-- Sep 14, 2009 10:27:34 PM COT
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52068,'M_RMALine.M_RMA_ID=@M_RMA_ID@',TO_DATE('2009-09-14 22:27:33','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','M_RMALine of RMA','S',TO_DATE('2009-09-14 22:27:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 14, 2009 10:27:51 PM COT
UPDATE AD_Column SET AD_Val_Rule_ID=52068,Updated=TO_DATE('2009-09-14 22:27:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52010
;
-- Sep 14, 2009 10:32:53 PM COT
UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_DATE('2009-09-14 22:32:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52006
;
-- Sep 14, 2009 10:33:30 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57965
;
-- Sep 14, 2009 10:33:42 PM COT
UPDATE AD_Field SET DisplayLogic='@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO'' & @IsSOTrx@=''N''',Updated=TO_DATE('2009-09-14 22:33:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57965
;
-- Sep 14, 2009 10:33:52 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57964
;
-- Sep 14, 2009 10:33:52 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=57965
;

View File

@ -0,0 +1,93 @@
-- Sep 14, 2009 9:34:00 PM COT
-- FR1756793 - RMA Feature
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInOut.rma',Updated=TO_TIMESTAMP('2009-09-14 21:34:00','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52009
;
-- Sep 14, 2009 9:34:39 PM COT
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_TIMESTAMP('2009-09-14 21:34:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57847
;
-- Sep 14, 2009 9:34:49 PM COT
UPDATE AD_Field SET DisplayLogic='@C_Order_ID@!0',Updated=TO_TIMESTAMP('2009-09-14 21:34:49','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57845
;
-- Sep 14, 2009 9:34:51 PM COT
UPDATE AD_Field SET DisplayLogic='@C_Order_ID@!0',Updated=TO_TIMESTAMP('2009-09-14 21:34:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57846
;
-- Sep 14, 2009 9:35:15 PM COT
UPDATE AD_Field SET DisplayLogic=NULL,Updated=TO_TIMESTAMP('2009-09-14 21:35:15','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57713
;
-- Sep 14, 2009 9:43:31 PM COT
UPDATE AD_Field SET DisplayLogic='@MovementType@=''V-''',Updated=TO_TIMESTAMP('2009-09-14 21:43:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57875
;
-- Sep 14, 2009 9:49:38 PM COT
UPDATE AD_Table SET PO_Window_ID=53099,Updated=TO_TIMESTAMP('2009-09-14 21:49:38','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=661
;
-- Sep 14, 2009 9:49:43 PM COT
UPDATE AD_Table SET PO_Window_ID=53099,Updated=TO_TIMESTAMP('2009-09-14 21:49:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=660
;
-- Sep 14, 2009 10:17:19 PM COT
UPDATE AD_Field SET IsReadOnly='N',Updated=TO_TIMESTAMP('2009-09-14 22:17:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57713
;
-- Sep 14, 2009 10:18:53 PM COT
UPDATE AD_Column SET Callout='org.compiere.model.CalloutInOut.rmaLine',Updated=TO_TIMESTAMP('2009-09-14 22:18:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52010
;
-- Sep 14, 2009 10:19:02 PM COT
UPDATE AD_Field SET AD_Column_ID=52010, Description='Return Material Authorization Line', DisplayLogic=NULL, Help='Detail information about the returned goods', IsReadOnly='N', Name='RMA Line',Updated=TO_TIMESTAMP('2009-09-14 22:19:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57762
;
-- Sep 14, 2009 10:19:02 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57762
;
-- Sep 14, 2009 10:19:31 PM COT
UPDATE AD_Field SET AD_Column_ID=52010, Description='Return Material Authorization Line', Help='Detail information about the returned goods', Name='RMA Line',Updated=TO_TIMESTAMP('2009-09-14 22:19:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57901
;
-- Sep 14, 2009 10:19:31 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57901
;
-- Sep 14, 2009 10:25:37 PM COT
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52067,'(IsSOTrx=''@IsSOTrx@'' AND DocStatus=''CO'')',TO_TIMESTAMP('2009-09-14 22:25:36','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','M_RMA in M_InOut (Complete and IsSOTrx)','S',TO_TIMESTAMP('2009-09-14 22:25:36','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 14, 2009 10:26:08 PM COT
UPDATE AD_Column SET AD_Reference_ID=30, AD_Val_Rule_ID=52067,Updated=TO_TIMESTAMP('2009-09-14 22:26:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52009
;
-- Sep 14, 2009 10:27:34 PM COT
INSERT INTO AD_Val_Rule (AD_Client_ID,AD_Org_ID,AD_Val_Rule_ID,Code,Created,CreatedBy,EntityType,IsActive,Name,Type,Updated,UpdatedBy) VALUES (0,0,52068,'M_RMALine.M_RMA_ID=@M_RMA_ID@',TO_TIMESTAMP('2009-09-14 22:27:33','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','M_RMALine of RMA','S',TO_TIMESTAMP('2009-09-14 22:27:33','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Sep 14, 2009 10:27:51 PM COT
UPDATE AD_Column SET AD_Val_Rule_ID=52068,Updated=TO_TIMESTAMP('2009-09-14 22:27:51','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52010
;
-- Sep 14, 2009 10:32:53 PM COT
UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_TIMESTAMP('2009-09-14 22:32:53','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=52006
;
-- Sep 14, 2009 10:33:30 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57965
;
-- Sep 14, 2009 10:33:42 PM COT
UPDATE AD_Field SET DisplayLogic='@Processed@=''Y'' & @C_Order_ID@=0 & @DocStatus@=''CO'' & @IsSOTrx@=''N''',Updated=TO_TIMESTAMP('2009-09-14 22:33:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57965
;
-- Sep 14, 2009 10:33:52 PM COT
UPDATE AD_Field SET SeqNo=150,IsDisplayed='Y' WHERE AD_Field_ID=57964
;
-- Sep 14, 2009 10:33:52 PM COT
UPDATE AD_Field SET SeqNo=160,IsDisplayed='Y' WHERE AD_Field_ID=57965
;