FR [1756793] - RMA Feature

https://sourceforge.net/tracker/?func=detail&atid=879334&aid=1756793&group_id=176962
more test cases solved
This commit is contained in:
Carlos Ruiz 2009-09-13 00:21:51 +00:00
parent 8905fc346d
commit 95dd9ab501
8 changed files with 128 additions and 38 deletions

View File

@ -88,7 +88,7 @@ public class InvoiceGenerateRMA extends SvrProcess
}
String sql = "SELECT rma.M_RMA_ID FROM M_RMA rma, T_Selection "
+ "WHERE rma.DocStatus='CO' AND rma.IsSOTrx='N' AND rma.AD_Client_ID=? "
+ "WHERE rma.DocStatus='CO' AND rma.IsSOTrx='Y' AND rma.AD_Client_ID=? "
+ "AND rma.M_RMA_ID = T_Selection.T_Selection_ID "
+ "AND T_Selection.AD_PInstance_ID=? ";
@ -164,9 +164,9 @@ public class InvoiceGenerateRMA extends SvrProcess
for (MRMALine rmaLine : rmaLines)
{
if (!rmaLine.isShipLineInvoiced() && rmaLine.getM_InOutLine_ID() != 0)
if (rmaLine.getM_InOutLine_ID() == 0)
{
throw new IllegalStateException("No invoice line - RMA = "
throw new IllegalStateException("No customer return line - RMA = "
+ rma.getDocumentNo() + ", Line = " + rmaLine.getLine());
}

View File

@ -122,7 +122,7 @@ public class InvoiceGen extends GenForm
}
/**
* Get SQL for Vendor RMA that need to be shipped
* Get SQL for Customer RMA that need to be invoiced
* @return sql
*/
private String getRMASql()
@ -134,15 +134,15 @@ public class InvoiceGen extends GenForm
sql.append("INNER JOIN C_BPartner bp ON rma.C_BPartner_ID=bp.C_BPartner_ID ");
sql.append("INNER JOIN M_InOut io ON rma.InOut_ID=io.M_InOut_ID ");
sql.append("WHERE rma.DocStatus='CO' ");
sql.append("AND dt.DocBaseType = 'POO' ");
sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
sql.append("AND iol.M_InOutLine_ID IN ");
sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
sql.append("AND dt.DocBaseType = 'SOO' ");
// sql.append("AND NOT EXISTS (SELECT * FROM C_Invoice i ");
// sql.append("WHERE i.M_RMA_ID=rma.M_RMA_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
// sql.append("AND EXISTS (SELECT * FROM C_InvoiceLine il INNER JOIN M_InOutLine iol ");
// sql.append("ON il.M_InOutLine_ID=iol.M_InOutLine_ID INNER JOIN C_Invoice i ");
// sql.append("ON i.C_Invoice_ID=il.C_Invoice_ID WHERE i.DocStatus IN ('CO', 'CL') ");
// sql.append("AND iol.M_InOutLine_ID IN ");
// sql.append("(SELECT M_InOutLine_ID FROM M_RMALine rl WHERE rl.M_RMA_ID=rma.M_RMA_ID ");
// sql.append("AND rl.M_InOutLine_ID IS NOT NULL)) ");
sql.append("AND rma.AD_Client_ID=?");
if (m_AD_Org_ID != null)

View File

@ -154,7 +154,7 @@ public class VInvoiceGen extends InvoiceGen implements FormPanel, ActionListener
//Document Type Sales Order/Vendor RMA
lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA")));
cmbDocType.addActionListener(this);
panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));//@@

View File

@ -61,6 +61,10 @@ import org.compiere.util.Msg;
public class VCreateFromShipmentUI extends CreateFromShipment implements ActionListener, VetoableChangeListener
{
private static final int WINDOW_CUSTOMER_RETURN = 53097;
private static final int WINDOW_RETURN_TO_VENDOR = 53098;
private VCreateFromDialog dialog;
public VCreateFromShipmentUI(GridTab mTab)
@ -157,6 +161,8 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL
*/
private void jbInit() throws Exception
{
boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURN_TO_VENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMER_RETURN));
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
@ -177,15 +183,17 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL
parameterStdPanel.add(bPartnerField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(orderLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(orderField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
if (! isRMAWindow) {
parameterStdPanel.add(orderLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(orderField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(invoiceLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(invoiceField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(invoiceLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(invoiceField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
}
parameterStdPanel.add(locatorLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
@ -198,11 +206,13 @@ public class VCreateFromShipmentUI extends CreateFromShipment implements ActionL
parameterStdPanel.add(upcField, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
// Add RMA document selection to panel
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(rmaField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
if (isRMAWindow) {
// Add RMA document selection to panel
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(rmaField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
}
} // jbInit
/*************************************************************************/

View File

@ -0,0 +1,35 @@
-- Sep 12, 2009 6:04:41 PM COT
-- FR1756793 RMA
UPDATE AD_Field SET Description='Creates a replacement sales order based on this RMA Document. The RMA should be correct and completed.', Help='Generate replacemente sales order from RMA will create an order based on this RMA document.', Name='Create Replacement Sales Order',Updated=TO_DATE('2009-09-12 18:04:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52000
;
-- Sep 12, 2009 6:04:41 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=52000
;
-- Sep 12, 2009 6:05:58 PM COT
UPDATE AD_Field SET Description='Creates a replacement purchase order based on this RMA Document. The RMA should be correct and completed.', Help='Generate replacement purchase order from RMA will create an order based on this RMA document.', Name='Create Replacement Purchase Order',Updated=TO_DATE('2009-09-12 18:05:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:05:58 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:06:05 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:06:26 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57964
;
-- Sep 12, 2009 6:40:22 PM COT
-- FR1756793 - RMA Feature
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53082,0,TO_DATE('2009-09-12 18:40:21','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Customer RMA','I',TO_DATE('2009-09-12 18:40:21','YYYY-MM-DD HH24:MI:SS'),100,'CustomerRMA')
;
-- Sep 12, 2009 6:40:22 PM COT
-- FR1756793 - RMA Feature
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53082 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;

View File

@ -0,0 +1,35 @@
-- Sep 12, 2009 6:04:41 PM COT
-- FR1756793 RMA
UPDATE AD_Field SET Description='Creates a replacement sales order based on this RMA Document. The RMA should be correct and completed.', Help='Generate replacemente sales order from RMA will create an order based on this RMA document.', Name='Create Replacement Sales Order',Updated=TO_TIMESTAMP('2009-09-12 18:04:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=52000
;
-- Sep 12, 2009 6:04:41 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=52000
;
-- Sep 12, 2009 6:05:58 PM COT
UPDATE AD_Field SET Description='Creates a replacement purchase order based on this RMA Document. The RMA should be correct and completed.', Help='Generate replacement purchase order from RMA will create an order based on this RMA document.', Name='Create Replacement Purchase Order',Updated=TO_TIMESTAMP('2009-09-12 18:05:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:05:58 PM COT
UPDATE AD_Field_Trl SET IsTranslated='N' WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:06:05 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57965
;
-- Sep 12, 2009 6:06:26 PM COT
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=57964
;
-- Sep 12, 2009 6:40:22 PM COT
-- FR1756793 - RMA Feature
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgType,Updated,UpdatedBy,Value) VALUES (0,53082,0,TO_TIMESTAMP('2009-09-12 18:40:21','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Customer RMA','I',TO_TIMESTAMP('2009-09-12 18:40:21','YYYY-MM-DD HH24:MI:SS'),100,'CustomerRMA')
;
-- Sep 12, 2009 6:40:22 PM COT
-- FR1756793 - RMA Feature
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53082 AND EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language!=l.AD_Language OR tt.AD_Message_ID!=t.AD_Message_ID)
;

View File

@ -59,8 +59,10 @@ import org.zkoss.zul.Space;
public class WCreateFromShipmentUI extends CreateFromShipment implements EventListener, ValueChangeListener
{
private static final long serialVersionUID = 1L;
private static final int WINDOW_CUSTOMER_RETURN = 53097;
private static final int WINDOW_RETURN_TO_VENDOR = 53098;
private WCreateFromWindow window;
public WCreateFromShipmentUI(GridTab tab)
@ -147,7 +149,9 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
protected void zkInit() throws Exception
{
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
boolean isRMAWindow = ((getGridTab().getAD_Window_ID() == WINDOW_RETURN_TO_VENDOR) || (getGridTab().getAD_Window_ID() == WINDOW_CUSTOMER_RETURN));
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
@ -176,25 +180,31 @@ public class WCreateFromShipmentUI extends CreateFromShipment implements EventLi
row.appendChild(bPartnerLabel.rightAlign());
if (bPartnerField != null)
row.appendChild(bPartnerField.getComponent());
row.appendChild(orderLabel.rightAlign());
row.appendChild(orderField);
if (! isRMAWindow) {
row.appendChild(orderLabel.rightAlign());
row.appendChild(orderField);
}
row = rows.newRow();
row.appendChild(locatorLabel.rightAlign());
row.appendChild(locatorField.getComponent());
row.appendChild(invoiceLabel.rightAlign());
row.appendChild(invoiceField);
if (! isRMAWindow) {
row.appendChild(invoiceLabel.rightAlign());
row.appendChild(invoiceField);
}
row = rows.newRow();
row.appendChild(new Space());
row.appendChild(sameWarehouseCb);
// Add RMA document selection to panel
row = rows.newRow();
row.appendChild(upcLabel.rightAlign());
row.appendChild(upcField.getComponent());
row.appendChild(rmaLabel.rightAlign());
row.appendChild(rmaField);
if (isRMAWindow) {
// Add RMA document selection to panel
row.appendChild(rmaLabel.rightAlign());
row.appendChild(rmaField);
}
}
private boolean m_actionActive = false;

View File

@ -144,7 +144,7 @@ public class WInvoiceGen extends InvoiceGen implements IFormController, EventLis
// Document Type Sales Order/Vendor RMA
lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA")));
cmbDocType.addActionListener(form);
cmbDocType.setSelectedIndex(0);