Implement [ 1783032 ] Add DocAction parameter to Generate Invoices (manual) form

Accepted patch 2028438 from d_ruiz
This commit is contained in:
Carlos Ruiz 2008-07-26 22:55:46 +00:00
parent c7cf233ed0
commit 8ad9490bf8
3 changed files with 35 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -103,6 +103,9 @@ public class VInvoiceGen extends CPanel
private CLabel lDocType = new CLabel(); private CLabel lDocType = new CLabel();
private VComboBox cmbDocType = new VComboBox(); private VComboBox cmbDocType = new VComboBox();
private CLabel lDocAction = new CLabel();
private VLookup docAction;
/** /**
* Static Init. * Static Init.
@ -122,6 +125,8 @@ public class VInvoiceGen extends CPanel
selPanel.setLayout(selPanelLayout); selPanel.setLayout(selPanelLayout);
lOrg.setLabelFor(fOrg); lOrg.setLabelFor(fOrg);
lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID")); lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
lDocAction.setLabelFor(docAction);
lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
lBPartner.setLabelFor(fBPartner); lBPartner.setLabelFor(fBPartner);
lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID")); lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
selNorthPanel.setLayout(northPanelLayout); selNorthPanel.setLayout(northPanelLayout);
@ -150,6 +155,9 @@ public class VInvoiceGen extends CPanel
lDocType.setLabelFor(cmbDocType); lDocType.setLabelFor(cmbDocType);
selNorthPanel.add(lDocType, null); selNorthPanel.add(lDocType, null);
selNorthPanel.add(cmbDocType, null); selNorthPanel.add(cmbDocType, null);
selNorthPanel.add(lDocAction, null);
selNorthPanel.add(docAction, null);
} // jbInit } // jbInit
/** /**
@ -161,8 +169,16 @@ public class VInvoiceGen extends CPanel
{ {
MLookup orgL = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, 2163, DisplayType.TableDir); MLookup orgL = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, 2163, DisplayType.TableDir);
fOrg = new VLookup ("AD_Org_ID", false, false, true, orgL); fOrg = new VLookup ("AD_Org_ID", false, false, true, orgL);
// lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID")); // lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
fOrg.addVetoableChangeListener(this); fOrg.addVetoableChangeListener(this);
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 3494 /* C_Invoice.DocStatus */,
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135 /* _Document Action */,
false, "AD_Ref_List.Value IN ('CO','PR')");
docAction = new VLookup("DocAction", true, false, true,docActionL);
// lDcoACtion.setText((Msg.translate(Env.getCtx(), "DocAction")););
docAction.addVetoableChangeListener(this);
// //
MLookup bpL = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search); MLookup bpL = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
fBPartner = new VLookup ("C_BPartner_ID", false, false, true, bpL); fBPartner = new VLookup ("C_BPartner_ID", false, false, true, bpL);
@ -220,7 +236,9 @@ public class VInvoiceGen extends CPanel
+ "WHERE ic.AD_Org_ID=o.AD_Org_ID" + "WHERE ic.AD_Org_ID=o.AD_Org_ID"
+ " AND ic.C_BPartner_ID=bp.C_BPartner_ID" + " AND ic.C_BPartner_ID=bp.C_BPartner_ID"
+ " AND ic.C_DocType_ID=dt.C_DocType_ID" + " AND ic.C_DocType_ID=dt.C_DocType_ID"
+ " AND ic.AD_Client_ID=?"); + " AND ic.AD_Client_ID=?"
+ " AND NOT EXISTS (SELECT * FROM C_Invoice i"
+ " WHERE i.C_Order_ID=ic.C_Order_ID AND i.DocStatus IN ('IP', 'CO', 'CL')) ");
if (m_AD_Org_ID != null) if (m_AD_Org_ID != null)
sql.append(" AND ic.AD_Org_ID=").append(m_AD_Org_ID); sql.append(" AND ic.AD_Org_ID=").append(m_AD_Org_ID);
@ -538,8 +556,11 @@ public class VInvoiceGen extends CPanel
log.log(Level.SEVERE, msg); log.log(Level.SEVERE, msg);
return; return;
} }
para = new MPInstancePara(instance, 20); para = new MPInstancePara(instance, 20);
para.setParameter("DocAction", "CO"); String docActionSelected = (String)docAction.getValue();
para.setParameter("DocAction", docActionSelected);
if (!para.save()) if (!para.save())
{ {
String msg = "No DocAction Parameter added"; // not translated String msg = "No DocAction Parameter added"; // not translated

View File

@ -0,0 +1,5 @@
-- Jul 26, 2008 5:50:38 PM COT
-- [ 1783032 ] Add DocAction parameter to Generate Invoices (manual) form
UPDATE AD_Val_Rule SET Code='DocStatus NOT IN (''DR'',''IP'') AND EXISTS (SELECT * FROM C_OrderLine WHERE C_Order.C_Order_ID=C_OrderLine.C_Order_ID AND QtyOrdered <> QtyInvoiced) AND IsSOTrx=''Y'' AND NOT EXISTS (SELECT * FROM C_Invoice i WHERE i.C_Order_ID=C_Order.C_Order_ID AND i.DocStatus IN (''IP'', ''CO'', ''CL''))',Updated=TO_DATE('2008-07-26 17:50:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=134
;

View File

@ -0,0 +1,5 @@
-- Jul 26, 2008 5:50:38 PM COT
-- [ 1783032 ] Add DocAction parameter to Generate Invoices (manual) form
UPDATE AD_Val_Rule SET Code='DocStatus NOT IN (''DR'',''IP'') AND EXISTS (SELECT * FROM C_OrderLine WHERE C_Order.C_Order_ID=C_OrderLine.C_Order_ID AND QtyOrdered <> QtyInvoiced) AND IsSOTrx=''Y'' AND NOT EXISTS (SELECT * FROM C_Invoice i WHERE i.C_Order_ID=C_Order.C_Order_ID AND i.DocStatus IN (''IP'', ''CO'', ''CL''))',Updated=TO_TIMESTAMP('2008-07-26 17:50:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Val_Rule_ID=134
;