Fixes Issue 26199:Set Post Disabled status if work effort has total cost zero
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 18 Jun 2014 14:21:18 +0530
changeset 23504 3d6754bc564f
parent 23503 8e54e76894f2
child 23505 a4bfb25b4255
child 23538 d42333fb081c
Fixes Issue 26199:Set Post Disabled status if work effort has total cost zero
src/org/openbravo/erpCommon/ad_forms/DocProduction.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocProduction.java	Wed Jun 18 09:45:39 2014 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocProduction.java	Wed Jun 18 14:21:18 2014 +0530
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2008-2012 Openbravo SLU
+ * All portions are Copyright (C) 2008-2014 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -166,6 +166,17 @@
     String Fact_Acct_Group_ID = SequenceIdData.getUUID();
     log4jDocProduction.debug("createFact - object created");
     // Lines
+    int countProductionlinesWithTrnCostZero = 0;
+    for (int i = 0; i < p_lines.length; i++) {
+      DocLine_Material line = (DocLine_Material) p_lines[i];
+      if (line.transaction.getTransactionCost() != null
+          && line.transaction.getTransactionCost().compareTo(ZERO) == 0) {
+        countProductionlinesWithTrnCostZero++;
+      }
+    }
+    if (p_lines.length == countProductionlinesWithTrnCostZero) {
+      setStatus(STATUS_DocumentDisabled);
+    }
     fact = new Fact(this, as, Fact.POST_Actual);
     for (int i = 0; p_lines != null && i < p_lines.length; i++) {
       DocLine_Material line = (DocLine_Material) p_lines[i];