IDEMPIERE 344 - Improve usability for GL Journal / peer review / tests / implement copy on journal doc

This commit is contained in:
Carlos Ruiz 2012-07-25 13:54:19 -05:00
parent 6acd212c76
commit 8f6efc777b
9 changed files with 3806 additions and 3203 deletions

View File

@ -21,7 +21,7 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.server.server_product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.activation@default:default,com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base@default:default,org.adempiere.eclipse.equinox.http.servlet@default:default,org.adempiere.eclipse.equinox.http.servletbridge@default:default,org.adempiere.eclipse.equinox.servletbridge@default:default,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.pipo.legacy@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.zkoss.zk.library@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>

View File

@ -199,7 +199,6 @@ public class CalloutGLJournal extends CalloutEngine
*/
public String amt (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
String colName = mField.getColumnName();
if (value == null || isCalloutActive())
return "";
@ -239,15 +238,26 @@ public class CalloutGLJournal extends CalloutEngine
if (value == null || isCalloutActive())
return "";
if (colName.equals("Account_ID") || colName.equals("C_SubAcct_ID") || colName.equals("M_Product_ID")
|| colName.equals("C_BPartner_ID") || colName.equals("AD_OrgTrx_ID") || colName.equals("C_LocFrom_ID")
|| colName.equals("C_LocTo_ID") || colName.equals("C_SalesRegion_ID") || colName.equals("C_Project_ID")
|| colName.equals("C_Campaign_ID") || colName.equals("C_Activity_ID") || colName.equals("User1_ID")
|| colName.equals("User2_ID") || colName.equals("UserElement1_ID") || colName.equals("UserElement2_ID")
)
if (colName.equals("Account_ID")
|| colName.equals("C_SubAcct_ID")
|| colName.equals("M_Product_ID")
|| colName.equals("C_BPartner_ID")
|| colName.equals("AD_OrgTrx_ID")
|| colName.equals("AD_Org_ID")
|| colName.equals("C_LocFrom_ID")
|| colName.equals("C_LocTo_ID")
|| colName.equals("C_SalesRegion_ID")
|| colName.equals("C_Project_ID")
|| colName.equals("C_Campaign_ID")
|| colName.equals("C_Activity_ID")
|| colName.equals("User1_ID")
|| colName.equals("User2_ID")
|| colName.equals("UserElement1_ID")
|| colName.equals("UserElement2_ID")
)
{
mTab.setValue("C_ValidCombination_ID", null);
mTab.setValue("Alias", null);
mTab.setValue("Alias_ValidCombination_ID", null);
}
return "";
}
@ -260,13 +270,13 @@ public class CalloutGLJournal extends CalloutEngine
Integer Combi_ID = ((Integer)value).intValue();
if (colName.equals("Alias"))
if (colName.equals("Alias_ValidCombination_ID"))
mTab.setValue("C_ValidCombination_ID", Combi_ID);
if (colName.equals("C_ValidCombination_ID"))
mTab.setValue("Alias", Combi_ID);
mTab.setValue("Alias_ValidCombination_ID", Combi_ID);
if (colName.equals("C_ValidCombination_ID") || colName.equals("Alias"))
if (colName.equals("C_ValidCombination_ID") || colName.equals("Alias_ValidCombination_ID"))
{
MAccount combi = new MAccount(ctx, Combi_ID, null);
mTab.setValue("Account_ID", combi.getAccount_ID() != 0 ? combi.getAccount_ID() : null);
@ -274,6 +284,7 @@ public class CalloutGLJournal extends CalloutEngine
mTab.setValue("M_Product_ID", combi.getM_Product_ID() != 0 ? combi.getM_Product_ID() : null);
mTab.setValue("C_BPartner_ID", combi.getC_BPartner_ID() != 0 ? combi.getC_BPartner_ID() : null);
mTab.setValue("AD_OrgTrx_ID", combi.getAD_OrgTrx_ID() != 0 ? combi.getAD_OrgTrx_ID() : null);
mTab.setValue("AD_Org_ID", combi.getAD_Org_ID() != 0 ? combi.getAD_Org_ID() : null);
mTab.setValue("C_LocFrom_ID", combi.getC_LocFrom_ID() != 0 ? combi.getC_LocFrom_ID() : null);
mTab.setValue("C_LocTo_ID", combi.getC_LocTo_ID() != 0 ? combi.getC_LocTo_ID() : null);
mTab.setValue("C_SalesRegion_ID", combi.getC_SalesRegion_ID() != 0 ? combi.getC_SalesRegion_ID() : null);

View File

@ -0,0 +1,70 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2011-2012 iDempiere Open Source ERP 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. *
*****************************************************************************/
package org.compiere.process;
import java.math.BigDecimal;
import java.util.logging.Level;
import org.compiere.model.MJournal;
/**
* Copy GL Journal/Lines
*
* @author Carlos Ruiz
*/
public class CopyFromJournalDoc extends SvrProcess
{
private int m_GL_Journal_ID = 0;
/**
* Prepare - e.g., get Parameters.
*/
protected void prepare()
{
ProcessInfoParameter[] para = getParameter();
for (int i = 0; i < para.length; i++)
{
String name = para[i].getParameterName();
if (para[i].getParameter() == null)
;
else if (name.equals("GL_Journal_ID"))
m_GL_Journal_ID = ((BigDecimal)para[i].getParameter()).intValue();
else
log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name);
}
} // prepare
/**
* Perform process.
* @return Message (clear text)
* @throws Exception if not successful
*/
protected String doIt() throws Exception
{
int To_GL_Journal_ID = getRecord_ID();
log.info("doIt - From GL_Journal_ID=" + m_GL_Journal_ID + " to " + To_GL_Journal_ID);
if (To_GL_Journal_ID == 0)
throw new IllegalArgumentException("Target GL_Journal_ID == 0");
if (m_GL_Journal_ID == 0)
throw new IllegalArgumentException("Source GL_Journal_ID == 0");
MJournal from = new MJournal (getCtx(), m_GL_Journal_ID, get_TrxName());
MJournal to = new MJournal (getCtx(), To_GL_Journal_ID, get_TrxName());
//
int no = to.copyLinesFrom(from, from.getDateAcct(), 'x');
//
return "@Copied@=" + no;
} // doIt
}

View File

@ -603,6 +603,7 @@ public class ImportGLJournal extends SvrProcess
MJournal journal = null;
String JournalDocumentNo = "";
Timestamp DateAcct = null;
boolean wasCreateNewBatch = false;
// Go through Journal Records
sql = new StringBuffer ("SELECT * FROM I_GLJournal "
@ -618,15 +619,25 @@ public class ImportGLJournal extends SvrProcess
while (rs.next())
{
X_I_GLJournal imp = new X_I_GLJournal (getCtx (), rs, get_TrxName());
// New Batch if Batch Document No changes
String impBatchDocumentNo = imp.getBatchDocumentNo();
if (impBatchDocumentNo == null)
impBatchDocumentNo = "";
if (batch == null
|| imp.isCreateNewBatch()
|| journal.getC_AcctSchema_ID() != imp.getC_AcctSchema_ID()
|| !BatchDocumentNo.equals(impBatchDocumentNo))
if (imp.isCreateNewBatch() // line states to create a new batch
|| (journal != null && journal.getC_AcctSchema_ID() != imp.getC_AcctSchema_ID()) // new line changed schema
|| (imp.getBatchDocumentNo() == null && !wasCreateNewBatch) // new line doesn't have batch info
|| !BatchDocumentNo.equals(impBatchDocumentNo)) // batch number changed
{
// reset batch
batch = null;
}
if (imp.isCreateNewBatch())
wasCreateNewBatch = true;
if (imp.isCreateNewBatch()
|| (batch == null && imp.getBatchDocumentNo() != null)
)
{
BatchDocumentNo = impBatchDocumentNo; // cannot compare real DocumentNo
batch = new MJournalBatch (getCtx(), 0, get_TrxName());
@ -675,7 +686,8 @@ public class ImportGLJournal extends SvrProcess
JournalDocumentNo = impJournalDocumentNo; // cannot compare real DocumentNo
DateAcct = impDateAcct;
journal = new MJournal (getCtx(), 0, get_TrxName());
journal.setGL_JournalBatch_ID(batch.getGL_JournalBatch_ID());
if (batch != null)
journal.setGL_JournalBatch_ID(batch.getGL_JournalBatch_ID());
journal.setClientOrg(imp.getAD_Client_ID(), imp.getAD_OrgDoc_ID());
//
String description = imp.getBatchDescription();
@ -754,7 +766,8 @@ public class ImportGLJournal extends SvrProcess
//
if (line.save())
{
imp.setGL_JournalBatch_ID(batch.getGL_JournalBatch_ID());
if (batch != null)
imp.setGL_JournalBatch_ID(batch.getGL_JournalBatch_ID());
imp.setGL_Journal_ID(journal.getGL_Journal_ID());
imp.setGL_JournalLine_ID(line.getGL_JournalLine_ID());
imp.setI_IsImported(true);

View File

@ -31,7 +31,7 @@ public interface I_GL_JournalLine
public static final String Table_Name = "GL_JournalLine";
/** AD_Table_ID=226 */
public static final int Table_ID = MTable.getTable_ID(Table_Name);
public static final int Table_ID = 226;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
@ -54,7 +54,7 @@ public interface I_GL_JournalLine
*/
public int getA_Asset_Group_ID();
public I_A_Asset_Group getA_Asset_Group() throws RuntimeException;
public org.compiere.model.I_A_Asset_Group getA_Asset_Group() throws RuntimeException;
/** Column name A_Asset_ID */
public static final String COLUMNNAME_A_Asset_ID = "A_Asset_ID";
@ -69,7 +69,22 @@ public interface I_GL_JournalLine
*/
public int getA_Asset_ID();
public I_A_Asset getA_Asset() throws RuntimeException;
public org.compiere.model.I_A_Asset getA_Asset() throws RuntimeException;
/** Column name Account_ID */
public static final String COLUMNNAME_Account_ID = "Account_ID";
/** Set Account.
* Account used
*/
public void setAccount_ID (int Account_ID);
/** Get Account.
* Account used
*/
public int getAccount_ID();
public org.compiere.model.I_C_ElementValue getAccount() throws RuntimeException;
/** Column name A_CreateAsset */
public static final String COLUMNNAME_A_CreateAsset = "A_CreateAsset";
@ -101,6 +116,34 @@ public interface I_GL_JournalLine
*/
public int getAD_Org_ID();
/** Column name AD_OrgTrx_ID */
public static final String COLUMNNAME_AD_OrgTrx_ID = "AD_OrgTrx_ID";
/** Set Trx Organization.
* Performing or initiating organization
*/
public void setAD_OrgTrx_ID (int AD_OrgTrx_ID);
/** Get Trx Organization.
* Performing or initiating organization
*/
public int getAD_OrgTrx_ID();
/** Column name Alias_ValidCombination_ID */
public static final String COLUMNNAME_Alias_ValidCombination_ID = "Alias_ValidCombination_ID";
/** Set Alias List.
* Valid Account Alias List
*/
public void setAlias_ValidCombination_ID (int Alias_ValidCombination_ID);
/** Get Alias List.
* Valid Account Alias List
*/
public int getAlias_ValidCombination_ID();
public org.compiere.model.I_C_ValidCombination getAlias_ValidCombination() throws RuntimeException;
/** Column name AmtAcctCr */
public static final String COLUMNNAME_AmtAcctCr = "AmtAcctCr";
@ -162,6 +205,51 @@ public interface I_GL_JournalLine
/** Get Processed */
public boolean isA_Processed();
/** Column name C_Activity_ID */
public static final String COLUMNNAME_C_Activity_ID = "C_Activity_ID";
/** Set Activity.
* Business Activity
*/
public void setC_Activity_ID (int C_Activity_ID);
/** Get Activity.
* Business Activity
*/
public int getC_Activity_ID();
public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException;
/** Column name C_BPartner_ID */
public static final String COLUMNNAME_C_BPartner_ID = "C_BPartner_ID";
/** Set Business Partner .
* Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID);
/** Get Business Partner .
* Identifies a Business Partner
*/
public int getC_BPartner_ID();
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException;
/** Column name C_Campaign_ID */
public static final String COLUMNNAME_C_Campaign_ID = "C_Campaign_ID";
/** Set Campaign.
* Marketing Campaign
*/
public void setC_Campaign_ID (int C_Campaign_ID);
/** Get Campaign.
* Marketing Campaign
*/
public int getC_Campaign_ID();
public org.compiere.model.I_C_Campaign getC_Campaign() throws RuntimeException;
/** Column name C_ConversionType_ID */
public static final String COLUMNNAME_C_ConversionType_ID = "C_ConversionType_ID";
@ -175,7 +263,7 @@ public interface I_GL_JournalLine
*/
public int getC_ConversionType_ID();
public I_C_ConversionType getC_ConversionType() throws RuntimeException;
public org.compiere.model.I_C_ConversionType getC_ConversionType() throws RuntimeException;
/** Column name C_Currency_ID */
public static final String COLUMNNAME_C_Currency_ID = "C_Currency_ID";
@ -190,7 +278,52 @@ public interface I_GL_JournalLine
*/
public int getC_Currency_ID();
public I_C_Currency getC_Currency() throws RuntimeException;
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException;
/** Column name C_LocFrom_ID */
public static final String COLUMNNAME_C_LocFrom_ID = "C_LocFrom_ID";
/** Set Location From.
* Location that inventory was moved from
*/
public void setC_LocFrom_ID (int C_LocFrom_ID);
/** Get Location From.
* Location that inventory was moved from
*/
public int getC_LocFrom_ID();
public org.compiere.model.I_C_Location getC_LocFrom() throws RuntimeException;
/** Column name C_LocTo_ID */
public static final String COLUMNNAME_C_LocTo_ID = "C_LocTo_ID";
/** Set Location To.
* Location that inventory was moved to
*/
public void setC_LocTo_ID (int C_LocTo_ID);
/** Get Location To.
* Location that inventory was moved to
*/
public int getC_LocTo_ID();
public org.compiere.model.I_C_Location getC_LocTo() throws RuntimeException;
/** Column name C_Project_ID */
public static final String COLUMNNAME_C_Project_ID = "C_Project_ID";
/** Set Project.
* Financial Project
*/
public void setC_Project_ID (int C_Project_ID);
/** Get Project.
* Financial Project
*/
public int getC_Project_ID();
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException;
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
@ -208,6 +341,36 @@ public interface I_GL_JournalLine
*/
public int getCreatedBy();
/** Column name C_SalesRegion_ID */
public static final String COLUMNNAME_C_SalesRegion_ID = "C_SalesRegion_ID";
/** Set Sales Region.
* Sales coverage region
*/
public void setC_SalesRegion_ID (int C_SalesRegion_ID);
/** Get Sales Region.
* Sales coverage region
*/
public int getC_SalesRegion_ID();
public org.compiere.model.I_C_SalesRegion getC_SalesRegion() throws RuntimeException;
/** Column name C_SubAcct_ID */
public static final String COLUMNNAME_C_SubAcct_ID = "C_SubAcct_ID";
/** Set Sub Account.
* Sub account for Element Value
*/
public void setC_SubAcct_ID (int C_SubAcct_ID);
/** Get Sub Account.
* Sub account for Element Value
*/
public int getC_SubAcct_ID();
public org.compiere.model.I_C_SubAcct getC_SubAcct() throws RuntimeException;
/** Column name C_UOM_ID */
public static final String COLUMNNAME_C_UOM_ID = "C_UOM_ID";
@ -221,7 +384,7 @@ public interface I_GL_JournalLine
*/
public int getC_UOM_ID();
public I_C_UOM getC_UOM() throws RuntimeException;
public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException;
/** Column name CurrencyRate */
public static final String COLUMNNAME_CurrencyRate = "CurrencyRate";
@ -290,7 +453,7 @@ public interface I_GL_JournalLine
*/
public int getGL_Journal_ID();
public I_GL_Journal getGL_Journal() throws RuntimeException;
public org.compiere.model.I_GL_Journal getGL_Journal() throws RuntimeException;
/** Column name GL_JournalLine_ID */
public static final String COLUMNNAME_GL_JournalLine_ID = "GL_JournalLine_ID";
@ -305,6 +468,15 @@ public interface I_GL_JournalLine
*/
public int getGL_JournalLine_ID();
/** Column name GL_JournalLine_UU */
public static final String COLUMNNAME_GL_JournalLine_UU = "GL_JournalLine_UU";
/** Set GL_JournalLine_UU */
public void setGL_JournalLine_UU (String GL_JournalLine_UU);
/** Get GL_JournalLine_UU */
public String getGL_JournalLine_UU();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
@ -344,6 +516,21 @@ public interface I_GL_JournalLine
*/
public int getLine();
/** Column name M_Product_ID */
public static final String COLUMNNAME_M_Product_ID = "M_Product_ID";
/** Set Product.
* Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID);
/** Get Product.
* Product, Service, Item
*/
public int getM_Product_ID();
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException;
/** Column name Processed */
public static final String COLUMNNAME_Processed = "Processed";
@ -385,4 +572,60 @@ public interface I_GL_JournalLine
* User who updated this records
*/
public int getUpdatedBy();
/** Column name User1_ID */
public static final String COLUMNNAME_User1_ID = "User1_ID";
/** Set User List 1.
* User defined list element #1
*/
public void setUser1_ID (int User1_ID);
/** Get User List 1.
* User defined list element #1
*/
public int getUser1_ID();
public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException;
/** Column name User2_ID */
public static final String COLUMNNAME_User2_ID = "User2_ID";
/** Set User List 2.
* User defined list element #2
*/
public void setUser2_ID (int User2_ID);
/** Get User List 2.
* User defined list element #2
*/
public int getUser2_ID();
public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException;
/** Column name UserElement1_ID */
public static final String COLUMNNAME_UserElement1_ID = "UserElement1_ID";
/** Set User Element 1.
* User defined accounting Element
*/
public void setUserElement1_ID (int UserElement1_ID);
/** Get User Element 1.
* User defined accounting Element
*/
public int getUserElement1_ID();
/** Column name UserElement2_ID */
public static final String COLUMNNAME_UserElement2_ID = "UserElement2_ID";
/** Set User Element 2.
* User defined accounting Element
*/
public void setUserElement2_ID (int UserElement2_ID);
/** Get User Element 2.
* User defined accounting Element
*/
public int getUserElement2_ID();
}

View File

@ -39,7 +39,7 @@ public class MJournalLine extends X_GL_JournalLine
/**
*
*/
private static final long serialVersionUID = -7008806797777773843L;
private static final long serialVersionUID = 7584093911055786835L;
/**
* Standard Constructor
@ -314,21 +314,11 @@ public class MJournalLine extends X_GL_JournalLine
if (amt.scale() > getPrecision())
amt = amt.setScale(getPrecision(), BigDecimal.ROUND_HALF_UP);
setAmtAcctCr(amt);
// Set Line Org to Acct Org
if (newRecord
|| is_ValueChanged("C_ValidCombination_ID")
|| is_ValueChanged("AD_Org_ID"))
{
int AD_Org_ID = getAccount_Combi().getAD_Org_ID();
if(AD_Org_ID > 0)
{
setAD_Org_ID(AD_Org_ID);
}
else
{
setAD_Org_ID(getParent().getAD_Org_ID());
}
}
// Set Line Org to Doc Org if still not set
if(getAD_Org_ID() <= 0)
{
setAD_Org_ID(getParent().getAD_Org_ID());
}
return true;
} // beforeSave
@ -391,17 +381,28 @@ public class MJournalLine extends X_GL_JournalLine
return no == 1;
} // updateJournalTotal
/** Update combination and optionnaly **/
void getOrCreateCombination()
/** Update combination and optionally **/
private void getOrCreateCombination()
{
if (getC_ValidCombination_ID() == 0
|| (is_ValueChanged("Account_ID") || is_ValueChanged("C_SubAcct_ID") || is_ValueChanged("M_Product_ID")
|| is_ValueChanged("C_BPartner_ID") || is_ValueChanged("AD_OrgTrx_ID") || is_ValueChanged("C_LocFrom_ID")
|| is_ValueChanged("C_LocTo_ID") || is_ValueChanged("C_SalesRegion_ID") || is_ValueChanged("C_Project_ID")
|| is_ValueChanged("C_Campaign_ID") || is_ValueChanged("C_Activity_ID") || is_ValueChanged("User1_ID")
|| is_ValueChanged("User2_ID") || is_ValueChanged("UserElement1_ID") || is_ValueChanged("UserElement2_ID"))
)
if (getAccount_ID() <= 0) // mandatory to get or create a combination
return;
if (getC_ValidCombination_ID() == 0
|| (!is_new() && (is_ValueChanged("Account_ID")
|| is_ValueChanged("C_SubAcct_ID")
|| is_ValueChanged("M_Product_ID")
|| is_ValueChanged("C_BPartner_ID")
|| is_ValueChanged("AD_OrgTrx_ID")
|| is_ValueChanged("AD_Org_ID")
|| is_ValueChanged("C_LocFrom_ID")
|| is_ValueChanged("C_LocTo_ID")
|| is_ValueChanged("C_SalesRegion_ID")
|| is_ValueChanged("C_Project_ID")
|| is_ValueChanged("C_Campaign_ID")
|| is_ValueChanged("C_Activity_ID")
|| is_ValueChanged("User1_ID")
|| is_ValueChanged("User2_ID")
|| is_ValueChanged("UserElement1_ID")
|| is_ValueChanged("UserElement2_ID"))))
{
MJournal gl = new MJournal(getCtx(), getGL_Journal_ID(), get_TrxName());
@ -415,19 +416,17 @@ public class MJournalLine extends X_GL_JournalLine
acct.saveEx(get_TrxName()); // get ID from transaction
setC_ValidCombination_ID(acct.get_ID());
if (acct.getAlias() != null && acct.getAlias().length() > 0)
setAlias(acct.get_ID());
setAlias_ValidCombination_ID(acct.get_ID());
else
setAlias_ValidCombination_ID(0);
}
}
} // getOrCreateCombination
/** Fill Accounting Dimensions from line combination **/
void fillDimensionsFromCombination()
private void fillDimensionsFromCombination()
{
if (getC_ValidCombination_ID() > 0
&& getAccount_ID() == 0 && getC_SubAcct_ID() == 0 && getM_Product_ID() == 0
&& getC_BPartner_ID() == 0 && getAD_OrgTrx_ID() == 0 && getC_LocFrom_ID() == 0 && getC_LocTo_ID() == 0
&& getC_SalesRegion_ID() == 0 && getC_Project_ID() == 0 && getC_Campaign_ID() == 0 && getC_Activity_ID() == 0
&& getUser1_ID() == 0 && getUser2_ID() == 0 && getUserElement1_ID() == 0 && getUserElement2_ID() == 0)
if (getC_ValidCombination_ID() > 0)
{
MAccount combi = new MAccount(getCtx(), getC_ValidCombination_ID(), get_TrxName());
setAccount_ID(combi.getAccount_ID() > 0 ? combi.getAccount_ID() : 0);
@ -435,6 +434,7 @@ public class MJournalLine extends X_GL_JournalLine
setM_Product_ID(combi.getM_Product_ID() > 0 ? combi.getM_Product_ID() : 0);
setC_BPartner_ID(combi.getC_BPartner_ID() > 0 ? combi.getC_BPartner_ID() : 0);
setAD_OrgTrx_ID(combi.getAD_OrgTrx_ID() > 0 ? combi.getAD_OrgTrx_ID() : 0);
setAD_Org_ID(combi.getAD_Org_ID() > 0 ? combi.getAD_Org_ID() : 0);
setC_LocFrom_ID(combi.getC_LocFrom_ID() > 0 ? combi.getC_LocFrom_ID() : 0);
setC_LocTo_ID(combi.getC_LocTo_ID() > 0 ? combi.getC_LocTo_ID() : 0);
setC_SalesRegion_ID(combi.getC_SalesRegion_ID() > 0 ? combi.getC_SalesRegion_ID() : 0);

View File

@ -33,7 +33,7 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
/**
*
*/
private static final long serialVersionUID = 20100614L;
private static final long serialVersionUID = 20120725L;
/** Standard Constructor */
public X_GL_JournalLine (Properties ctx, int GL_JournalLine_ID, String trxName)
@ -50,7 +50,6 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
// @C_Currency_ID@
setCurrencyRate (Env.ZERO);
// @CurrencyRate@;1
setC_ValidCombination_ID (0);
setDateAcct (new Timestamp( System.currentTimeMillis() ));
// @DateAcct@
setGL_Journal_ID (0);
@ -90,9 +89,9 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return sb.toString();
}
public I_A_Asset_Group getA_Asset_Group() throws RuntimeException
public org.compiere.model.I_A_Asset_Group getA_Asset_Group() throws RuntimeException
{
return (I_A_Asset_Group)MTable.get(getCtx(), I_A_Asset_Group.Table_Name)
return (org.compiere.model.I_A_Asset_Group)MTable.get(getCtx(), org.compiere.model.I_A_Asset_Group.Table_Name)
.getPO(getA_Asset_Group_ID(), get_TrxName()); }
/** Set Asset Group.
@ -118,9 +117,9 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return ii.intValue();
}
public I_A_Asset getA_Asset() throws RuntimeException
public org.compiere.model.I_A_Asset getA_Asset() throws RuntimeException
{
return (I_A_Asset)MTable.get(getCtx(), I_A_Asset.Table_Name)
return (org.compiere.model.I_A_Asset)MTable.get(getCtx(), org.compiere.model.I_A_Asset.Table_Name)
.getPO(getA_Asset_ID(), get_TrxName()); }
/** Set Asset.
@ -146,6 +145,34 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getAccount() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getAccount_ID(), get_TrxName()); }
/** Set Account.
@param Account_ID
Account used
*/
public void setAccount_ID (int Account_ID)
{
if (Account_ID < 1)
set_Value (COLUMNNAME_Account_ID, null);
else
set_Value (COLUMNNAME_Account_ID, Integer.valueOf(Account_ID));
}
/** Get Account.
@return Account used
*/
public int getAccount_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Account_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Asset Related?.
@param A_CreateAsset Asset Related? */
public void setA_CreateAsset (boolean A_CreateAsset)
@ -167,6 +194,57 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return false;
}
/** Set Trx Organization.
@param AD_OrgTrx_ID
Performing or initiating organization
*/
public void setAD_OrgTrx_ID (int AD_OrgTrx_ID)
{
if (AD_OrgTrx_ID < 1)
set_Value (COLUMNNAME_AD_OrgTrx_ID, null);
else
set_Value (COLUMNNAME_AD_OrgTrx_ID, Integer.valueOf(AD_OrgTrx_ID));
}
/** Get Trx Organization.
@return Performing or initiating organization
*/
public int getAD_OrgTrx_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_OrgTrx_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ValidCombination getAlias_ValidCombination() throws RuntimeException
{
return (org.compiere.model.I_C_ValidCombination)MTable.get(getCtx(), org.compiere.model.I_C_ValidCombination.Table_Name)
.getPO(getAlias_ValidCombination_ID(), get_TrxName()); }
/** Set Alias List.
@param Alias_ValidCombination_ID
Valid Account Alias List
*/
public void setAlias_ValidCombination_ID (int Alias_ValidCombination_ID)
{
if (Alias_ValidCombination_ID < 1)
set_Value (COLUMNNAME_Alias_ValidCombination_ID, null);
else
set_Value (COLUMNNAME_Alias_ValidCombination_ID, Integer.valueOf(Alias_ValidCombination_ID));
}
/** Get Alias List.
@return Valid Account Alias List
*/
public int getAlias_ValidCombination_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_Alias_ValidCombination_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Accounted Credit.
@param AmtAcctCr
Accounted Credit Amount
@ -268,9 +346,93 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return false;
}
public I_C_ConversionType getC_ConversionType() throws RuntimeException
public org.compiere.model.I_C_Activity getC_Activity() throws RuntimeException
{
return (I_C_ConversionType)MTable.get(getCtx(), I_C_ConversionType.Table_Name)
return (org.compiere.model.I_C_Activity)MTable.get(getCtx(), org.compiere.model.I_C_Activity.Table_Name)
.getPO(getC_Activity_ID(), get_TrxName()); }
/** Set Activity.
@param C_Activity_ID
Business Activity
*/
public void setC_Activity_ID (int C_Activity_ID)
{
if (C_Activity_ID < 1)
set_Value (COLUMNNAME_C_Activity_ID, null);
else
set_Value (COLUMNNAME_C_Activity_ID, Integer.valueOf(C_Activity_ID));
}
/** Get Activity.
@return Business Activity
*/
public int getC_Activity_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Activity_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_BPartner getC_BPartner() throws RuntimeException
{
return (org.compiere.model.I_C_BPartner)MTable.get(getCtx(), org.compiere.model.I_C_BPartner.Table_Name)
.getPO(getC_BPartner_ID(), get_TrxName()); }
/** Set Business Partner .
@param C_BPartner_ID
Identifies a Business Partner
*/
public void setC_BPartner_ID (int C_BPartner_ID)
{
if (C_BPartner_ID < 1)
set_Value (COLUMNNAME_C_BPartner_ID, null);
else
set_Value (COLUMNNAME_C_BPartner_ID, Integer.valueOf(C_BPartner_ID));
}
/** Get Business Partner .
@return Identifies a Business Partner
*/
public int getC_BPartner_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_BPartner_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Campaign getC_Campaign() throws RuntimeException
{
return (org.compiere.model.I_C_Campaign)MTable.get(getCtx(), org.compiere.model.I_C_Campaign.Table_Name)
.getPO(getC_Campaign_ID(), get_TrxName()); }
/** Set Campaign.
@param C_Campaign_ID
Marketing Campaign
*/
public void setC_Campaign_ID (int C_Campaign_ID)
{
if (C_Campaign_ID < 1)
set_Value (COLUMNNAME_C_Campaign_ID, null);
else
set_Value (COLUMNNAME_C_Campaign_ID, Integer.valueOf(C_Campaign_ID));
}
/** Get Campaign.
@return Marketing Campaign
*/
public int getC_Campaign_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Campaign_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ConversionType getC_ConversionType() throws RuntimeException
{
return (org.compiere.model.I_C_ConversionType)MTable.get(getCtx(), org.compiere.model.I_C_ConversionType.Table_Name)
.getPO(getC_ConversionType_ID(), get_TrxName()); }
/** Set Currency Type.
@ -296,9 +458,9 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return ii.intValue();
}
public I_C_Currency getC_Currency() throws RuntimeException
public org.compiere.model.I_C_Currency getC_Currency() throws RuntimeException
{
return (I_C_Currency)MTable.get(getCtx(), I_C_Currency.Table_Name)
return (org.compiere.model.I_C_Currency)MTable.get(getCtx(), org.compiere.model.I_C_Currency.Table_Name)
.getPO(getC_Currency_ID(), get_TrxName()); }
/** Set Currency.
@ -324,9 +486,149 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return ii.intValue();
}
public I_C_UOM getC_UOM() throws RuntimeException
public org.compiere.model.I_C_Location getC_LocFrom() throws RuntimeException
{
return (I_C_UOM)MTable.get(getCtx(), I_C_UOM.Table_Name)
return (org.compiere.model.I_C_Location)MTable.get(getCtx(), org.compiere.model.I_C_Location.Table_Name)
.getPO(getC_LocFrom_ID(), get_TrxName()); }
/** Set Location From.
@param C_LocFrom_ID
Location that inventory was moved from
*/
public void setC_LocFrom_ID (int C_LocFrom_ID)
{
if (C_LocFrom_ID < 1)
set_Value (COLUMNNAME_C_LocFrom_ID, null);
else
set_Value (COLUMNNAME_C_LocFrom_ID, Integer.valueOf(C_LocFrom_ID));
}
/** Get Location From.
@return Location that inventory was moved from
*/
public int getC_LocFrom_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_LocFrom_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Location getC_LocTo() throws RuntimeException
{
return (org.compiere.model.I_C_Location)MTable.get(getCtx(), org.compiere.model.I_C_Location.Table_Name)
.getPO(getC_LocTo_ID(), get_TrxName()); }
/** Set Location To.
@param C_LocTo_ID
Location that inventory was moved to
*/
public void setC_LocTo_ID (int C_LocTo_ID)
{
if (C_LocTo_ID < 1)
set_Value (COLUMNNAME_C_LocTo_ID, null);
else
set_Value (COLUMNNAME_C_LocTo_ID, Integer.valueOf(C_LocTo_ID));
}
/** Get Location To.
@return Location that inventory was moved to
*/
public int getC_LocTo_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_LocTo_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Project getC_Project() throws RuntimeException
{
return (org.compiere.model.I_C_Project)MTable.get(getCtx(), org.compiere.model.I_C_Project.Table_Name)
.getPO(getC_Project_ID(), get_TrxName()); }
/** Set Project.
@param C_Project_ID
Financial Project
*/
public void setC_Project_ID (int C_Project_ID)
{
if (C_Project_ID < 1)
set_Value (COLUMNNAME_C_Project_ID, null);
else
set_Value (COLUMNNAME_C_Project_ID, Integer.valueOf(C_Project_ID));
}
/** Get Project.
@return Financial Project
*/
public int getC_Project_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_Project_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_SalesRegion getC_SalesRegion() throws RuntimeException
{
return (org.compiere.model.I_C_SalesRegion)MTable.get(getCtx(), org.compiere.model.I_C_SalesRegion.Table_Name)
.getPO(getC_SalesRegion_ID(), get_TrxName()); }
/** Set Sales Region.
@param C_SalesRegion_ID
Sales coverage region
*/
public void setC_SalesRegion_ID (int C_SalesRegion_ID)
{
if (C_SalesRegion_ID < 1)
set_Value (COLUMNNAME_C_SalesRegion_ID, null);
else
set_Value (COLUMNNAME_C_SalesRegion_ID, Integer.valueOf(C_SalesRegion_ID));
}
/** Get Sales Region.
@return Sales coverage region
*/
public int getC_SalesRegion_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_SalesRegion_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_SubAcct getC_SubAcct() throws RuntimeException
{
return (org.compiere.model.I_C_SubAcct)MTable.get(getCtx(), org.compiere.model.I_C_SubAcct.Table_Name)
.getPO(getC_SubAcct_ID(), get_TrxName()); }
/** Set Sub Account.
@param C_SubAcct_ID
Sub account for Element Value
*/
public void setC_SubAcct_ID (int C_SubAcct_ID)
{
if (C_SubAcct_ID < 1)
set_Value (COLUMNNAME_C_SubAcct_ID, null);
else
set_Value (COLUMNNAME_C_SubAcct_ID, Integer.valueOf(C_SubAcct_ID));
}
/** Get Sub Account.
@return Sub account for Element Value
*/
public int getC_SubAcct_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_C_SubAcct_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_UOM getC_UOM() throws RuntimeException
{
return (org.compiere.model.I_C_UOM)MTable.get(getCtx(), org.compiere.model.I_C_UOM.Table_Name)
.getPO(getC_UOM_ID(), get_TrxName()); }
/** Set UOM.
@ -434,9 +736,9 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return (String)get_Value(COLUMNNAME_Description);
}
public I_GL_Journal getGL_Journal() throws RuntimeException
public org.compiere.model.I_GL_Journal getGL_Journal() throws RuntimeException
{
return (I_GL_Journal)MTable.get(getCtx(), I_GL_Journal.Table_Name)
return (org.compiere.model.I_GL_Journal)MTable.get(getCtx(), org.compiere.model.I_GL_Journal.Table_Name)
.getPO(getGL_Journal_ID(), get_TrxName()); }
/** Set Journal.
@ -485,6 +787,20 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return ii.intValue();
}
/** Set GL_JournalLine_UU.
@param GL_JournalLine_UU GL_JournalLine_UU */
public void setGL_JournalLine_UU (String GL_JournalLine_UU)
{
set_Value (COLUMNNAME_GL_JournalLine_UU, GL_JournalLine_UU);
}
/** Get GL_JournalLine_UU.
@return GL_JournalLine_UU */
public String getGL_JournalLine_UU ()
{
return (String)get_Value(COLUMNNAME_GL_JournalLine_UU);
}
/** Set Generated.
@param IsGenerated
This Line is generated
@ -537,6 +853,34 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return new KeyNamePair(get_ID(), String.valueOf(getLine()));
}
public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
{
return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_Name)
.getPO(getM_Product_ID(), get_TrxName()); }
/** Set Product.
@param M_Product_ID
Product, Service, Item
*/
public void setM_Product_ID (int M_Product_ID)
{
if (M_Product_ID < 1)
set_Value (COLUMNNAME_M_Product_ID, null);
else
set_Value (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
}
/** Get Product.
@return Product, Service, Item
*/
public int getM_Product_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Processed.
@param Processed
The document has been processed
@ -580,4 +924,106 @@ public class X_GL_JournalLine extends PO implements I_GL_JournalLine, I_Persiste
return Env.ZERO;
return bd;
}
public org.compiere.model.I_C_ElementValue getUser1() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getUser1_ID(), get_TrxName()); }
/** Set User List 1.
@param User1_ID
User defined list element #1
*/
public void setUser1_ID (int User1_ID)
{
if (User1_ID < 1)
set_Value (COLUMNNAME_User1_ID, null);
else
set_Value (COLUMNNAME_User1_ID, Integer.valueOf(User1_ID));
}
/** Get User List 1.
@return User defined list element #1
*/
public int getUser1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_ElementValue getUser2() throws RuntimeException
{
return (org.compiere.model.I_C_ElementValue)MTable.get(getCtx(), org.compiere.model.I_C_ElementValue.Table_Name)
.getPO(getUser2_ID(), get_TrxName()); }
/** Set User List 2.
@param User2_ID
User defined list element #2
*/
public void setUser2_ID (int User2_ID)
{
if (User2_ID < 1)
set_Value (COLUMNNAME_User2_ID, null);
else
set_Value (COLUMNNAME_User2_ID, Integer.valueOf(User2_ID));
}
/** Get User List 2.
@return User defined list element #2
*/
public int getUser2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_User2_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set User Element 1.
@param UserElement1_ID
User defined accounting Element
*/
public void setUserElement1_ID (int UserElement1_ID)
{
if (UserElement1_ID < 1)
set_Value (COLUMNNAME_UserElement1_ID, null);
else
set_Value (COLUMNNAME_UserElement1_ID, Integer.valueOf(UserElement1_ID));
}
/** Get User Element 1.
@return User defined accounting Element
*/
public int getUserElement1_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UserElement1_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set User Element 2.
@param UserElement2_ID
User defined accounting Element
*/
public void setUserElement2_ID (int UserElement2_ID)
{
if (UserElement2_ID < 1)
set_Value (COLUMNNAME_UserElement2_ID, null);
else
set_Value (COLUMNNAME_UserElement2_ID, Integer.valueOf(UserElement2_ID));
}
/** Get User Element 2.
@return User defined accounting Element
*/
public int getUserElement2_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_UserElement2_ID);
if (ii == null)
return 0;
return ii.intValue();
}
}