diff --git a/migration/i1.0a-release/oracle/201304232046_IDEMPIERE-570.sql b/migration/i1.0a-release/oracle/201304232046_IDEMPIERE-570.sql
new file mode 100644
index 0000000000..304caeae04
--- /dev/null
+++ b/migration/i1.0a-release/oracle/201304232046_IDEMPIERE-570.sql
@@ -0,0 +1,28 @@
+-- Apr 23, 2013 8:44:22 PM COT
+-- IDEMPIERE-570 Doc_Production - production posting problems
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3609
+;
+
+-- Apr 23, 2013 8:44:35 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6537
+;
+
+-- Apr 23, 2013 8:44:57 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:44:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59961
+;
+
+-- Apr 23, 2013 8:45:05 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_DATE('2013-04-23 20:45:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4752
+;
+
+-- Apr 23, 2013 9:08:12 PM COT
+UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
+;
+
+-- Apr 23, 2013 9:08:21 PM COT
+UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=326
+;
+
+SELECT register_migration_script('201304232046_IDEMPIERE-570.sql') FROM dual
+;
+
diff --git a/migration/i1.0a-release/postgresql/201304232046_IDEMPIERE-570.sql b/migration/i1.0a-release/postgresql/201304232046_IDEMPIERE-570.sql
new file mode 100644
index 0000000000..a60ee6347f
--- /dev/null
+++ b/migration/i1.0a-release/postgresql/201304232046_IDEMPIERE-570.sql
@@ -0,0 +1,28 @@
+-- Apr 23, 2013 8:44:22 PM COT
+-- IDEMPIERE-570 Doc_Production - production posting problems
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:22','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3609
+;
+
+-- Apr 23, 2013 8:44:35 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=6537
+;
+
+-- Apr 23, 2013 8:44:57 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:44:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59961
+;
+
+-- Apr 23, 2013 8:45:05 PM COT
+UPDATE AD_Column SET IsAllowCopy='N',Updated=TO_TIMESTAMP('2013-04-23 20:45:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=4752
+;
+
+-- Apr 23, 2013 9:08:12 PM COT
+UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=325
+;
+
+-- Apr 23, 2013 9:08:21 PM COT
+UPDATE AD_Table SET AccessLevel='1',Updated=TO_DATE('2013-04-23 21:08:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=326
+;
+
+SELECT register_migration_script('201304232046_IDEMPIERE-570.sql') FROM dual
+;
+
diff --git a/org.adempiere.base-feature/model.generator.launch b/org.adempiere.base-feature/model.generator.launch
index 46be99c5d1..d7663b91f6 100644
--- a/org.adempiere.base-feature/model.generator.launch
+++ b/org.adempiere.base-feature/model.generator.launch
@@ -19,7 +19,7 @@
-
+
diff --git a/org.adempiere.base.process/src/org/compiere/process/M_Production_Run.java b/org.adempiere.base.process/src/org/compiere/process/M_Production_Run.java
index fb5974145d..3f91a6b3af 100644
--- a/org.adempiere.base.process/src/org/compiere/process/M_Production_Run.java
+++ b/org.adempiere.base.process/src/org/compiere/process/M_Production_Run.java
@@ -46,6 +46,7 @@ import org.eevolution.model.MPPProductBOMLine;
* @author victor.perez@e-evolution.com
* @contributor: Carlos Ruiz (globalqss) - review backward compatibility - implement mustBeStocked properly
*/
+@Deprecated // replaced by ProductionProcess
public class M_Production_Run extends SvrProcess {
/** The Record */
diff --git a/org.adempiere.base.process/src/org/compiere/process/ProductionProcess.java b/org.adempiere.base.process/src/org/compiere/process/ProductionProcess.java
index db3c15de95..b0b731c04d 100644
--- a/org.adempiere.base.process/src/org/compiere/process/ProductionProcess.java
+++ b/org.adempiere.base.process/src/org/compiere/process/ProductionProcess.java
@@ -3,6 +3,7 @@ package org.compiere.process;
import java.sql.Timestamp;
import java.util.logging.Level;
+import org.compiere.model.MClient;
import org.compiere.model.MProduction;
import org.compiere.model.MProductionLine;
import org.compiere.util.AdempiereSystemError;
@@ -84,7 +85,14 @@ public class ProductionProcess extends SvrProcess {
m_production.setProcessed(true);
m_production.saveEx(get_TrxName());
- StringBuilder msgreturn = new StringBuilder().append(processed).append(" production lines were processed");
+
+ /* Immediate accounting */
+ if (MClient.isClientAccountingImmediate()) {
+ @SuppressWarnings("unused")
+ String ignoreError = DocumentEngine.postImmediate(getCtx(), getAD_Client_ID(), m_production.get_Table_ID(), m_production.get_ID(), true, get_TrxName());
+ }
+
+ StringBuilder msgreturn = new StringBuilder("@Processed@ #").append(processed);
return msgreturn.toString();
}
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc.java b/org.adempiere.base/src/org/compiere/acct/Doc.java
index 4cf92a5fdb..2fd23fb79c 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc.java
@@ -520,12 +520,6 @@ public abstract class Doc
p_Status = postLogic ();
}
}
- catch (AverageCostingNegativeQtyException e)
- {
- if (log.isLoggable(Level.INFO))log.log(Level.INFO, e.getLocalizedMessage(), e);
- p_Status = STATUS_NotPosted;
- p_Error = e.toString();
- }
catch (Exception e)
{
log.log(Level.SEVERE, "", e);
diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java
index 7ca1f8c905..83cbaa052c 100644
--- a/org.adempiere.base/src/org/compiere/acct/Doc_Production.java
+++ b/org.adempiere.base/src/org/compiere/acct/Doc_Production.java
@@ -157,59 +157,45 @@ public class Doc_Production extends Doc
// Calculate Costs
BigDecimal costs = null;
- /* adaxa-pb don't use cost details
// MZ Goodwill
// if Production CostDetail exist then get Cost from Cost Detail
MCostDetail cd = MCostDetail.get (as.getCtx(), "M_ProductionLine_ID=?",
line.get_ID(), line.getM_AttributeSetInstance_ID(), as.getC_AcctSchema_ID(), getTrxName());
- if (cd != null)
+ if (cd != null) {
costs = cd.getAmt();
- else
- */
- {
- int variedHeader = 0;
- BigDecimal variance = null;
+ } else {
costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
- if (line.isProductionBOM() && line.getM_Production_ID() != variedHeader )
+ }
+ if (line.isProductionBOM())
+ {
+ // Get BOM Cost - Sum of individual lines
+ BigDecimal bomCost = Env.ZERO;
+ for (int ii = 0; ii < p_lines.length; ii++)
{
- // Get BOM Cost - Sum of individual lines
- BigDecimal bomCost = Env.ZERO;
- for (int ii = 0; ii < p_lines.length; ii++)
- {
- DocLine line0 = p_lines[ii];
- if (line0.getM_Production_ID() != line.getM_Production_ID())
- continue;
- //pb changed this 20/10/06
- if (!line0.isProductionBOM())
+ DocLine line0 = p_lines[ii];
+ if (line0.getM_Production_ID() != line.getM_Production_ID())
+ continue;
+ //pb changed this 20/10/06
+ if (!line0.isProductionBOM())
bomCost = bomCost.add(line0.getProductCosts(as, line.getAD_Org_ID(), false).setScale(2,BigDecimal.ROUND_HALF_UP));
- }
- variance = (costs.setScale(2,BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
- //TODO use currency precision instead of hardcoded 2
- // get variance account
- int validCombination = MAcctSchemaDefault.get(getCtx(),
- as.get_ID()).getP_RateVariance_Acct();
- MAccount base = MAccount.get(getCtx(), validCombination);
- MAccount account = MAccount.get(getCtx(),as.getAD_Client_ID(),as.getAD_Org_ID(),
- as.get_ID(), base.getAccount_ID(), 0,0,0,0,0,0,0,0,0,0,0,0,0,0);
- //
- // only post variance if it's not zero
- if (variance.signum() != 0)
- {
- //post variance
- fl = fact.createLine(line,
- account,
- as.getC_Currency_ID(), variance.negate());
- if (fl == null)
- {
- p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
- return null;
- }
- fl.setQty(Env.ZERO);
- }
- // costs = bomCost.negate();
}
- else
- costs = line.getProductCosts(as, line.getAD_Org_ID(), false);
+ int precision = as.getStdPrecision();
+ BigDecimal variance = (costs.setScale(precision, BigDecimal.ROUND_HALF_UP)).subtract(bomCost.negate());
+ // only post variance if it's not zero
+ if (variance.signum() != 0)
+ {
+ //post variance
+ fl = fact.createLine(line,
+ line.getAccount(ProductCost.ACCTTYPE_P_RateVariance, as),
+ as.getC_Currency_ID(), variance.negate());
+ if (fl == null)
+ {
+ p_Error = "Couldn't post variance " + line.getLine() + " - " + line;
+ return null;
+ }
+ fl.setQty(Env.ZERO);
+ }
+ // costs = bomCost.negate();
}
// end MZ
diff --git a/org.adempiere.base/src/org/compiere/model/I_M_Production.java b/org.adempiere.base/src/org/compiere/model/I_M_Production.java
index 86cc80e5f9..65aa464c40 100644
--- a/org.adempiere.base/src/org/compiere/model/I_M_Production.java
+++ b/org.adempiere.base/src/org/compiere/model/I_M_Production.java
@@ -35,9 +35,9 @@ public interface I_M_Production
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
- /** AccessLevel = 3 - Client - Org
+ /** AccessLevel = 1 - Org
*/
- BigDecimal accessLevel = BigDecimal.valueOf(3);
+ BigDecimal accessLevel = BigDecimal.valueOf(1);
/** Load Meta Data */
diff --git a/org.adempiere.base/src/org/compiere/model/I_M_ProductionLine.java b/org.adempiere.base/src/org/compiere/model/I_M_ProductionLine.java
index 211464bcc9..8e6441bdb8 100644
--- a/org.adempiere.base/src/org/compiere/model/I_M_ProductionLine.java
+++ b/org.adempiere.base/src/org/compiere/model/I_M_ProductionLine.java
@@ -35,9 +35,9 @@ public interface I_M_ProductionLine
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
- /** AccessLevel = 3 - Client - Org
+ /** AccessLevel = 1 - Org
*/
- BigDecimal accessLevel = BigDecimal.valueOf(3);
+ BigDecimal accessLevel = BigDecimal.valueOf(1);
/** Load Meta Data */
diff --git a/org.adempiere.base/src/org/compiere/model/MCost.java b/org.adempiere.base/src/org/compiere/model/MCost.java
index 86c4ac84a4..598d94e217 100644
--- a/org.adempiere.base/src/org/compiere/model/MCost.java
+++ b/org.adempiere.base/src/org/compiere/model/MCost.java
@@ -178,15 +178,15 @@ public class MCost extends X_M_Cost
+ ", CostingMethod=" + cm
+ ", Percent=" + percent);
//
- if (currentCostPrice.signum() != 0 || currentCostPriceLL.signum() != 0)
+ if (currentCostPrice != null && currentCostPrice.signum() != 0)
{
if (cm != null)
{
- materialCostEach = materialCostEach.add(currentCostPrice).add(currentCostPriceLL);
+ materialCostEach = materialCostEach.add(currentCostPrice);
}
else
{
- otherCostEach = otherCostEach.add(currentCostPrice).add(currentCostPriceLL);
+ otherCostEach = otherCostEach.add(currentCostPrice);
}
}
if (percent != null && percent.signum() != 0)
diff --git a/org.adempiere.base/src/org/compiere/model/X_M_Production.java b/org.adempiere.base/src/org/compiere/model/X_M_Production.java
index 19d94d5194..cf79627805 100644
--- a/org.adempiere.base/src/org/compiere/model/X_M_Production.java
+++ b/org.adempiere.base/src/org/compiere/model/X_M_Production.java
@@ -33,7 +33,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
/**
*
*/
- private static final long serialVersionUID = 20130317L;
+ private static final long serialVersionUID = 20130423L;
/** Standard Constructor */
public X_M_Production (Properties ctx, int M_Production_ID, String trxName)
@@ -63,7 +63,7 @@ public class X_M_Production extends PO implements I_M_Production, I_Persistent
}
/** AccessLevel
- * @return 3 - Client - Org
+ * @return 1 - Org
*/
protected int get_AccessLevel()
{
diff --git a/org.adempiere.base/src/org/compiere/model/X_M_ProductionLine.java b/org.adempiere.base/src/org/compiere/model/X_M_ProductionLine.java
index e64fb10efa..4424fc04e9 100644
--- a/org.adempiere.base/src/org/compiere/model/X_M_ProductionLine.java
+++ b/org.adempiere.base/src/org/compiere/model/X_M_ProductionLine.java
@@ -32,7 +32,7 @@ public class X_M_ProductionLine extends PO implements I_M_ProductionLine, I_Pers
/**
*
*/
- private static final long serialVersionUID = 20121031L;
+ private static final long serialVersionUID = 20130423L;
/** Standard Constructor */
public X_M_ProductionLine (Properties ctx, int M_ProductionLine_ID, String trxName)
@@ -60,7 +60,7 @@ public class X_M_ProductionLine extends PO implements I_M_ProductionLine, I_Pers
}
/** AccessLevel
- * @return 3 - Client - Org
+ * @return 1 - Org
*/
protected int get_AccessLevel()
{