IDEMPIERE-189 Average Costing: moving average costing doesn't work if AD_Client.IsCostImmediate is false

This commit is contained in:
Heng Sin Low 2012-03-20 00:11:47 +08:00
parent 4d8457536f
commit 8e216841b6
5 changed files with 124 additions and 26 deletions

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,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

@ -111,9 +111,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;
@ -180,9 +178,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;
@ -250,9 +246,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;
@ -318,9 +312,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;
@ -390,9 +382,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;
@ -458,9 +448,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = cd.save(); boolean ok = cd.save();
if (ok && !cd.isProcessed()) if (ok && !cd.isProcessed())
{ {
MClient client = MClient.get(as.getCtx(), as.getAD_Client_ID()); ok = cd.process();
if (client.isCostImmediate())
cd.process();
} }
s_log.config("(" + ok + ") " + cd); s_log.config("(" + ok + ") " + cd);
return ok; return ok;

View File

@ -442,9 +442,7 @@ public class MMatchInv extends X_M_MatchInv
cd.setQty(cd.getQty().subtract(qty)); cd.setQty(cd.getQty().subtract(qty));
if (!cd.isProcessed()) if (!cd.isProcessed())
{ {
MClient client = MClient.get(getCtx(), getAD_Client_ID()); cd.process();
if (client.isCostImmediate())
cd.process();
} }
if (cd.getQty().compareTo(Env.ZERO) == 0) 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 // 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(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
oLine.getC_OrderLine_ID(), 0, // no cost element oLine.getC_OrderLine_ID(), 0, // no cost element
tAmt, tQty, // Delivered tAmt, tQty, // Delivered
oLine.getDescription(), get_TrxName()); oLine.getDescription(), get_TrxName()))
{
return "SaveError";
}
// end MZ // end MZ
} }
} }
@ -987,9 +990,7 @@ public class MMatchPO extends X_M_MatchPO
cd.setQty(cd.getQty().subtract(getQty())); cd.setQty(cd.getQty().subtract(getQty()));
if (!cd.isProcessed()) if (!cd.isProcessed())
{ {
MClient client = MClient.get(getCtx(), getAD_Client_ID()); cd.process();
if (client.isCostImmediate())
cd.process();
} }
} }
//after process clean-up //after process clean-up