It is not rolling up correctly the lower level costs
https://sourceforge.net/tracker2/?func=detail&aid=2530003&group_id=176962&atid=879332 Fix Validate CostingLevel
This commit is contained in:
parent
1ec6a67d87
commit
5fdb307116
|
@ -172,14 +172,7 @@ public class MResource extends X_S_Resource
|
|||
*/
|
||||
public double getResouceRate(int C_AcctSchema_ID,int M_CostType_ID, String CostElementType , int AD_Org_ID)
|
||||
{
|
||||
|
||||
MAcctSchema as = MAcctSchema.get(getCtx(), C_AcctSchema_ID);
|
||||
MProduct product = getProduct();
|
||||
if(MAcctSchema.COSTINGLEVEL_Client.equals(product.getCostingLevel(as)))
|
||||
{
|
||||
AD_Org_ID = 0;
|
||||
}
|
||||
|
||||
|
||||
final String sql = "SELECT SUM(c."+MCost.COLUMNNAME_CurrentCostPrice+")"
|
||||
+" FROM M_Cost c, M_CostElement ce, M_Product p"
|
||||
+" WHERE c.AD_Client_ID=? AND c.AD_Org_ID=?"
|
||||
|
|
|
@ -27,7 +27,9 @@ import java.util.Properties;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.AdempiereException;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MProduct;
|
||||
import org.compiere.model.MResource;
|
||||
import org.compiere.model.MUOM;
|
||||
import org.compiere.model.X_AD_WF_Node;
|
||||
|
@ -677,6 +679,14 @@ public class MWFNode extends X_AD_WF_Node
|
|||
MResource resource = (MResource) getS_Resource();
|
||||
//get the rate and convert in second for this cost type element (Resource, Burden)
|
||||
MWorkflow workflow = getWorkflow();
|
||||
// Validate the CostingLevel
|
||||
MAcctSchema as = MAcctSchema.get(getCtx(), C_AcctSchema_ID);
|
||||
MProduct product = resource.getProduct();
|
||||
if(MAcctSchema.COSTINGLEVEL_Client.equals(product.getCostingLevel(as)))
|
||||
{
|
||||
AD_Org_ID = 0;
|
||||
}
|
||||
|
||||
double rate = resource.getResouceRate(C_AcctSchema_ID, M_CostType_ID,CostElementType, AD_Org_ID);
|
||||
BigDecimal cost = Env.ZERO;
|
||||
if (rate == 0)
|
||||
|
|
|
@ -92,7 +92,14 @@ public class RollupBillOfMaterial extends SvrProcess
|
|||
for (int lowLevel = maxLowLevel; lowLevel >= 0; lowLevel--)
|
||||
{
|
||||
for (MProduct product : getProducts(lowLevel))
|
||||
{
|
||||
{
|
||||
// Validate the CostingLevel
|
||||
MAcctSchema as = MAcctSchema.get(getCtx(), p_C_AcctSchema_ID);
|
||||
if(MAcctSchema.COSTINGLEVEL_Client.equals(product.getCostingLevel(as)))
|
||||
{
|
||||
p_AD_Org_ID = 0;
|
||||
}
|
||||
|
||||
for (MCost cost : getCosts(product.get_ID()))
|
||||
{
|
||||
log.info("Calculate Lower Cost for :"+ product.getName());
|
||||
|
|
Loading…
Reference in New Issue