IDEMPIERE-2412 Generate Production from Project with Phase - New Process / peer review - add migration script generated from 2pack provided by Chuck Boecking

This commit is contained in:
Carlos Ruiz 2015-02-04 09:58:26 -05:00
parent ed11e5c626
commit 431c9d6d7d
5 changed files with 231 additions and 169 deletions

View File

@ -0,0 +1,31 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Feb 4, 2015 9:37:10 AM COT
-- IDEMPIERE-2412 Generate Production from Project with Phase - New Process
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200077,0,0,'Y',TO_DATE('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,'Generate Production from Project','Generate Production from Project Line(s)','N','C_Project_GenerateProduction','N','org.compiere.process.ProjectGenProduction','1','D',6,6,'N','N','Y','N','542a66f7-afe0-493e-90d4-a91e10f17ac8')
;
-- Feb 4, 2015 9:37:10 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200118,0,0,'Y',TO_DATE('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,'Project','Financial Project','A Project allows you to track and control internal or external activities.',200077,10,19,'N',0,'Y','C_Project_ID','Y','D',208,'fd3854a0-4d69-46b6-9469-775f8f30a319','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200119,0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',200077,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'9ba5e0b9-e245-4129-9f67-55837f1092e1','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200120,0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Line','Task or step in a project','The Project Line indicates a unique project line.',200077,30,19,'N',174,0,'N','C_ProjectLine_ID','Y','D',1552,'67c806e3-f4ba-4fd2-a26a-3082a6c4ff64','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Menu (AD_Menu_ID,Name,Description,Action,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,AD_Process_ID,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200098,'Generate Production from Project','Generate Production from Project Line(s)','P',0,0,'Y',TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'N',200077,'N','N','D','Y','47d506b6-e2d4-4ec3-8df2-9b913c0864b0')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_TREENODEMM(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, Parent_ID, SeqNo, AD_Tree_ID, Node_ID)VALUES(0, 0, 0, 0, 160,5, 10, 200098)
;
SELECT register_migration_script('201502040937_IDEMPIERE-2412.sql') FROM dual
;

View File

@ -0,0 +1,28 @@
-- Feb 4, 2015 9:37:10 AM COT
-- IDEMPIERE-2412 Generate Production from Project with Phase - New Process
INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200077,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:09','YYYY-MM-DD HH24:MI:SS'),100,'Generate Production from Project','Generate Production from Project Line(s)','N','C_Project_GenerateProduction','N','org.compiere.process.ProjectGenProduction','1','D',6,6,'N','N','Y','N','542a66f7-afe0-493e-90d4-a91e10f17ac8')
;
-- Feb 4, 2015 9:37:10 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200118,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:10','YYYY-MM-DD HH24:MI:SS'),100,'Project','Financial Project','A Project allows you to track and control internal or external activities.',200077,10,19,'N',0,'Y','C_Project_ID','Y','D',208,'fd3854a0-4d69-46b6-9469-775f8f30a319','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200119,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Phase','Phase of a Project',200077,20,19,'N',165,10,'N','C_ProjectPhase_ID','Y','D',2073,'9ba5e0b9-e245-4129-9f67-55837f1092e1','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200120,0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'Project Line','Task or step in a project','The Project Line indicates a unique project line.',200077,30,19,'N',174,0,'N','C_ProjectLine_ID','Y','D',1552,'67c806e3-f4ba-4fd2-a26a-3082a6c4ff64','N')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_Menu (AD_Menu_ID,Name,Description,"action",AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsSummary,AD_Process_ID,IsSOTrx,IsReadOnly,EntityType,IsCentrallyMaintained,AD_Menu_UU) VALUES (200098,'Generate Production from Project','Generate Production from Project Line(s)','P',0,0,'Y',TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-04 09:37:11','YYYY-MM-DD HH24:MI:SS'),100,'N',200077,'N','N','D','Y','47d506b6-e2d4-4ec3-8df2-9b913c0864b0')
;
-- Feb 4, 2015 9:37:11 AM COT
INSERT INTO AD_TREENODEMM(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, Parent_ID, SeqNo, AD_Tree_ID, Node_ID)VALUES(0, 0, 0, 0, 160,5, 10, 200098)
;
SELECT register_migration_script('201502040937_IDEMPIERE-2412.sql') FROM dual
;

View File

@ -1,41 +1,40 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* 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 *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
**********************************************************************/
package org.compiere.process;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.logging.Level;
import org.compiere.model.MBPartner;
import org.compiere.model.MConversionRate;
import org.compiere.model.MOrder;
import org.compiere.model.MOrderLine;
import org.compiere.model.MProduct;
import org.compiere.model.MProductPO;
import org.compiere.model.MProduction;
import org.compiere.model.MProject;
import org.compiere.model.MProjectLine;
import org.compiere.util.Env;
import org.compiere.util.Msg;
/**
* Generate Purchase Order from Project.
* Generate Production from Project.
*
* @author Jorg Janke
* @version $Id: ProjectGenPO.java,v 1.2 2006/07/30 00:51:01 jjanke Exp $
* @author Chuck Boecking
*/
public class ProjectGenProduction extends SvrProcess
{
@ -85,16 +84,20 @@ public class ProjectGenProduction extends SvrProcess
else if (m_C_ProjectPhase_ID != 0)
{
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
MProjectLine[] lines = project.getPhaseLines(m_C_ProjectPhase_ID);
for (int i = 0; i < lines.length; i++)
createProduction (project, lines[i]);
for (MProjectLine line : project.getPhaseLines(m_C_ProjectPhase_ID)) {
if (line.isActive()) {
createProduction (project, line);
}
}
}
else
{
MProject project = new MProject (getCtx(), m_C_Project_ID, get_TrxName());
MProjectLine[] lines = project.getLines();
for (int i = 0; i < lines.length; i++)
createProduction (project, lines[i]);
for (MProjectLine line : project.getLines()) {
if (line.isActive()) {
createProduction (project, line);
}
}
}
return "";
} // doIt
@ -156,10 +159,10 @@ public class ProjectGenProduction extends SvrProcess
//projectLine.setM_Production_ID(production.getM_Production_ID());
//projectLine.saveEx();
addLog (production.getM_Production_ID(),
addBufferLog (production.getM_Production_ID(),
production.getMovementDate(),
new BigDecimal(0),
"Production:"+production.getDocumentNo(),
Msg.getElement(Env.getAD_Language(Env.getCtx()), "M_Production_ID", false)+":"+production.getDocumentNo(),
production.get_Table_ID(),
production.getM_Production_ID());
} // createProductionfromProjectLine

View File

@ -26,7 +26,7 @@ public class MProduction extends X_M_Production implements DocAction {
/**
*
*/
private static final long serialVersionUID = 2222265936552140706L;
private static final long serialVersionUID = 8047044372956625013L;
/**
*

View File

@ -36,7 +36,7 @@ public class MProject extends X_C_Project
/**
*
*/
private static final long serialVersionUID = -6103964836289951325L;
private static final long serialVersionUID = 8631795136761641303L;
/**
* Create new Project by copying