Merged in hengsin/idempiere-hengsin (pull request #3)

This commit is contained in:
Carlos Ruiz 2012-03-21 23:51:28 -05:00
commit d0312be908
22 changed files with 3545 additions and 38 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,55 @@
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12326
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=50158
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=50159
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=50160
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=50184
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=50185
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=50186
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=54238
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54680
;
-- Mar 19, 2012 8:36:52 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Column SET IsActive='N',Updated=TO_DATE('2012-03-19 20:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14403
;
UPDATE AD_System
SET LastMigrationScriptApplied='825_IDEMPIERE-189.sql'
WHERE LastMigrationScriptApplied<'825_IDEMPIERE-189.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,12 @@
-- Mar 19, 2012 8:33:59 PM MYT
-- IDEMPIERE-118 Average Costing: Negative Inventory
UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_DATE('2012-03-19 20:33:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13455
;
UPDATE AD_System
SET LastMigrationScriptApplied='826_IDEMPIERE-118.sql'
WHERE LastMigrationScriptApplied<'826_IDEMPIERE-118.sql'
OR LastMigrationScriptApplied IS NULL
;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=12326
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=190,IsDisplayed='Y' WHERE AD_Field_ID=50158
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=200,IsDisplayed='Y' WHERE AD_Field_ID=50159
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=210,IsDisplayed='Y' WHERE AD_Field_ID=50160
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=220,IsDisplayed='Y' WHERE AD_Field_ID=50184
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=230,IsDisplayed='Y' WHERE AD_Field_ID=50185
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=240,IsDisplayed='Y' WHERE AD_Field_ID=50186
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=250,IsDisplayed='Y' WHERE AD_Field_ID=54238
;
-- Mar 19, 2012 8:36:26 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Field SET SeqNo=260,IsDisplayed='Y' WHERE AD_Field_ID=54680
;
-- Mar 19, 2012 8:36:52 PM MYT
-- IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false
UPDATE AD_Column SET IsActive='N',Updated=TO_TIMESTAMP('2012-03-19 20:36:52','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=14403
;
UPDATE AD_System
SET LastMigrationScriptApplied='825_IDEMPIERE-189.sql'
WHERE LastMigrationScriptApplied<'825_IDEMPIERE-189.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,10 @@
-- Mar 19, 2012 8:33:59 PM MYT
-- IDEMPIERE-118 Average Costing: Negative Inventory
UPDATE AD_Column SET ReadOnlyLogic=NULL,Updated=TO_DATE('2012-03-19 20:33:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=13455
;
UPDATE AD_System
SET LastMigrationScriptApplied='826_IDEMPIERE-118.sql'
WHERE LastMigrationScriptApplied<'826_IDEMPIERE-118.sql'
OR LastMigrationScriptApplied IS NULL
;

View File

@ -0,0 +1,36 @@
/******************************************************************************
* Product: iDempiere ERP & CRM Smart Business Solution *
* Copyright (C) 2012 Heng Sin Low *
* Copyright (C) 2012 www.iDempiere.org *
* 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.adempiere.exceptions;
/**
*
* @author hengsin
*
*/
public class AverageCostingNegativeQtyException extends AdempiereException {
/**
* generated serial version id
*/
private static final long serialVersionUID = 4165497320719149773L;
public AverageCostingNegativeQtyException() {
super();
}
public AverageCostingNegativeQtyException(String message) {
super(message);
}
}

View File

@ -0,0 +1,296 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 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 *
*****************************************************************************/
package org.adempiere.model;
import java.math.BigDecimal;
import java.sql.Timestamp;
import org.compiere.model.*;
import org.compiere.util.KeyNamePair;
/** Generated Interface for M_CostHistory
* @author Adempiere (generated)
* @version Release 3.6.0LTS
*/
public interface I_M_CostHistory
{
/** TableName=M_CostHistory */
public static final String Table_Name = "M_CostHistory";
/** AD_Table_ID=200001 */
public static final int Table_ID = 200001;
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
/** AccessLevel = 3 - Client - Org
*/
BigDecimal accessLevel = BigDecimal.valueOf(3);
/** Load Meta Data */
/** Column name AD_Client_ID */
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
/** Get Client.
* Client/Tenant for this installation.
*/
public int getAD_Client_ID();
/** Column name AD_Org_ID */
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
/** Set Organization.
* Organizational entity within client
*/
public void setAD_Org_ID (int AD_Org_ID);
/** Get Organization.
* Organizational entity within client
*/
public int getAD_Org_ID();
/** Column name Created */
public static final String COLUMNNAME_Created = "Created";
/** Get Created.
* Date this record was created
*/
public Timestamp getCreated();
/** Column name CreatedBy */
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
/** Get Created By.
* User who created this records
*/
public int getCreatedBy();
/** Column name IsActive */
public static final String COLUMNNAME_IsActive = "IsActive";
/** Set Active.
* The record is active in the system
*/
public void setIsActive (boolean IsActive);
/** Get Active.
* The record is active in the system
*/
public boolean isActive();
/** Column name M_AttributeSetInstance_ID */
public static final String COLUMNNAME_M_AttributeSetInstance_ID = "M_AttributeSetInstance_ID";
/** Set Attribute Set Instance.
* Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID);
/** Get Attribute Set Instance.
* Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID();
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException;
/** Column name M_CostDetail_ID */
public static final String COLUMNNAME_M_CostDetail_ID = "M_CostDetail_ID";
/** Set Cost Detail.
* Cost Detail Information
*/
public void setM_CostDetail_ID (int M_CostDetail_ID);
/** Get Cost Detail.
* Cost Detail Information
*/
public int getM_CostDetail_ID();
public org.compiere.model.I_M_CostDetail getM_CostDetail() throws RuntimeException;
/** Column name M_CostElement_ID */
public static final String COLUMNNAME_M_CostElement_ID = "M_CostElement_ID";
/** Set Cost Element.
* Product Cost Element
*/
public void setM_CostElement_ID (int M_CostElement_ID);
/** Get Cost Element.
* Product Cost Element
*/
public int getM_CostElement_ID();
public org.compiere.model.I_M_CostElement getM_CostElement() throws RuntimeException;
/** Column name M_CostHistory_ID */
public static final String COLUMNNAME_M_CostHistory_ID = "M_CostHistory_ID";
/** Set Cost History.
* Movement history for M_Cost
*/
public void setM_CostHistory_ID (int M_CostHistory_ID);
/** Get Cost History.
* Movement history for M_Cost
*/
public int getM_CostHistory_ID();
/** Column name M_CostHistory_UU */
public static final String COLUMNNAME_M_CostHistory_UU = "M_CostHistory_UU";
/** Set Cost History UUID */
public void setM_CostHistory_UU (String M_CostHistory_UU);
/** Get Cost History UUID */
public String getM_CostHistory_UU();
/** Column name M_CostType_ID */
public static final String COLUMNNAME_M_CostType_ID = "M_CostType_ID";
/** Set Cost Type.
* Type of Cost (e.g. Current, Plan, Future)
*/
public void setM_CostType_ID (int M_CostType_ID);
/** Get Cost Type.
* Type of Cost (e.g. Current, Plan, Future)
*/
public int getM_CostType_ID();
public org.compiere.model.I_M_CostType getM_CostType() throws RuntimeException;
/** Column name NewCAmt */
public static final String COLUMNNAME_NewCAmt = "NewCAmt";
/** Set New Accumulated Amt.
* Accumulated Amt after processing of M_CostDetail
*/
public void setNewCAmt (BigDecimal NewCAmt);
/** Get New Accumulated Amt.
* Accumulated Amt after processing of M_CostDetail
*/
public BigDecimal getNewCAmt();
/** Column name NewCostPrice */
public static final String COLUMNNAME_NewCostPrice = "NewCostPrice";
/** Set New Cost Price.
* New current cost price after processing of M_CostDetail
*/
public void setNewCostPrice (BigDecimal NewCostPrice);
/** Get New Cost Price.
* New current cost price after processing of M_CostDetail
*/
public BigDecimal getNewCostPrice();
/** Column name NewCQty */
public static final String COLUMNNAME_NewCQty = "NewCQty";
/** Set New Accumulated Qty.
* New Accumulated Qty after processing of M_CostDetail
*/
public void setNewCQty (BigDecimal NewCQty);
/** Get New Accumulated Qty.
* New Accumulated Qty after processing of M_CostDetail
*/
public BigDecimal getNewCQty();
/** Column name NewQty */
public static final String COLUMNNAME_NewQty = "NewQty";
/** Set New Current Quantity.
* New current quantity after processing of M_CostDetail
*/
public void setNewQty (BigDecimal NewQty);
/** Get New Current Quantity.
* New current quantity after processing of M_CostDetail
*/
public BigDecimal getNewQty();
/** Column name OldCAmt */
public static final String COLUMNNAME_OldCAmt = "OldCAmt";
/** Set Old Accumulated Amt.
* Old accumulated amt before the processing of M_CostDetail
*/
public void setOldCAmt (BigDecimal OldCAmt);
/** Get Old Accumulated Amt.
* Old accumulated amt before the processing of M_CostDetail
*/
public BigDecimal getOldCAmt();
/** Column name OldCostPrice */
public static final String COLUMNNAME_OldCostPrice = "OldCostPrice";
/** Set Old Current Cost Price.
* Old current cost price before the processing of M_CostDetail
*/
public void setOldCostPrice (BigDecimal OldCostPrice);
/** Get Old Current Cost Price.
* Old current cost price before the processing of M_CostDetail
*/
public BigDecimal getOldCostPrice();
/** Column name OldCQty */
public static final String COLUMNNAME_OldCQty = "OldCQty";
/** Set Old Accumulated Qty.
* Old accumulated qty before the processing of M_CostDetail
*/
public void setOldCQty (BigDecimal OldCQty);
/** Get Old Accumulated Qty.
* Old accumulated qty before the processing of M_CostDetail
*/
public BigDecimal getOldCQty();
/** Column name OldQty */
public static final String COLUMNNAME_OldQty = "OldQty";
/** Set Old Current Quantity.
* Old current quantity before the processing of M_CostDetail
*/
public void setOldQty (BigDecimal OldQty);
/** Get Old Current Quantity.
* Old current quantity before the processing of M_CostDetail
*/
public BigDecimal getOldQty();
/** Column name Updated */
public static final String COLUMNNAME_Updated = "Updated";
/** Get Updated.
* Date this record was updated
*/
public Timestamp getUpdated();
/** Column name UpdatedBy */
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
/** Get Updated By.
* User who updated this records
*/
public int getUpdatedBy();
}

View File

@ -0,0 +1,392 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2007 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 *
*****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.adempiere.model;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.model.*;
import org.compiere.util.Env;
/** Generated Model for M_CostHistory
* @author Adempiere (generated)
* @version Release 3.6.0LTS - $Id$ */
public class X_M_CostHistory extends PO implements I_M_CostHistory, I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20120308L;
/** Standard Constructor */
public X_M_CostHistory (Properties ctx, int M_CostHistory_ID, String trxName)
{
super (ctx, M_CostHistory_ID, trxName);
/** if (M_CostHistory_ID == 0)
{
setM_AttributeSetInstance_ID (0);
setM_CostDetail_ID (0);
setM_CostElement_ID (0);
setM_CostHistory_ID (0);
setM_CostHistory_UU (null);
setM_CostType_ID (0);
setNewCostPrice (Env.ZERO);
setNewQty (Env.ZERO);
setOldCostPrice (Env.ZERO);
setOldQty (Env.ZERO);
} */
}
/** Load Constructor */
public X_M_CostHistory (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 3 - Client - Org
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_M_CostHistory[")
.append(get_ID()).append("]");
return sb.toString();
}
public I_M_AttributeSetInstance getM_AttributeSetInstance() throws RuntimeException
{
return (I_M_AttributeSetInstance)MTable.get(getCtx(), I_M_AttributeSetInstance.Table_Name)
.getPO(getM_AttributeSetInstance_ID(), get_TrxName()); }
/** Set Attribute Set Instance.
@param M_AttributeSetInstance_ID
Product Attribute Set Instance
*/
public void setM_AttributeSetInstance_ID (int M_AttributeSetInstance_ID)
{
if (M_AttributeSetInstance_ID < 0)
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_AttributeSetInstance_ID, Integer.valueOf(M_AttributeSetInstance_ID));
}
/** Get Attribute Set Instance.
@return Product Attribute Set Instance
*/
public int getM_AttributeSetInstance_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSetInstance_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_CostDetail getM_CostDetail() throws RuntimeException
{
return (org.compiere.model.I_M_CostDetail)MTable.get(getCtx(), org.compiere.model.I_M_CostDetail.Table_Name)
.getPO(getM_CostDetail_ID(), get_TrxName()); }
/** Set Cost Detail.
@param M_CostDetail_ID
Cost Detail Information
*/
public void setM_CostDetail_ID (int M_CostDetail_ID)
{
if (M_CostDetail_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostDetail_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostDetail_ID, Integer.valueOf(M_CostDetail_ID));
}
/** Get Cost Detail.
@return Cost Detail Information
*/
public int getM_CostDetail_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_CostDetail_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_CostElement getM_CostElement() throws RuntimeException
{
return (org.compiere.model.I_M_CostElement)MTable.get(getCtx(), org.compiere.model.I_M_CostElement.Table_Name)
.getPO(getM_CostElement_ID(), get_TrxName()); }
/** Set Cost Element.
@param M_CostElement_ID
Product Cost Element
*/
public void setM_CostElement_ID (int M_CostElement_ID)
{
if (M_CostElement_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostElement_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostElement_ID, Integer.valueOf(M_CostElement_ID));
}
/** Get Cost Element.
@return Product Cost Element
*/
public int getM_CostElement_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_CostElement_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Cost History.
@param M_CostHistory_ID
Movement history for M_Cost
*/
public void setM_CostHistory_ID (int M_CostHistory_ID)
{
if (M_CostHistory_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostHistory_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostHistory_ID, Integer.valueOf(M_CostHistory_ID));
}
/** Get Cost History.
@return Movement history for M_Cost
*/
public int getM_CostHistory_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_CostHistory_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Cost History UUID.
@param M_CostHistory_UU Cost History UUID */
public void setM_CostHistory_UU (String M_CostHistory_UU)
{
set_ValueNoCheck (COLUMNNAME_M_CostHistory_UU, M_CostHistory_UU);
}
/** Get Cost History UUID.
@return Cost History UUID */
public String getM_CostHistory_UU ()
{
return (String)get_Value(COLUMNNAME_M_CostHistory_UU);
}
public org.compiere.model.I_M_CostType getM_CostType() throws RuntimeException
{
return (org.compiere.model.I_M_CostType)MTable.get(getCtx(), org.compiere.model.I_M_CostType.Table_Name)
.getPO(getM_CostType_ID(), get_TrxName()); }
/** Set Cost Type.
@param M_CostType_ID
Type of Cost (e.g. Current, Plan, Future)
*/
public void setM_CostType_ID (int M_CostType_ID)
{
if (M_CostType_ID < 1)
set_ValueNoCheck (COLUMNNAME_M_CostType_ID, null);
else
set_ValueNoCheck (COLUMNNAME_M_CostType_ID, Integer.valueOf(M_CostType_ID));
}
/** Get Cost Type.
@return Type of Cost (e.g. Current, Plan, Future)
*/
public int getM_CostType_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_CostType_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set New Accumulated Amt.
@param NewCAmt
Accumulated Amt after processing of M_CostDetail
*/
public void setNewCAmt (BigDecimal NewCAmt)
{
set_ValueNoCheck (COLUMNNAME_NewCAmt, NewCAmt);
}
/** Get New Accumulated Amt.
@return Accumulated Amt after processing of M_CostDetail
*/
public BigDecimal getNewCAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_NewCAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set New Cost Price.
@param NewCostPrice
New current cost price after processing of M_CostDetail
*/
public void setNewCostPrice (BigDecimal NewCostPrice)
{
set_ValueNoCheck (COLUMNNAME_NewCostPrice, NewCostPrice);
}
/** Get New Cost Price.
@return New current cost price after processing of M_CostDetail
*/
public BigDecimal getNewCostPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_NewCostPrice);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set New Accumulated Qty.
@param NewCQty
New Accumulated Qty after processing of M_CostDetail
*/
public void setNewCQty (BigDecimal NewCQty)
{
set_ValueNoCheck (COLUMNNAME_NewCQty, NewCQty);
}
/** Get New Accumulated Qty.
@return New Accumulated Qty after processing of M_CostDetail
*/
public BigDecimal getNewCQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_NewCQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set New Current Quantity.
@param NewQty
New current quantity after processing of M_CostDetail
*/
public void setNewQty (BigDecimal NewQty)
{
set_ValueNoCheck (COLUMNNAME_NewQty, NewQty);
}
/** Get New Current Quantity.
@return New current quantity after processing of M_CostDetail
*/
public BigDecimal getNewQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_NewQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Old Accumulated Amt.
@param OldCAmt
Old accumulated amt before the processing of M_CostDetail
*/
public void setOldCAmt (BigDecimal OldCAmt)
{
set_ValueNoCheck (COLUMNNAME_OldCAmt, OldCAmt);
}
/** Get Old Accumulated Amt.
@return Old accumulated amt before the processing of M_CostDetail
*/
public BigDecimal getOldCAmt ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OldCAmt);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Old Current Cost Price.
@param OldCostPrice
Old current cost price before the processing of M_CostDetail
*/
public void setOldCostPrice (BigDecimal OldCostPrice)
{
set_ValueNoCheck (COLUMNNAME_OldCostPrice, OldCostPrice);
}
/** Get Old Current Cost Price.
@return Old current cost price before the processing of M_CostDetail
*/
public BigDecimal getOldCostPrice ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OldCostPrice);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Old Accumulated Qty.
@param OldCQty
Old accumulated qty before the processing of M_CostDetail
*/
public void setOldCQty (BigDecimal OldCQty)
{
set_ValueNoCheck (COLUMNNAME_OldCQty, OldCQty);
}
/** Get Old Accumulated Qty.
@return Old accumulated qty before the processing of M_CostDetail
*/
public BigDecimal getOldCQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OldCQty);
if (bd == null)
return Env.ZERO;
return bd;
}
/** Set Old Current Quantity.
@param OldQty
Old current quantity before the processing of M_CostDetail
*/
public void setOldQty (BigDecimal OldQty)
{
set_ValueNoCheck (COLUMNNAME_OldQty, OldQty);
}
/** Get Old Current Quantity.
@return Old current quantity before the processing of M_CostDetail
*/
public BigDecimal getOldQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_OldQty);
if (bd == null)
return Env.ZERO;
return bd;
}
}

View File

@ -28,6 +28,7 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AverageCostingNegativeQtyException;
import org.compiere.model.MAccount;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MConversionRate;
@ -516,6 +517,12 @@ public abstract class Doc
p_Status = postLogic ();
}
}
catch (AverageCostingNegativeQtyException e)
{
log.log(Level.INFO, e.getLocalizedMessage(), e);
p_Status = STATUS_NotPosted;
p_Error = e.toString();
}
catch (Exception e)
{
log.log(Level.SEVERE, "", e);
@ -525,7 +532,7 @@ public abstract class Doc
String validatorMsg = null;
// Call validator on before post
if (!p_Status.equals(STATUS_Error)) {
if (p_Status.equals(STATUS_Posted)) {
validatorMsg = ModelValidationEngine.get().fireDocValidate(getPO(), ModelValidator.TIMING_BEFORE_POST);
if (validatorMsg != null) {
p_Status = STATUS_Error;
@ -536,7 +543,7 @@ public abstract class Doc
// commitFact
p_Status = postCommit (p_Status);
if (!p_Status.equals(STATUS_Error)) {
if (p_Status.equals(STATUS_Posted)) {
validatorMsg = ModelValidationEngine.get().fireDocValidate(getPO(), ModelValidator.TIMING_AFTER_POST);
if (validatorMsg != null) {
p_Status = STATUS_Error;

View File

@ -19,6 +19,7 @@ package org.compiere.acct;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Savepoint;
import java.util.ArrayList;
import java.util.List;
@ -283,6 +284,7 @@ public class DocManager {
trxName = localTrxName;
}
Trx trx = Trx.get(trxName, true);
String error = null;
try
{
@ -292,10 +294,20 @@ public class DocManager {
Doc doc = Doc.get (as, AD_Table_ID, rs, trxName);
if (doc != null)
{
Savepoint savepoint = trx.setSavepoint(null);
error = doc.post (force, repost); // repost
status = doc.getPostStatus();
if (error != null && error.trim().length() > 0)
{
trx.rollback(savepoint);
break;
}
else
{
try {
trx.releaseSavepoint(savepoint);
} catch (Exception e) {}
}
}
else
{
@ -311,7 +323,6 @@ public class DocManager {
ValueNamePair dbError = CLogger.retrieveError();
// log.log(Level.SEVERE, "(doc not saved) ... rolling back");
if (localTrxName != null) {
Trx trx = Trx.get(localTrxName, false);
if (trx != null)
trx.rollback();
}
@ -321,7 +332,6 @@ public class DocManager {
error = "SaveError";
}
if (localTrxName != null) {
Trx trx = Trx.get(localTrxName, false);
if (trx != null)
trx.commit();
}
@ -329,7 +339,6 @@ public class DocManager {
catch (Exception e)
{
if (localTrxName != null) {
Trx trx = Trx.get(localTrxName, false);
if (trx != null)
trx.rollback();
}
@ -342,7 +351,6 @@ public class DocManager {
{
if (localTrxName != null)
{
Trx trx = Trx.get(localTrxName, false);
if (trx != null)
trx.close();
}

View File

@ -27,6 +27,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.exceptions.AverageCostingNegativeQtyException;
import org.adempiere.exceptions.DBException;
import org.compiere.Adempiere;
import org.compiere.util.CLogger;
@ -1440,6 +1441,15 @@ public class MCost extends X_M_Cost
*/
public void add (BigDecimal amt, BigDecimal qty)
{
MCostElement costElement = (MCostElement) getM_CostElement();
if (costElement.isAveragePO() || costElement.isAverageInvoice())
{
if (getCurrentQty().add(qty).signum() < 0)
{
throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty
+ ", CostElement="+costElement.getName()+", Schema="+getC_AcctSchema().getName());
}
}
setCumulatedAmt(getCumulatedAmt().add(amt));
setCumulatedQty(getCumulatedQty().add(qty));
setCurrentQty(getCurrentQty().add(qty));
@ -1453,6 +1463,18 @@ public class MCost extends X_M_Cost
*/
public void setWeightedAverage (BigDecimal amt, BigDecimal qty)
{
//amount must follow the sign of qty
if (amt.signum() != 0 && amt.signum() != qty.signum())
{
amt = amt.multiply(new BigDecimal(-1.00d));
}
if (getCurrentQty().add(qty).signum() < 0)
{
throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", Trx Qty="+qty
+", CostElement="+getM_CostElement().getName()+", Schema="+getC_AcctSchema().getName());
}
BigDecimal oldSum = getCurrentCostPrice().multiply(getCurrentQty());
BigDecimal newSum = amt; // is total already
BigDecimal sumAmt = oldSum.add(newSum);
@ -1604,6 +1626,17 @@ public class MCost extends X_M_Cost
if (getCumulatedQty().signum() != 0)
setCumulatedQty(Env.ZERO);
}
//-ve current qty will break moving average costing
if ((ce.isAveragePO() || ce.isAverageInvoice()) && is_ValueChanged(COLUMNNAME_CurrentQty))
{
if (getCurrentQty().signum() < 0)
{
throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()
+", CostElement="+getM_CostElement().getName()+", Schema="+getC_AcctSchema().getName());
}
}
return true;
} // beforeSave
@ -1618,6 +1651,20 @@ public class MCost extends X_M_Cost
} // beforeDelete
@Override
public void setCurrentQty(BigDecimal CurrentQty) {
MCostElement ce = (MCostElement)getM_CostElement();
if (ce.isAveragePO() || ce.isAverageInvoice())
{
if (CurrentQty.signum() < 0)
{
throw new AverageCostingNegativeQtyException("Product(ID)="+getM_Product_ID()+", Current Qty="+getCurrentQty()+", New Current Qty="+CurrentQty
+", CostElement="+ce.getName()+", Schema="+getC_AcctSchema().getName());
}
}
super.setCurrentQty(CurrentQty);
}
/**
* Test
* @param args ignored

View File

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import org.adempiere.model.X_M_CostHistory;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
@ -110,9 +111,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -179,9 +178,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -249,9 +246,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -317,9 +312,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -389,9 +382,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -457,9 +448,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save();
if (ok && !cd.isProcessed())
{
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
ok = cd.process();
}
s_log.config("(" + ok + ") " + cd);
return ok;
@ -826,10 +815,25 @@ public class MCostDetail extends X_M_CostDetail
{
MCost cost = MCost.get(product, M_ASI_ID, as,
Org_ID, ce.getM_CostElement_ID(), get_TrxName());
DB.getDatabase().forUpdate(cost, 120);
// if (cost == null)
// cost = new MCost(product, M_ASI_ID,
// as, Org_ID, ce.getM_CostElement_ID());
//save history for m_cost
X_M_CostHistory history = new X_M_CostHistory(getCtx(), 0, get_TrxName());
history.setM_AttributeSetInstance_ID(cost.getM_AttributeSetInstance_ID());
history.setM_CostDetail_ID(this.getM_CostDetail_ID());
history.setM_CostElement_ID(ce.getM_CostElement_ID());
history.setM_CostType_ID(cost.getM_CostType_ID());
history.setClientOrg(cost.getAD_Client_ID(), cost.getAD_Org_ID());
history.setOldQty(cost.getCurrentQty());
history.setOldCostPrice(cost.getCurrentCostPrice());
history.setOldCAmt(cost.getCumulatedAmt());
history.setOldCQty(cost.getCumulatedQty());
// MZ Goodwill
// used deltaQty and deltaAmt if exist
BigDecimal qty = Env.ZERO;
@ -1030,7 +1034,15 @@ public class MCostDetail extends X_M_CostDetail
if (ce.isAverageInvoice())
{
if (addition)
{
cost.setWeightedAverage(amt, qty);
//shouldn't accumulate reversal of customer shipment qty and amt
if (isShipment())
{
cost.setCumulatedQty(history.getOldCQty());
cost.setCumulatedAmt(history.getOldCAmt());
}
}
else
cost.setCurrentQty(cost.getCurrentQty().add(qty));
log.finer("QtyAdjust - AverageInv - " + cost);
@ -1038,7 +1050,15 @@ public class MCostDetail extends X_M_CostDetail
else if (ce.isAveragePO())
{
if (addition)
{
cost.setWeightedAverage(amt, qty);
//shouldn't accumulate reversal of customer shipment qty and amt
if (isShipment())
{
cost.setCumulatedQty(history.getOldCQty());
cost.setCumulatedAmt(history.getOldCAmt());
}
}
else
cost.setCurrentQty(cost.getCurrentQty().add(qty));
log.finer("QtyAdjust - AveragePO - " + cost);
@ -1169,6 +1189,15 @@ public class MCostDetail extends X_M_CostDetail
setCurrentQty(cost.getCurrentQty());
setCumulatedAmt(cost.getCumulatedAmt());
setCumulatedQty(cost.getCumulatedQty());
//update history
history.setNewQty(cost.getCurrentQty());
history.setNewCostPrice(cost.getCurrentCostPrice());
history.setNewCAmt(cost.getCumulatedAmt());
history.setNewCQty(cost.getCumulatedQty());
if (!history.save())
return false;
return cost.save();
} // process

View File

@ -442,9 +442,7 @@ public class MMatchInv extends X_M_MatchInv
cd.setQty(cd.getQty().subtract(qty));
if (!cd.isProcessed())
{
MClient client = MClient.get(getCtx(), getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
cd.process();
}
if (cd.getQty().compareTo(Env.ZERO) == 0)
{

View File

@ -946,11 +946,14 @@ public class MMatchPO extends X_M_MatchPO
}
// Set Total Amount and Total Quantity from Matched PO
MCostDetail.createOrder(as, oLine.getAD_Org_ID(),
if (!MCostDetail.createOrder(as, oLine.getAD_Org_ID(),
getM_Product_ID(), getM_AttributeSetInstance_ID(),
oLine.getC_OrderLine_ID(), 0, // no cost element
tAmt, tQty, // Delivered
oLine.getDescription(), get_TrxName());
oLine.getDescription(), get_TrxName()))
{
return "SaveError";
}
// end MZ
}
}
@ -987,9 +990,7 @@ public class MMatchPO extends X_M_MatchPO
cd.setQty(cd.getQty().subtract(getQty()));
if (!cd.isProcessed())
{
MClient client = MClient.get(getCtx(), getAD_Client_ID());
if (client.isCostImmediate())
cd.process();
cd.process();
}
}
//after process clean-up

View File

@ -411,7 +411,8 @@ ContextMenuListener, IZoomableEditor
@Override
public void dynamicDisplay()
{
if ((lookup != null) && (!lookup.isValidated() || !lookup.isLoaded()))
if ((lookup != null) && (!lookup.isValidated() || !lookup.isLoaded()
|| (isReadWrite() && lookup.getSize() != getComponent().getItemCount())))
this.actionRefresh();
}
}

View File

@ -89,8 +89,6 @@ public class WebUIServlet extends DHtmlLayoutServlet
logger = CLogger.getCLogger(WebUIServlet.class);
// hengsin: temporary solution for problem with zk client
Ini.setProperty(Ini.P_ADEMPIERESYS, false);
logger.log(Level.OFF, "ADempiere web ui service started successfully");
/**
* End ADempiere Start

View File

@ -31,9 +31,9 @@
<classpathentry exported="true" kind="lib" path="lib/zk-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zk.jar" sourcepath="lib/zk-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkex-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkex.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkex.jar" sourcepath="lib/zkex-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkmax-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkmax.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkmax.jar" sourcepath="lib/zkmax-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkplus-sources.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zkplus.jar"/>
<classpathentry exported="true" kind="lib" path="lib/zml-sources.jar"/>