[pi-process-multi-record] Merge with latest pi
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Mon, 28 Nov 2016 09:02:01 +0100
changeset 31472 0f4dc3f4ee7e
parent 31471 0264118a76fa (current diff)
parent 30991 3d24fc923328 (diff)
child 31473 3da0c9000ddc
[pi-process-multi-record] Merge with latest pi
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Mon Nov 28 09:02:01 2016 +0100
@@ -66,6 +66,7 @@
 import org.openbravo.model.ad.process.ProcessInstance;
 import org.openbravo.model.ad.ui.Process;
 import org.openbravo.model.common.currency.ConversionRate;
+import org.openbravo.model.common.currency.ConversionRateDoc;
 import org.openbravo.model.common.enterprise.DocumentType;
 import org.openbravo.model.common.invoice.Invoice;
 import org.openbravo.model.common.invoice.ReversedInvoice;
@@ -291,8 +292,23 @@
               OBDal.getInstance().save(psd);
             }
             dummyPayment.setFINPaymentDetailList(paymentDetails);
+
+            // Copy exchange rate from invoice
+            for (ConversionRateDoc conversionRateDoc : invoice.getCurrencyConversionRateDocList()) {
+              ConversionRateDoc newConversionRateDoc = OBProvider.getInstance().get(
+                  ConversionRateDoc.class);
+              newConversionRateDoc.setClient(conversionRateDoc.getClient());
+              newConversionRateDoc.setOrganization(conversionRateDoc.getOrganization());
+              newConversionRateDoc.setCurrency(conversionRateDoc.getCurrency());
+              newConversionRateDoc.setToCurrency(conversionRateDoc.getToCurrency());
+              newConversionRateDoc.setRate(conversionRateDoc.getRate());
+              newConversionRateDoc.setForeignAmount(BigDecimal.ZERO);
+              newConversionRateDoc.setPayment(dummyPayment);
+              dummyPayment.getCurrencyConversionRateDocList().add(newConversionRateDoc);
+              OBDal.getInstance().save(newConversionRateDoc);
+            }
+
             OBDal.getInstance().save(dummyPayment);
-
           } catch (final Exception e) {
             log4j.error("Exception while creating dummy payment for the invoice: "
                 + strC_Invoice_ID);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Mon Nov 28 09:02:01 2016 +0100
@@ -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) 2010-2014 Openbravo SLU
+ * All portions are Copyright (C) 2010-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -195,8 +195,8 @@
           account, "Y");
 
       reconciliation.setEndingBalance(new BigDecimal(strEndBalance));
-      reconciliation.setTransactionDate(FIN_Utility.getDateTime(strStatementDate));
-      reconciliation.setEndingDate(FIN_Utility.getDateTime(strStatementDate));
+      reconciliation.setTransactionDate(FIN_Utility.getDate(strStatementDate));
+      reconciliation.setEndingDate(FIN_Utility.getDate(strStatementDate));
       reconciliation.setDocumentStatus("DR");
       reconciliation.setProcessed(false);
       reconciliation.setAPRMProcessReconciliation("P");
--- a/modules/org.openbravo.base.weld/src/META-INF/beans.xml	Tue Nov 22 16:09:12 2016 +0100
+++ b/modules/org.openbravo.base.weld/src/META-INF/beans.xml	Mon Nov 28 09:02:01 2016 +0100
@@ -37,7 +37,11 @@
         <weld:exclude name="org.openbravo.model.**"/>
         <weld:exclude name="org.openbravo.examples.**"/>
         <weld:exclude name="org.openbravo.authentication.**"/>
-        <weld:exclude name="org.openbravo.**.ad_*.**"/>
+        <weld:exclude name="org.openbravo.**.ad_callouts.**"/>
+        <weld:exclude name="org.openbravo.**.ad_combos.**"/>
+        <weld:exclude name="org.openbravo.**.ad_forms.**"/>
+        <weld:exclude name="org.openbravo.**.ad_help.**"/>
+        <weld:exclude name="org.openbravo.**.ad_reports.**"/>
         <weld:exclude name="org.openbravo.**.test.**">
           <weld:if-class-available name="!org.jboss.ejb3.api.spi.EJBContainerWrapper"/>
         </weld:exclude>
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Tue Nov 22 16:09:12 2016 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Mon Nov 28 09:02:01 2016 +0100
@@ -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) 2011-2015 Openbravo SLU
+ * All portions are Copyright (C) 2011-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -331,6 +331,10 @@
         gridCriteria, criteriaFieldName = this.getCriteriaFieldName(),
         me = this;
 
+    function isInPickAndExecuteGrid() {
+      return (me.grid && me.grid.parentElement && me.grid.parentElement.getClassName() === 'OBPickAndExecuteGrid');
+    }
+
     function cleanCriteria(crit, fkItem) {
       var i, criterion, fkFilterOnThisField;
       for (i = crit.length - 1; i >= 0; i--) {
@@ -347,13 +351,29 @@
           crit.removeAt(i);
         }
 
-        if (me.grid && me.grid.parentElement && me.grid.parentElement.getClassName() === 'OBPickAndExecuteGrid' && criterion.fieldName === 'id') {
+        if (isInPickAndExecuteGrid() && criterion.fieldName === 'id') {
           // we're in a P&E grid, selected ids should also be removed from criteria
           crit.removeAt(i);
         }
       }
     }
 
+    function cleanOrCriterion() {
+      if (isInPickAndExecuteGrid() && gridCriteria._OrExpression) {
+        // we're in a P&E grid, _OrExpression parameter should also be removed as it is used as part of the selection criteria
+        if (gridCriteria.criteria.length > 0) {
+          gridCriteria = {
+            operator: 'and',
+            _constructor: 'AdvancedCriteria',
+            criteria: gridCriteria.criteria
+          };
+        } else {
+          gridCriteria = {};
+          gridCriteria.criteria = [];
+        }
+      }
+    }
+
     if (this.form.grid.sourceWidget.lazyFiltering) {
       // Fetch the criteria from the current values of the filter editor
       // Invoke the convertCriteria function to filter by the record selected in the parent tab if needed
@@ -371,6 +391,7 @@
     // remove from criteria the field used for current filter so drop down doesn't
     // restrict its values
     cleanCriteria(gridCriteria.criteria);
+    cleanOrCriterion();
 
     if (this.form.grid.sourceWidget && this.form.grid.sourceWidget.dataSource) {
       gridCriteria = this.form.grid.sourceWidget.dataSource.convertRelativeDates(gridCriteria);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js	Tue Nov 22 16:09:12 2016 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-image.js	Mon Nov 28 09:02:01 2016 +0100
@@ -230,6 +230,7 @@
   init: function () {
     this.canvasProperties = this.canvasProperties || {};
     this.canvasProperties.parentItem = this;
+    this.canvasProperties.canFocus = true;
     this.Super('init', arguments);
   },
   //This formitem will never be disabled, so even if the form is readonly, click events will still be triggered
--- a/src-db/database/build.xml	Tue Nov 22 16:09:12 2016 +0100
+++ b/src-db/database/build.xml	Mon Nov 28 09:02:01 2016 +0100
@@ -165,14 +165,14 @@
     <taskdef name="exportsampledata" classname="org.openbravo.ddlutils.task.ExportSampledata">
       <classpath refid="runtime-classpath" />
     </taskdef>
-    <exportsampledata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" verbosity="${bbdd.verbosity}" basedir="${basedir}/../../" client="${client}" module="${module}" />
+    <exportsampledata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" verbosity="${bbdd.verbosity}" basedir="${basedir}/../../" client="${client}" module="${module}" rdbms="${bbdd.rdbms}" exportFormat="${exportFormat}"/>
   </target>
 
   <target name="import.sample.data">
     <taskdef name="importsampledata" classname="org.openbravo.ddlutils.task.ImportSampledata">
       <classpath refid="runtime-classpath" />
     </taskdef>
-    <importsampledata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" verbosity="${bbdd.verbosity}" basedir="${basedir}/../../" executeModuleScripts="${execute.modulescripts}"/>
+    <importsampledata driver="${bbdd.driver}" url="${bbdd.owner.url}" user="${bbdd.user}" password="${bbdd.password}" verbosity="${bbdd.verbosity}" basedir="${basedir}/../../" executeModuleScripts="${execute.modulescripts}" rdbms="${bbdd.rdbms}"/>
     <antcall target="database.postupdate.${bbdd.rdbms}" />
   </target>
 
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- a/src-db/database/model/functions/M_MOVEMENT_POST.xml	Tue Nov 22 16:09:12 2016 +0100
+++ b/src-db/database/model/functions/M_MOVEMENT_POST.xml	Mon Nov 28 09:02:01 2016 +0100
@@ -190,8 +190,8 @@
         LOOP
           v_ResultStr:='Transaction for line' || Cur_MoveLine.Line;
 
-          IF (Cur_MoveLine.MovementQty = 0) THEN
-             RAISE_APPLICATION_ERROR(-20000,'@GoodsMovementsWithZeroQty@' || ' @Inline@ ' || Cur_MoveLine.line) ;
+          IF (Cur_MoveLine.MovementQty <= 0) THEN
+            RAISE_APPLICATION_ERROR(-20000,'@GoodsMovementsWithNegativeQty@' || ' @Inline@ ' || Cur_MoveLine.line) ;
           END IF;
           
           IF (cur_moveline.m_reservation_id IS NOT NULL) THEN
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Nov 22 16:09:12 2016 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Nov 28 09:02:01 2016 +0100
@@ -17203,7 +17203,7 @@
 <!--1E33F2F8858B48D79F845F72CD828861-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--1E33F2F8858B48D79F845F72CD828861-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1E33F2F8858B48D79F845F72CD828861-->  <VALUE><![CDATA[GoodsMovementsWithZeroQty]]></VALUE>
-<!--1E33F2F8858B48D79F845F72CD828861-->  <MSGTEXT><![CDATA[Is is not possible to process because one line has value zero in movement quantity. Please insert a different value from zero.]]></MSGTEXT>
+<!--1E33F2F8858B48D79F845F72CD828861-->  <MSGTEXT><![CDATA[It is not possible to process because one line has value zero in movement quantity. Please insert a different value from zero.]]></MSGTEXT>
 <!--1E33F2F8858B48D79F845F72CD828861-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--1E33F2F8858B48D79F845F72CD828861-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1E33F2F8858B48D79F845F72CD828861-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
@@ -21408,6 +21408,18 @@
 <!--74560B0C1A2C42DABDEFE33B6AEB3B86-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--74560B0C1A2C42DABDEFE33B6AEB3B86--></AD_MESSAGE>
 
+<!--747C2388755148C68AA90B056CC47255--><AD_MESSAGE>
+<!--747C2388755148C68AA90B056CC47255-->  <AD_MESSAGE_ID><![CDATA[747C2388755148C68AA90B056CC47255]]></AD_MESSAGE_ID>
+<!--747C2388755148C68AA90B056CC47255-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--747C2388755148C68AA90B056CC47255-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--747C2388755148C68AA90B056CC47255-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--747C2388755148C68AA90B056CC47255-->  <VALUE><![CDATA[GoodsMovementsWithNegativeQty]]></VALUE>
+<!--747C2388755148C68AA90B056CC47255-->  <MSGTEXT><![CDATA[It is not possible to process because one line has zero or negative value in movement quantity. Please insert a positive value.]]></MSGTEXT>
+<!--747C2388755148C68AA90B056CC47255-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--747C2388755148C68AA90B056CC47255-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--747C2388755148C68AA90B056CC47255-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--747C2388755148C68AA90B056CC47255--></AD_MESSAGE>
+
 <!--7483DF96F3C34BB38C67B66BFAC79404--><AD_MESSAGE>
 <!--7483DF96F3C34BB38C67B66BFAC79404-->  <AD_MESSAGE_ID><![CDATA[7483DF96F3C34BB38C67B66BFAC79404]]></AD_MESSAGE_ID>
 <!--7483DF96F3C34BB38C67B66BFAC79404-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-test/src/org/openbravo/test/scheduling/ProcessSchedulingTest.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/src-test/src/org/openbravo/test/scheduling/ProcessSchedulingTest.java	Mon Nov 28 09:02:01 2016 +0100
@@ -27,6 +27,7 @@
 
 import org.junit.Test;
 import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.base.weld.test.WeldBaseTest;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.ui.ProcessRun;
 import org.openbravo.scheduling.Process;
@@ -35,7 +36,6 @@
 import org.openbravo.scheduling.ProcessRunner;
 import org.openbravo.service.db.DalBaseProcess;
 import org.openbravo.service.db.DalConnectionProvider;
-import org.openbravo.test.base.OBBaseTest;
 
 /**
  * Test cases for process schedule and process runner
@@ -43,7 +43,7 @@
  * @author alostale
  *
  */
-public class ProcessSchedulingTest extends OBBaseTest {
+public class ProcessSchedulingTest extends WeldBaseTest {
   private static final String anyProcessID = "800170";
   private static final String USER_ID = "100";
   private static final String ROLE_ID = "0";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/base/secureApp/AllowedCrossDomainsHandler.java	Mon Nov 28 09:02:01 2016 +0100
@@ -0,0 +1,141 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2016 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.base.secureApp;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.openbravo.base.weld.WeldUtils;
+
+/**
+ * Provides/handles the domain checkers which determine if a specific cross domain request is
+ * allowed on the OB server.
+ * 
+ * https://en.wikipedia.org/wiki/Cross-origin_resource_sharing
+ * 
+ * @author Martin Taal
+ */
+public class AllowedCrossDomainsHandler {
+
+  private static final Logger log = Logger.getLogger(AllowedCrossDomainsHandler.class);
+
+  private static AllowedCrossDomainsHandler instance = new AllowedCrossDomainsHandler();
+
+  public static AllowedCrossDomainsHandler getInstance() {
+    return instance;
+  }
+
+  public static void setInstance(AllowedCrossDomainsHandler instance) {
+    AllowedCrossDomainsHandler.instance = instance;
+  }
+
+  private Collection<AllowedCrossDomainsChecker> checkers = null;
+
+  /**
+   * Returns true if the origin is allowed, in that case the cors headers can be set (
+   * {@link #setCORSHeaders(HttpServletRequest, HttpServletResponse)}.
+   * 
+   * @param request
+   * @param origin
+   *          , the origin can be obtained from the request
+   * @return
+   */
+  private boolean isAllowedOrigin(HttpServletRequest request, String origin) {
+    for (AllowedCrossDomainsChecker checker : getCheckers()) {
+      if (checker.isAllowedOrigin(request, origin)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  private Collection<AllowedCrossDomainsChecker> getCheckers() {
+    if (checkers == null) {
+      setCheckers();
+    }
+    return checkers;
+  }
+
+  private synchronized void setCheckers() {
+    if (checkers != null) {
+      return;
+    }
+    final Collection<AllowedCrossDomainsChecker> localCheckers = new ArrayList<AllowedCrossDomainsChecker>();
+    for (AllowedCrossDomainsChecker checker : WeldUtils
+        .getInstances(AllowedCrossDomainsChecker.class)) {
+      localCheckers.add(checker);
+    }
+    checkers = localCheckers;
+  }
+
+  /**
+   * Utility method to set CORS headers on a request.
+   */
+  public void setCORSHeaders(HttpServletRequest request, HttpServletResponse response) {
+
+    // don't do anything if no checkers anyway
+    if (getCheckers().isEmpty()) {
+      return;
+    }
+
+    try {
+      final String origin = request.getHeader("Origin");
+
+      if (origin != null && !origin.equals("")) {
+
+        if (!isAllowedOrigin(request, origin)) {
+          return;
+        }
+
+        response.setHeader("Access-Control-Allow-Origin", origin);
+        response.setHeader("Access-Control-Allow-Credentials", "true");
+        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
+        response.setHeader("Access-Control-Allow-Headers",
+            "Content-Type, Origin, Accept, X-Requested-With, Access-Control-Allow-Credentials");
+
+        response.setHeader("Access-Control-Max-Age", "10000");
+      }
+    } catch (Exception logIt) {
+      // on purpose not stopping on this to retain some robustness
+      log.error(
+          "Error when setting cors headers " + logIt.getMessage() + " " + request.getRequestURL()
+              + " " + request.getQueryString(), logIt);
+    }
+  }
+
+  /**
+   * Implementation provided by modules which determine if a request is coming from an allowed
+   * origin.
+   * 
+   * @author mtaal
+   */
+  @ApplicationScoped
+  public static abstract class AllowedCrossDomainsChecker {
+
+    public abstract boolean isAllowedOrigin(HttpServletRequest request, String origin);
+
+  }
+
+}
--- a/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/src/org/openbravo/base/secureApp/HttpSecureAppServlet.java	Mon Nov 28 09:02:01 2016 +0100
@@ -164,6 +164,15 @@
   @Override
   public void service(HttpServletRequest request, HttpServletResponse response) throws IOException,
       ServletException {
+
+    AllowedCrossDomainsHandler.getInstance().setCORSHeaders(request, response);
+
+    // don't process any further requests otherwise sessions are created for OPTIONS
+    // requests, the cors headers have already been set so can return
+    if (request.getMethod().equals("OPTIONS")) {
+      return;
+    }
+
     Variables variables = new Variables(request);
 
     // VariablesSecureApp vars = new VariablesSecureApp(request);
--- a/src/org/openbravo/erpReports/C_OrderLinesJR_new.jrxml	Tue Nov 22 16:09:12 2016 +0100
+++ b/src/org/openbravo/erpReports/C_OrderLinesJR_new.jrxml	Mon Nov 28 09:02:01 2016 +0100
@@ -46,7 +46,7 @@
             AND M_PRODUCT.C_UOM_ID = C_UOM.C_UOM_ID
             AND C_ORDERLINE.C_ORDER_ID = $P{C_ORDER_ID}
             AND C_ORDERLINE.C_ORDER_ID=C_ORDER.C_ORDER_ID
-			AND C_ORDERLINE.BOM_PARENT_ID IS NOT NULL
+            AND C_ORDERLINE.BOM_PARENT_ID IS NOT NULL
         UNION
         SELECT 3 AS ISBOM, TO_NUMBER(null) AS LINE, C_TAX.NAME AS PRODUCT_NAME, TO_NUMBER(NULL) AS QUANTITY, '' AS UOM, TO_NUMBER(NULL) AS PRICEACTUAL,
         C_ORDERTAX.TAXBASEAMT AS BASE, C_ORDERTAX.TAXAMT AS LINENETAMT, C_ORDERTAX.LINE AS TAXLINE, C_ORDER.docstatus AS STATUS,
--- a/src/org/openbravo/erpReports/C_OrderLinesTaxIncludedJR_new.jrxml	Tue Nov 22 16:09:12 2016 +0100
+++ b/src/org/openbravo/erpReports/C_OrderLinesTaxIncludedJR_new.jrxml	Mon Nov 28 09:02:01 2016 +0100
@@ -35,6 +35,7 @@
                          C_ORDER
         WHERE C_ORDERLINE.C_ORDER_ID = $P{C_ORDER_ID}
               AND C_ORDERLINE.C_ORDER_ID=C_ORDER.C_ORDER_ID
+              AND C_ORDERLINE.BOM_PARENT_ID IS NULL
         UNION
         SELECT 2 AS ISBOM, C_ORDERLINE.LINE, M_PRODUCT.NAME AS PRODUCT_NAME, C_ORDERLINE.QTYORDERED AS QUANTITY,
         TO_CHAR(C_UOM.NAME) AS UOM, CASE WHEN $P{ISTAXINCLUDED} = 'N' THEN C_ORDERLINE.PRICEACTUAL ELSE C_ORDERLINE.GROSS_UNIT_PRICE END AS PRICEACTUAL, TO_NUMBER(NULL) AS BASE, CASE WHEN $P{ISTAXINCLUDED} = 'N' THEN C_ORDERLINE.LINENETAMT ELSE C_ORDERLINE.LINE_GROSS_AMOUNT END AS LINENETAMT, TO_NUMBER(NULL) AS TAXLINE,
@@ -45,6 +46,7 @@
             AND M_PRODUCT.C_UOM_ID = C_UOM.C_UOM_ID
             AND C_ORDERLINE.C_ORDER_ID = $P{C_ORDER_ID}
             AND C_ORDERLINE.C_ORDER_ID=C_ORDER.C_ORDER_ID
+            AND C_ORDERLINE.BOM_PARENT_ID IS NOT NULL
         UNION
         SELECT 3 AS ISBOM, TO_NUMBER(null) AS LINE, C_TAX.NAME AS PRODUCT_NAME, TO_NUMBER(NULL) AS QUANTITY, '' AS UOM, TO_NUMBER(NULL) AS PRICEACTUAL,
         C_ORDERTAX.TAXBASEAMT AS BASE, C_ORDERTAX.TAXAMT AS LINENETAMT, C_ORDERTAX.LINE AS TAXLINE, C_ORDER.docstatus AS STATUS,
--- a/src/org/openbravo/scheduling/ProcessRunner.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/src/org/openbravo/scheduling/ProcessRunner.java	Mon Nov 28 09:02:01 2016 +0100
@@ -27,6 +27,7 @@
 import javax.servlet.ServletException;
 
 import org.apache.log4j.Logger;
+import org.openbravo.base.weld.WeldUtils;
 import org.openbravo.database.ConnectionProvider;
 import org.openbravo.erpCommon.utility.SequenceIdData;
 
@@ -55,7 +56,7 @@
 
     Process process = null;
     try {
-      process = bundle.getProcessClass().newInstance();
+      process = WeldUtils.getInstanceFromStaticBeanManager(bundle.getProcessClass());
 
     } catch (final Exception e) {
       log.error(e.getMessage(), e);
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java	Tue Nov 22 16:09:12 2016 +0100
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java	Mon Nov 28 09:02:01 2016 +0100
@@ -144,9 +144,8 @@
 
   private boolean threadsStarted = false;
 
-  // TODO: make this a preference
   private long initialWaitTime = 10000;
-  private long managerWaitTime = 60000;
+  private long managerWaitTime = 600_000L;
 
   // default to number of processors plus some additionals for the main threads
   private int numberOfThreads = Runtime.getRuntime().availableProcessors() + 3;
@@ -175,6 +174,10 @@
         numberOfThreads, 4);
     maxTaskQueueSize = ImportProcessUtils.getCheckIntProperty(log, "import.max.task.queue.size",
         maxTaskQueueSize, 50);
+    managerWaitTime = ImportProcessUtils.getCheckIntProperty(log, "import.wait.time", 600, 1);
+
+    // property defined in secs, convert to ms
+    managerWaitTime = managerWaitTime * 1000;
   }
 
   public synchronized void start() {
@@ -494,7 +497,7 @@
         try {
           if (!wasNotifiedInParallel) {
             log.debug("Waiting for next cycle or new import entries");
-            monitorObject.wait(10 * manager.managerWaitTime);
+            monitorObject.wait(manager.managerWaitTime);
             log.debug("Woken");
           }
           wasNotifiedInParallel = false;
@@ -637,10 +640,10 @@
           } catch (Throwable t) {
             ImportProcessUtils.logError(log, t);
 
-            // wait otherwise the loop goes wild in case of really severe
+            // wait for 5 min otherwise the loop goes wild in case of really severe
             // system errors like full disk
             try {
-              Thread.sleep(5 * manager.managerWaitTime);
+              Thread.sleep(300_000L);
             } catch (Exception ignored) {
             }
           }