Merged from PI
authorUnai Martirena <unai.martirena@openbravo.com>
Fri, 10 Jun 2016 09:44:44 +0200
changeset 29815 4933ec2c94ff
parent 29791 6ca339f71aac (current diff)
parent 29814 0323d44c7e7c (diff)
child 29818 6f0db2e1df44
Merged from PI
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.myob/src-test/org/openbravo/client/myob/test/MyOpenbravoTest.java
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
src-db/database/sourcedata/AD_MODULE.xml
src-db/database/sourcedata/AD_TABLE.xml
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/.hgsigs	Thu Jun 09 18:46:49 2016 +0200
+++ b/.hgsigs	Fri Jun 10 09:44:44 2016 +0200
@@ -193,3 +193,4 @@
 38ef1dc10aa3d6fb8210b85beab370f62a4545ca 0 iEYEABECAAYFAlbiTM0ACgkQCX/oGf+2qkNBDwCfXmKXkqNGsAsfiofYOBBdvjA/XgkAoIwLK3DkmHeM71JihwfVOWyB4hmj
 265e8eccf704614fe88220026f2e2bafcebaaf00 0 iEYEABECAAYFAlcgZEQACgkQCX/oGf+2qkPuZgCcDPuB9d77M+51AglMvvmtpCDtnvoAnjqst7QgD6IP3Sv21+4vlqEjLVqU
 98bdf9167a3d4ea9cb9b6f5e214a539220a3f3cb 0 iEYEABECAAYFAldD+MEACgkQCX/oGf+2qkPLHwCgngPaeyLsiGk2FhShX4/IzVARWN8AnRSCXIoWp6ruOcbEfIUFQiM9lY7f
+008d208ba1f60804fd852570f0cd7e985a4220da 0 iEYEABECAAYFAldQUXwACgkQCX/oGf+2qkOtLQCdEZMKf7VfsSt6iVUl59GzwNdr7C4AoK4B3pbbW23fqYd1qplclO3aGm1B
--- a/.hgtags	Thu Jun 09 18:46:49 2016 +0200
+++ b/.hgtags	Fri Jun 10 09:44:44 2016 +0200
@@ -204,3 +204,4 @@
 ee5383e071318afe8eece515b4b264cfb46c1a84 3.0PR16Q1
 d386f41fa755d23e0e23f881aece691009051ebd 3.0PR16Q1.1
 ec73935a2c83b6164a18cb70996226cb15672038 3.0PR16Q1.2
+208b773131650c3806cefa65b4d5df9bf1992821 3.0PR16Q1.3
--- a/modules/org.openbravo.client.kernel/jsbeautify/jsbeautifier.py	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.kernel/jsbeautify/jsbeautifier.py	Fri Jun 10 09:44:44 2016 +0200
@@ -987,7 +987,7 @@
 
         lines = token_text.replace('\x0d', '').split('\x0a')
         # all lines start with an asterisk? that's a proper box comment
-        if not any(l for l in lines[1:] if (l.lstrip())[0] != '*'):
+        if not any(l for l in lines[1:] if l.lstrip() and (l.lstrip())[0] != '*'):
             self.append_newline()
             self.append(lines[0])
             for line in lines[1:]:
--- a/modules/org.openbravo.client.myob/src-db/database/model/tables/OBKMO_WIDGET_CLASS.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/model/tables/OBKMO_WIDGET_CLASS.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -102,6 +102,7 @@
         <unique-column name="TITLE"/>
       </unique>
       <check name="OBKMO_WIDGETCLASS_ALLOWANONACC"><![CDATA[ALLOW_ANONYMOUS_ACCESS IN ('Y', 'N')]]></check>
+      <check name="OBKMO_WIDGETCLASS_AVAILABL_CHK"><![CDATA[AVAILABLE_IN_WORKSPACE IN ('Y', 'N')]]></check>
       <check name="OBKMO_WIDGETCLASS_CAN_MAX_CHK"><![CDATA[CAN_MAXIMIZE IN ('Y', 'N')]]></check>
       <check name="OBKMO_WIDGETCLASS_CLASNAME"><![CDATA[WIDGET_SUPERCLASS_ID IS NOT NULL OR JAVACLASS IS NOT NULL]]></check>
       <check name="OBKMO_WIDGETCLASS_ISACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_COLUMN.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_COLUMN.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -627,6 +627,8 @@
 <!--7D1559318B3140508C83E893EF404710-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--7D1559318B3140508C83E893EF404710-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7D1559318B3140508C83E893EF404710-->  <NAME><![CDATA[Available_In_Workspace]]></NAME>
+<!--7D1559318B3140508C83E893EF404710-->  <DESCRIPTION><![CDATA[Determines whether the widget is available to be shown in the workspace.]]></DESCRIPTION>
+<!--7D1559318B3140508C83E893EF404710-->  <HELP><![CDATA[When this field is checked, the widget will be available in the "Add Widget" drop down menu to include it in the workspace.]]></HELP>
 <!--7D1559318B3140508C83E893EF404710-->  <COLUMNNAME><![CDATA[Available_In_Workspace]]></COLUMNNAME>
 <!--7D1559318B3140508C83E893EF404710-->  <AD_TABLE_ID><![CDATA[5F20F3D554CA408891C1BA6545114D4D]]></AD_TABLE_ID>
 <!--7D1559318B3140508C83E893EF404710-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -88,8 +88,10 @@
 <!--8E2D37834C60447698936C888B390F9E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--8E2D37834C60447698936C888B390F9E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8E2D37834C60447698936C888B390F9E-->  <COLUMNNAME><![CDATA[Available_In_Workspace]]></COLUMNNAME>
-<!--8E2D37834C60447698936C888B390F9E-->  <NAME><![CDATA[Available_In_Workspace]]></NAME>
-<!--8E2D37834C60447698936C888B390F9E-->  <PRINTNAME><![CDATA[Available_In_Workspace]]></PRINTNAME>
+<!--8E2D37834C60447698936C888B390F9E-->  <NAME><![CDATA[Available in Workspace]]></NAME>
+<!--8E2D37834C60447698936C888B390F9E-->  <PRINTNAME><![CDATA[Available in Workspace]]></PRINTNAME>
+<!--8E2D37834C60447698936C888B390F9E-->  <DESCRIPTION><![CDATA[Determines whether the widget is available to be shown in the workspace.]]></DESCRIPTION>
+<!--8E2D37834C60447698936C888B390F9E-->  <HELP><![CDATA[When this field is checked, the widget will be available in the "Add Widget" drop down menu to include it in the workspace.]]></HELP>
 <!--8E2D37834C60447698936C888B390F9E-->  <AD_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_MODULE_ID>
 <!--8E2D37834C60447698936C888B390F9E-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--8E2D37834C60447698936C888B390F9E--></AD_ELEMENT>
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_FIELD.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_FIELD.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -149,7 +149,9 @@
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--5E2FBB96AE394B12938889ACBF585D89-->  <NAME><![CDATA[Available_In_Workspace]]></NAME>
+<!--5E2FBB96AE394B12938889ACBF585D89-->  <NAME><![CDATA[Available in Workspace]]></NAME>
+<!--5E2FBB96AE394B12938889ACBF585D89-->  <DESCRIPTION><![CDATA[Determines whether the widget is available to be shown in the workspace.]]></DESCRIPTION>
+<!--5E2FBB96AE394B12938889ACBF585D89-->  <HELP><![CDATA[When this field is checked, the widget will be available in the "Add Widget" drop down menu to include it in the workspace.]]></HELP>
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <AD_TAB_ID><![CDATA[EA867498578C4E98A4935A53A3A5F6AE]]></AD_TAB_ID>
 <!--5E2FBB96AE394B12938889ACBF585D89-->  <AD_COLUMN_ID><![CDATA[7D1559318B3140508C83E893EF404710]]></AD_COLUMN_ID>
--- a/modules/org.openbravo.client.myob/src-test/org/openbravo/client/myob/test/MyOpenbravoTest.java	Thu Jun 09 18:46:49 2016 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
- *************************************************************************
- * 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) 2014 Openbravo SLU 
- * All Rights Reserved. 
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-
-package org.openbravo.client.myob.test;
-
-import java.util.List;
-
-import org.junit.Test;
-import org.openbravo.client.myob.MyOpenbravoComponent;
-import org.openbravo.test.base.OBBaseTest;
-
-public class MyOpenbravoTest extends OBBaseTest {
-  private static final String WIDGET_MOVED = "WIDGET_MOVED";
-  private static final String WIDGET_ADDED = "WIDGET_ADDED";
-  private static final String WIDGET_REMOVED = "WIDGET_REMOVED";
-  private static final String PUBLISH_CHANGES = "PUBLISH_CHANGES";
-
-  public static final String TITLE = "title";
-  private static final String COLNUM = "colNum";
-  private static final String ROWNUM = "rowNum";
-  private static final String HEIGHT = "height";
-  protected static final String PARAMETERS = "parameters";
-  private static final String DBINSTANCEID = "dbInstanceId";
-
-  @Test
-  public void testMyOpenbravoComponent() throws Exception {
-    setTestAdminContext();
-    final MyOpenbravoComponent component = new MyOpenbravoComponent();
-
-    System.err.println("Available Widget Classes for System Administrator");
-    List<String> availableWidgetClasses = component.getAvailableWidgetClasses();
-    for (String widgetClass : availableWidgetClasses) {
-      System.err.println(widgetClass);
-    }
-
-    System.err.println("Available Widget Instances for System Administrator");
-    List<String> availableWidgetInstances = component.getWidgetInstanceDefinitions();
-    for (String widgetClass : availableWidgetInstances) {
-      System.err.println(widgetClass);
-    }
-
-  }
-
-  /**
-   * Testing of MyOpenbravoHandler is done using my-openbravo-test.js javascript.
-   */
-
-  // public void testMyOpenbravoHandler() {
-  // setSystemAdministratorContext();
-  // MyOpenbravoComponent component = new MyOpenbravoComponent();
-  //
-  // try {
-  // JSONObject content = buildContent(false, WIDGET_ADDED, null, null, component);
-  // JSONArray widgets = content.getJSONArray("widgets");
-  // String initialWidgets = widgets.toString();
-  // // Add a new widget instance to the user
-  // WidgetClass widgetClass = OBDal.getInstance().get(WidgetClass.class,
-  // "409D7D27FC2949ACAE0E3F5298A0B3BA");
-  // Long maxRowNumCol0 = getMaxRowNum(widgets, 0L);
-  // Long maxRowNumCol1 = getMaxRowNum(widgets, 1L);
-  // JSONObject newWidget = newWidgetInstance(widgetClass, 1L, maxRowNumCol1 + 1,
-  // new ArrayList<ParameterValue>());
-  // widgets.put(newWidget.toString());
-  //
-  // } catch (JSONException e) {
-  // }
-  //
-  // }
-  //
-  // private JSONObject buildContent(boolean isAdminMode, String strEventType, String strLevel,
-  // String strLevelValue, MyOpenbravoComponent component) throws JSONException {
-  //
-  // JSONObject content = new JSONObject();
-  // content.put("eventType", strEventType);
-  //
-  // JSONObject context = new JSONObject();
-  // context.put("adminMode", isAdminMode);
-  // if (isAdminMode) {
-  // context.put("availableAtLevel", strLevel);
-  // context.put("availableAtLevelValue", strLevelValue);
-  // }
-  // content.put("context", context);
-  //
-  // JSONArray widgets = new JSONArray();
-  // if (!isAdminMode) {
-  // widgets = new JSONArray(component.getWidgetInstanceDefinitions());
-  // } else {
-  // widgets = new JSONArray(MyOBUtils.getDefaultWidgetInstances(strLevel,
-  // new String[] { strLevelValue }));
-  // }
-  // content.put("widgets", widgets);
-  //
-  // return null;
-  // }
-  //
-  // private Long getMaxRowNum(JSONArray initialWidgets, long colNum) throws JSONException {
-  // Long maxRowNum = 0L;
-  // for (int i = 0; i < initialWidgets.length(); i++) {
-  // JSONObject widgetDefinition = new JSONObject(initialWidgets.getString(i));
-  // if (colNum == widgetDefinition.getLong(COLNUM)
-  // && maxRowNum < widgetDefinition.getLong(ROWNUM)) {
-  // maxRowNum = widgetDefinition.getLong(ROWNUM);
-  // }
-  // }
-  // return maxRowNum;
-  // }
-  //
-  // private JSONObject newWidgetInstance(WidgetClass widgetClass, Long colNum, Long rowNum,
-  // List<ParameterValue> parameterValues) throws JSONException {
-  // JSONObject jsonObject = new JSONObject();
-  // jsonObject.put(MyOpenbravoWidgetComponent.CLASSNAMEPARAMETER, MyOBUtils.getWidgetProvider(
-  // widgetClass).getClientSideWidgetClassName());
-  // jsonObject.put(DBINSTANCEID, "");
-  // jsonObject.put(TITLE, MyOBUtils.getWidgetTitle(widgetClass));
-  // jsonObject.put(COLNUM, colNum);
-  // jsonObject.put(ROWNUM, rowNum);
-  // jsonObject.put(HEIGHT, widgetClass.getHeight());
-  // final JSONObject widgetParameters = new JSONObject();
-  // for (ParameterValue parameterValue : parameterValues) {
-  // if (parameterValue.getValueDate() != null) {
-  // widgetParameters
-  // .put(parameterValue.getParameter().getName(), parameterValue.getValueDate());
-  // } else if (parameterValue.getValueNumber() != null) {
-  // widgetParameters.put(parameterValue.getParameter().getName(), parameterValue
-  // .getValueNumber());
-  // } else if (parameterValue.getValueString() != null) {
-  // widgetParameters.put(parameterValue.getParameter().getName(), parameterValue
-  // .getValueString());
-  // }
-  // }
-  // jsonObject.put(PARAMETERS, widgetParameters);
-  //
-  // return jsonObject;
-  // }
-}
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Fri Jun 10 09:44:44 2016 +0200
@@ -185,11 +185,8 @@
     List<String> availableClasses = null;
     try {
       final String strEventType = o.getString("eventType");
-      if (GET_AVAILABLE_WIDGET_CLASSES.equals(strEventType)) {
-        availableClasses = component.getAvailableWidgetClasses(roleId, isAdminMode, true);
-      } else {
-        availableClasses = component.getAvailableWidgetClasses(roleId, isAdminMode);
-      }
+      boolean onlyWorkspaceWidgets = GET_AVAILABLE_WIDGET_CLASSES.equals(strEventType);
+      availableClasses = component.getAvailableWidgetClasses(roleId, onlyWorkspaceWidgets);
       o.put("availableWidgetClasses", availableClasses);
     } catch (Exception e) {
       log.error("Error retreiving widget classes", e);
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java	Fri Jun 10 09:44:44 2016 +0200
@@ -85,23 +85,7 @@
     return COMPONENT_ID;
   }
 
-  public List<String> getAvailableWidgetClasses() throws Exception {
-    return getAvailableWidgetClasses(null);
-  }
-
-  public List<String> getAvailableWidgetClasses(String roleId) throws Exception {
-    boolean isAdminMode = false;
-    return getAvailableWidgetClasses(roleId, isAdminMode);
-  }
-
-  public List<String> getAvailableWidgetClasses(String roleId, boolean isAdminMode)
-      throws Exception {
-    boolean shouldBeDisplayedInWorkspace = false;
-    return getAvailableWidgetClasses(roleId, isAdminMode, shouldBeDisplayedInWorkspace);
-  }
-
-  public List<String> getAvailableWidgetClasses(String roleId, boolean isAdminMode,
-      boolean shouldBeDisplayed) throws Exception {
+  List<String> getAvailableWidgetClasses(String roleId, boolean shouldBeDisplayed) throws Exception {
     OBContext.setAdminMode();
     try {
       if (widgetClassDefinitions != null) {
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped_data.xsql	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src/org/openbravo/reports/ordersawaitingdelivery/erpCommon/ad_reports/ReportOrderNotShipped_data.xsql	Fri Jun 10 09:44:44 2016 +0200
@@ -12,7 +12,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) 2009-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,46 +29,43 @@
     PR.NAME || ' ' || COALESCE(TO_CHAR(ASI.DESCRIPTION), '') AS PRODNAME, OL.M_ATTRIBUTESETINSTANCE_ID,
     OL.QTYORDERED || ' ' || COALESCE(TO_CHAR(UO.UOMSYMBOL), '') AS ORDEREDQTY, 
     (OL.QTYORDERED-OL.QTYDELIVERED) || ' ' || COALESCE(TO_CHAR(UO.UOMSYMBOL), '') AS PENDINGQTY, 
-    SUM(SD.QTYONHAND) || ' ' || COALESCE(TO_CHAR(UO.UOMSYMBOL), '') AS QTYINSTOCK
-    FROM AD_ORG ORG, C_BPARTNER BP, C_BPARTNER_LOCATION BPADD, 
-    M_PRODUCT PR, C_UOM UO, 
-    C_ORDER O
-    LEFT JOIN AD_REF_LIST_V REFLISTV
-    ON REFLISTV.VALUE = O.DELIVERYRULE
-    LEFT JOIN C_BPARTNER_LOCATION DLOC
-    ON DLOC.C_BPARTNER_LOCATION_ID = O.DELIVERY_LOCATION_ID,
-    C_ORDERLINE OL
-    LEFT JOIN M_ATTRIBUTESETINSTANCE ASI
-    ON OL.M_ATTRIBUTESETINSTANCE_ID = ASI.M_ATTRIBUTESETINSTANCE_ID
-    LEFT JOIN M_STORAGE_DETAIL SD
-    ON OL.M_PRODUCT_ID = SD.M_PRODUCT_ID
-    AND OL.C_UOM_ID = SD.C_UOM_ID
-    AND COALESCE(OL.M_ATTRIBUTESETINSTANCE_ID, SD.M_ATTRIBUTESETINSTANCE_ID, '0') = COALESCE(SD.M_ATTRIBUTESETINSTANCE_ID, '0')
-    AND COALESCE(OL.M_PRODUCT_UOM_ID, '-1') = COALESCE(SD.M_PRODUCT_UOM_ID,'-1')
-    AND SD.M_LOCATOR_ID IN (SELECT LOC.M_LOCATOR_ID
-    FROM M_LOCATOR LOC
-    WHERE LOC.M_WAREHOUSE_ID = OL.M_WAREHOUSE_ID)
-    WHERE O.AD_ORG_ID = ORG.AD_ORG_ID
-    AND O.C_BPARTNER_ID = BP.C_BPARTNER_ID
-    AND O.C_BPARTNER_LOCATION_ID = BPADD.C_BPARTNER_LOCATION_ID
-    AND O.C_ORDER_ID = OL.C_ORDER_ID
-    AND O.DOCSTATUS = 'CO'
+    (
+      SELECT SUM(SD.QTYONHAND)
+      FROM M_STORAGE_DETAIL SD
+      WHERE SD.M_PRODUCT_ID = OL.M_PRODUCT_ID
+      AND SD.C_UOM_ID = OL.C_UOM_ID
+      AND COALESCE(SD.M_ATTRIBUTESETINSTANCE_ID, '0') = COALESCE(OL.M_ATTRIBUTESETINSTANCE_ID, SD.M_ATTRIBUTESETINSTANCE_ID, '0')
+      AND COALESCE(SD.M_PRODUCT_UOM_ID,'-1') = COALESCE(OL.M_PRODUCT_UOM_ID, '-1')
+      AND EXISTS (
+        SELECT 1
+        FROM M_LOCATOR LOC
+        WHERE LOC.M_LOCATOR_ID = SD.M_LOCATOR_ID
+        AND LOC.M_WAREHOUSE_ID = OL.M_WAREHOUSE_ID
+      )
+    ) || ' ' || COALESCE(TO_CHAR(UO.UOMSYMBOL), '') AS QTYINSTOCK
+    FROM C_ORDER O
+    JOIN AD_ORG ORG ON O.AD_ORG_ID = ORG.AD_ORG_ID
+    JOIN C_BPARTNER BP ON O.C_BPARTNER_ID = BP.C_BPARTNER_ID
+    JOIN C_BPARTNER_LOCATION BPADD ON O.C_BPARTNER_LOCATION_ID = BPADD.C_BPARTNER_LOCATION_ID
+    JOIN AD_REF_LIST_V REFLISTV ON O.DELIVERYRULE = REFLISTV.VALUE
+    LEFT JOIN C_BPARTNER_LOCATION DLOC ON O.DELIVERY_LOCATION_ID = DLOC.C_BPARTNER_LOCATION_ID
+    JOIN C_ORDERLINE OL ON O.C_ORDER_ID = OL.C_ORDER_ID
+    JOIN M_PRODUCT PR ON OL.M_PRODUCT_ID = PR.M_PRODUCT_ID
+    JOIN C_UOM UO ON OL.C_UOM_ID = UO.C_UOM_ID
+    LEFT JOIN M_ATTRIBUTESETINSTANCE ASI ON OL.M_ATTRIBUTESETINSTANCE_ID = ASI.M_ATTRIBUTESETINSTANCE_ID
+    WHERE O.DOCSTATUS = 'CO'
     AND O.ISSOTRX = 'Y'
-    AND OL.M_PRODUCT_ID = PR.M_PRODUCT_ID
-    AND OL.C_UOM_ID = UO.C_UOM_ID
-    AND EXISTS (SELECT 1
-    FROM C_ORDER ORD, C_ORDERLINE ORDL
-    WHERE ORD.C_ORDER_ID = O.C_ORDER_ID
-    AND ORD.C_ORDER_ID = ORDL.C_ORDER_ID
-    AND ORDL.QTYORDERED <> ORDL.QTYDELIVERED)
     AND REFLISTV.AD_REFERENCE_ID = '151'
     AND REFLISTV.AD_LANGUAGE = ?
     AND O.AD_CLIENT_ID IN ('1')
     AND O.AD_ORG_ID IN ('1')
+    AND EXISTS (
+      SELECT 1
+      FROM C_ORDERLINE ORDL
+      WHERE ORDL.C_ORDER_ID = O.C_ORDER_ID
+      AND ORDL.QTYORDERED <> ORDL.QTYDELIVERED
+    )
     AND 1=1
-    GROUP BY ORG.NAME, BP.NAME, O.DOCUMENTNO, O.POREFERENCE, O.DATEORDERED, O.DATEPROMISED,
-    REFLISTV.NAME, DLOC.NAME, BPADD.NAME, PR.NAME, ASI.DESCRIPTION, OL.M_ATTRIBUTESETINSTANCE_ID,
-    OL.QTYORDERED, UO.UOMSYMBOL, OL.QTYDELIVERED
     ORDER BY ORGNAME, BPNAME, DOCUMENTNO]]></Sql>
     <Parameter name="adLanguage"/>
     <Parameter name="adUserClient" type="replace" optional="true" after="O.AD_CLIENT_ID IN (" text="'1'"/>
--- a/modules/org.openbravo.utility.cleanup.log/referencedata/standard/Log_Clean_Up_Default_Configuration.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/modules/org.openbravo.utility.cleanup.log/referencedata/standard/Log_Clean_Up_Default_Configuration.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -44,6 +44,15 @@
     <hQLWhereClause>status = 'SUC'</hQLWhereClause>
     <truncateTable>false</truncateTable>
   </OBULOG_Config>
+  <OBULOG_Config id="EA8CE6BE20C54E01BCC30EF34366CF1B" identifier="M_Stock_Proposed">
+    <id>EA8CE6BE20C54E01BCC30EF34366CF1B</id>
+    <active>true</active>
+    <table id="FF80818132C964E30132C968F45B0008" entity-name="ADTable" identifier="M_Stock_Proposed"/>
+    <olderThan>15</olderThan>
+    <column xsi:nil="true"/>
+    <hQLWhereClause xsi:nil="true"/>
+    <truncateTable>false</truncateTable>
+  </OBULOG_Config>
   <ProcessRequest id="8E020D1888EA44B9941D7A8639E822D5" identifier="Log Clean Up Process - ">
     <id>8E020D1888EA44B9941D7A8639E822D5</id>
     <active>true</active>
--- a/src-core/src/org/openbravo/base/VariablesBase.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src-core/src/org/openbravo/base/VariablesBase.java	Fri Jun 10 09:44:44 2016 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2001-2015 Openbravo S.L.U.
+ * Copyright (C) 2001-2016 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -1430,7 +1430,7 @@
         sessionAttributes.put(attribute.toUpperCase(), value);
       }
     } catch (Exception e) {
-      log4j.error("setSessionObject error: " + attribute + ":..." + e);
+      log4j.error("setSessionObject error: " + attribute + ":...", e);
     }
   }
 
@@ -1477,7 +1477,7 @@
         sessionAttributes.clear();
       }
     } catch (Exception e) {
-      log4j.error("clearSession error " + e);
+      log4j.error("clearSession error ", e);
     }
     if (session != null) {
       if (!target.equals("")) {
--- a/src-db/database/model/tables/M_MATCHPO.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/src-db/database/model/tables/M_MATCHPO.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -87,6 +87,9 @@
       <foreign-key foreignTable="M_PRODUCT" name="M_MATCHPO_M_PRODUCT">
         <reference local="M_PRODUCT_ID" foreign="M_PRODUCT_ID"/>
       </foreign-key>
+      <index name="M_MATCHPO_INOUT" unique="false">
+        <index-column name="M_INOUTLINE_ID"/>
+      </index>
       <index name="M_MATCHPO_POSTED" unique="false">
         <index-column name="POSTED"/>
       </index>
--- a/src-db/database/sourcedata/AD_DATASET_TABLE.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/src-db/database/sourcedata/AD_DATASET_TABLE.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -238,6 +238,20 @@
 <!--0344031E4CE04681BCDBF0DD9B754EE6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--0344031E4CE04681BCDBF0DD9B754EE6--></AD_DATASET_TABLE>
 
+<!--05B928B0AF984A7EA7DF2ECA88A55015--><AD_DATASET_TABLE>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_DATASET_TABLE_ID><![CDATA[05B928B0AF984A7EA7DF2ECA88A55015]]></AD_DATASET_TABLE_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_TABLE_ID><![CDATA[861F0EA985C7422080911D45FB53F4F2]]></AD_TABLE_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--05B928B0AF984A7EA7DF2ECA88A55015-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--05B928B0AF984A7EA7DF2ECA88A55015--></AD_DATASET_TABLE>
+
 <!--05C7FEB1BBCE45F784AE4055FCEE44F1--><AD_DATASET_TABLE>
 <!--05C7FEB1BBCE45F784AE4055FCEE44F1-->  <AD_DATASET_TABLE_ID><![CDATA[05C7FEB1BBCE45F784AE4055FCEE44F1]]></AD_DATASET_TABLE_ID>
 <!--05C7FEB1BBCE45F784AE4055FCEE44F1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1357,6 +1371,20 @@
 <!--7CFBEA0FA0064F7F8DF23DD219B03789-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--7CFBEA0FA0064F7F8DF23DD219B03789--></AD_DATASET_TABLE>
 
+<!--7D215463E66D47B797EE08E8B3DCF68C--><AD_DATASET_TABLE>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_DATASET_TABLE_ID><![CDATA[7D215463E66D47B797EE08E8B3DCF68C]]></AD_DATASET_TABLE_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_TABLE_ID><![CDATA[79A893C3D71A4CCDACB34E4EBFC5124D]]></AD_TABLE_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--7D215463E66D47B797EE08E8B3DCF68C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--7D215463E66D47B797EE08E8B3DCF68C--></AD_DATASET_TABLE>
+
 <!--7DC6889096E111DDA4F6001B388C61A4--><AD_DATASET_TABLE>
 <!--7DC6889096E111DDA4F6001B388C61A4-->  <AD_DATASET_TABLE_ID><![CDATA[7DC6889096E111DDA4F6001B388C61A4]]></AD_DATASET_TABLE_ID>
 <!--7DC6889096E111DDA4F6001B388C61A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1525,6 +1553,20 @@
 <!--917173E696E111DDBBB9001B388C61A4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--917173E696E111DDBBB9001B388C61A4--></AD_DATASET_TABLE>
 
+<!--93073DF5D8804692ADA35B8D8294D13E--><AD_DATASET_TABLE>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_DATASET_TABLE_ID><![CDATA[93073DF5D8804692ADA35B8D8294D13E]]></AD_DATASET_TABLE_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_TABLE_ID><![CDATA[9072A1C049584DB69E4F42AE20B5CB66]]></AD_TABLE_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--93073DF5D8804692ADA35B8D8294D13E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--93073DF5D8804692ADA35B8D8294D13E--></AD_DATASET_TABLE>
+
 <!--94F730EAB19E4CB7B49A3BA90222BAE0--><AD_DATASET_TABLE>
 <!--94F730EAB19E4CB7B49A3BA90222BAE0-->  <AD_DATASET_TABLE_ID><![CDATA[94F730EAB19E4CB7B49A3BA90222BAE0]]></AD_DATASET_TABLE_ID>
 <!--94F730EAB19E4CB7B49A3BA90222BAE0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -6228,6 +6270,20 @@
 <!--BF1902C896E111DDB89F001B388C61A4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--BF1902C896E111DDB89F001B388C61A4--></AD_DATASET_TABLE>
 
+<!--C01869FB065B49EEB312915B62F3D63A--><AD_DATASET_TABLE>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_DATASET_TABLE_ID><![CDATA[C01869FB065B49EEB312915B62F3D63A]]></AD_DATASET_TABLE_ID>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_TABLE_ID><![CDATA[CBF045D2539A4249B091CCE4B1F5EEDB]]></AD_TABLE_ID>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--C01869FB065B49EEB312915B62F3D63A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--C01869FB065B49EEB312915B62F3D63A--></AD_DATASET_TABLE>
+
 <!--C10E382A89D74508AA429F407C35691D--><AD_DATASET_TABLE>
 <!--C10E382A89D74508AA429F407C35691D-->  <AD_DATASET_TABLE_ID><![CDATA[C10E382A89D74508AA429F407C35691D]]></AD_DATASET_TABLE_ID>
 <!--C10E382A89D74508AA429F407C35691D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -6341,6 +6397,20 @@
 <!--C9E9E59296DB11DDB70F001B388C61A4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--C9E9E59296DB11DDB70F001B388C61A4--></AD_DATASET_TABLE>
 
+<!--CC883417DB5048619519DDBAE5C0CA93--><AD_DATASET_TABLE>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_DATASET_TABLE_ID><![CDATA[CC883417DB5048619519DDBAE5C0CA93]]></AD_DATASET_TABLE_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_TABLE_ID><![CDATA[B7ABE839A5F64A39ADCEE86817AA272F]]></AD_TABLE_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--CC883417DB5048619519DDBAE5C0CA93-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CC883417DB5048619519DDBAE5C0CA93--></AD_DATASET_TABLE>
+
 <!--CDAC10B183BA4D66A12668319F7C02C6--><AD_DATASET_TABLE>
 <!--CDAC10B183BA4D66A12668319F7C02C6-->  <AD_DATASET_TABLE_ID><![CDATA[CDAC10B183BA4D66A12668319F7C02C6]]></AD_DATASET_TABLE_ID>
 <!--CDAC10B183BA4D66A12668319F7C02C6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -6523,6 +6593,20 @@
 <!--E3450F26994F48BAB0BCE2210D338F48-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--E3450F26994F48BAB0BCE2210D338F48--></AD_DATASET_TABLE>
 
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4--><AD_DATASET_TABLE>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_DATASET_TABLE_ID><![CDATA[E35DCDC3BC8F4B278A9681E7BE9CF6E4]]></AD_DATASET_TABLE_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_TABLE_ID><![CDATA[C2968EF014C146B99A0C136BA9D6331F]]></AD_TABLE_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E35DCDC3BC8F4B278A9681E7BE9CF6E4--></AD_DATASET_TABLE>
+
 <!--E57A3476773D48CA9ACAA26FAA4035DB--><AD_DATASET_TABLE>
 <!--E57A3476773D48CA9ACAA26FAA4035DB-->  <AD_DATASET_TABLE_ID><![CDATA[E57A3476773D48CA9ACAA26FAA4035DB]]></AD_DATASET_TABLE_ID>
 <!--E57A3476773D48CA9ACAA26FAA4035DB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -6720,6 +6804,19 @@
 <!--F6B8C8566CB54FC9830B496BB7974E83-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--F6B8C8566CB54FC9830B496BB7974E83--></AD_DATASET_TABLE>
 
+<!--F792D93E95134499B41B824C277505D2--><AD_DATASET_TABLE>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_DATASET_TABLE_ID><![CDATA[F792D93E95134499B41B824C277505D2]]></AD_DATASET_TABLE_ID>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F792D93E95134499B41B824C277505D2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_TABLE_ID><![CDATA[4E9F9B0D69AC4BC2874FD2B80B948704]]></AD_TABLE_ID>
+<!--F792D93E95134499B41B824C277505D2-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--F792D93E95134499B41B824C277505D2-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--F792D93E95134499B41B824C277505D2-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--F792D93E95134499B41B824C277505D2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F792D93E95134499B41B824C277505D2--></AD_DATASET_TABLE>
+
 <!--F89564ED2D4C4E9E8EDD69A9E67FC382--><AD_DATASET_TABLE>
 <!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_DATASET_TABLE_ID><![CDATA[F89564ED2D4C4E9E8EDD69A9E67FC382]]></AD_DATASET_TABLE_ID>
 <!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -6803,6 +6900,20 @@
 <!--FD9C2D26366C4968BC2F14D4D113DE6E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FD9C2D26366C4968BC2F14D4D113DE6E--></AD_DATASET_TABLE>
 
+<!--FF154D46360E4B379ED11D614E931CD9--><AD_DATASET_TABLE>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_DATASET_TABLE_ID><![CDATA[FF154D46360E4B379ED11D614E931CD9]]></AD_DATASET_TABLE_ID>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_DATASET_ID><![CDATA[D81C5C810AEF47C690E4F688ABC8AAC8]]></AD_DATASET_ID>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_TABLE_ID><![CDATA[8FF90F99857D4F0F842FE3B2C356E9B4]]></AD_TABLE_ID>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <WHERECLAUSE><![CDATA[client.id=:ClientID]]></WHERECLAUSE>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <EXCLUDEAUDITINFO><![CDATA[N]]></EXCLUDEAUDITINFO>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--FF154D46360E4B379ED11D614E931CD9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF154D46360E4B379ED11D614E931CD9--></AD_DATASET_TABLE>
+
 <!--FF8080812DE3BBBD012DE3C0B1AA0022--><AD_DATASET_TABLE>
 <!--FF8080812DE3BBBD012DE3C0B1AA0022-->  <AD_DATASET_TABLE_ID><![CDATA[FF8080812DE3BBBD012DE3C0B1AA0022]]></AD_DATASET_TABLE_ID>
 <!--FF8080812DE3BBBD012DE3C0B1AA0022-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 09 18:46:49 2016 +0200
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Fri Jun 10 09:44:44 2016 +0200
@@ -12096,16 +12096,16 @@
 iol.shipmentReceipt.businessPartner as businessPartner, iol.shipmentReceipt.documentNo as shipmentNumber,
 iol.shipmentReceipt.movementDate as movementDate,  attributeSetValue as attributeSetValue,
 (@returnedOthersLeftClause@)*(-1) as returnQtyOtherRM,
-(case when (select ('Y') from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) is null then false else true end) as obSelected,
+(case when (select ('Y') from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol) is null then false else true end) as obSelected,
 (@returnedLeftClause@)*(-1) as returned,
-(select ol.returnReason from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) as returnReason,
-coalesce((select ol.tax from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol) ,
+(select ol.returnReason from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol) as returnReason,
+coalesce((select ol.tax.id from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol) ,
 @taxSubQuery@) as tax,
 (case when @priceIncludeTaxSubQuery@ = true then
- coalesce((select ol.@unitPriceProperty@ from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), 
+ coalesce((select ol.@unitPriceProperty@ from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), 
           @grossUnitPriceSubQuery@)
 else 
- coalesce((select ol.@unitPriceProperty@ from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), 
+ coalesce((select ol.@unitPriceProperty@ from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), 
           @unitPriceSubQuery@)
 end) as unitPrice,
 @orderNoSubQuery@ as orderNo
--- a/src/org/openbravo/common/datasource/ReturnToFromCustomerVendorHQLTransformer.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src/org/openbravo/common/datasource/ReturnToFromCustomerVendorHQLTransformer.java	Fri Jun 10 09:44:44 2016 +0200
@@ -31,28 +31,28 @@
 
   private static final String returnToVendorTabId = "5A5CCFC8359B4D79BA705DC487FE8173";
 
-  private static final String rtv_unitPriceLeftClause = "(case when (select e.salesOrderLine.salesOrder.priceList.priceIncludesTax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol) = true then  coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (select e.salesOrderLine.grossUnitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)) else   coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (select e.salesOrderLine.unitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)) end)";
-  private static final String rtv_orderNoLeftClause = " coalesce ((select e.salesOrderLine.salesOrder.documentNo from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol), '')";
-  private static final String rfc_unitPriceLeftClause = "(case when (iol.salesOrderLine.salesOrder.priceList.priceIncludesTax) = true then  coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (iol.salesOrderLine.grossUnitPrice)) else   coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), (coalesce(iol.salesOrderLine.unitPrice,0))) end)";
+  private static final String rtv_unitPriceLeftClause = "(case when (select e.salesOrderLine.salesOrder.priceList.priceIncludesTax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol) = true then  coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), (select e.salesOrderLine.grossUnitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)) else   coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), (select e.salesOrderLine.unitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)) end)";
+  private static final String rtv_orderNoLeftClause = " coalesce ((select e.salesOrderLine.salesOrder.documentNo from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol), '')";
+  private static final String rfc_unitPriceLeftClause = "(case when (iol.salesOrderLine.salesOrder.priceList.priceIncludesTax) = true then  coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), (iol.salesOrderLine.grossUnitPrice)) else   coalesce((select ol.unitPrice from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), (coalesce(iol.salesOrderLine.unitPrice,0))) end)";
   private static final String rfc_orderNoLeftClause = " coalesce((select e.salesOrderLine.salesOrder.documentNo from MaterialMgmtShipmentInOutLine as e where e.id = iol), '')";
-  private static final String returnedLeftClause = " coalesce((select ol.orderedQuantity from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol),0)";
-  private static final String returnedOthersLeftClause = " coalesce((select sum(ol.orderedQuantity) from OrderLine as ol left join ol.salesOrder as o where ol.goodsShipmentLine = iol and o.processed = true and o.documentStatus <> 'VO'), 0)";
-  private static final String returnReasonLeftClause = " coalesce((select ol.returnReason.id from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), '')";
-  private static final String returnReasonLeftClause2 = " coalesce((select ol.returnReason.name from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine = iol), '')";
+  private static final String returnedLeftClause = " coalesce((select ol.orderedQuantity from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol),0)";
+  private static final String returnedOthersLeftClause = " coalesce((select sum(ol.orderedQuantity) from OrderLine as ol join ol.salesOrder as o where ol.goodsShipmentLine.id = iol and o.processed = true and o.documentStatus <> 'VO'), 0)";
+  private static final String returnReasonLeftClause = " coalesce((select ol.returnReason.id from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), '')";
+  private static final String returnReasonLeftClause2 = " coalesce((select ol.returnReason.name from OrderLine as ol where ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine.id = iol), '')";
   private static final String returnReasonCountQuery = " select count(distinct e.name) from ReturnReason as e where exists (select distinct ol.returnReason from OrderLine as ol where ol.returnReason = e and ol.salesOrder.id = :salesOrderId  and ol.goodsShipmentLine is not null) ";
   private static final String returnReasonDataQuery = " select distinct e, e.name from ReturnReason as e where exists (select distinct ol.returnReason from OrderLine as ol where ol.returnReason = e and ol.salesOrder.id = :salesOrderId and ol.goodsShipmentLine is not null) ";
   private static final String unitPriceProperty = "unitPrice";
   private static final String grossUnitPriceProperty = "grossUnitPrice";
 
-  private static final String rtv_orderNo = "(select e.salesOrderLine.salesOrder.documentNo from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)";
+  private static final String rtv_orderNo = "(select e.salesOrderLine.salesOrder.documentNo from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)";
   private static final String rfc_orderNo = "(select e.salesOrderLine.salesOrder.documentNo from MaterialMgmtShipmentInOutLine as e where e.id = iol)";
-  private static final String rtv_unitPrice = "(select e.salesOrderLine.unitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)";
+  private static final String rtv_unitPrice = "(select e.salesOrderLine.unitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)";
   private static final String rfc_unitPrice = "(select e.salesOrderLine.unitPrice from MaterialMgmtShipmentInOutLine as e where e.id = iol)";
-  private static final String rtv_grossUnitPrice = "(select e.salesOrderLine.grossUnitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)";
+  private static final String rtv_grossUnitPrice = "(select e.salesOrderLine.grossUnitPrice from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)";
   private static final String rfc_grossUnitPrice = "(select e.salesOrderLine.grossUnitPrice from MaterialMgmtShipmentInOutLine as e where e.id = iol)";
-  private static final String rtv_tax = "(select e.salesOrderLine.tax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)";
-  private static final String rfc_tax = "(select e.salesOrderLine.tax from MaterialMgmtShipmentInOutLine as e where e.id = iol)";
-  private static final String rtv_priceIncludeTax = "(select e.salesOrderLine.salesOrder.priceList.priceIncludesTax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine = iol)";
+  private static final String rtv_tax = "(select e.salesOrderLine.tax.id from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)";
+  private static final String rfc_tax = "(select e.salesOrderLine.tax.id from MaterialMgmtShipmentInOutLine as e where e.id = iol)";
+  private static final String rtv_priceIncludeTax = "(select e.salesOrderLine.salesOrder.priceList.priceIncludesTax from ProcurementPOInvoiceMatch as e where e.goodsShipmentLine.id = iol)";
   private static final String rfc_priceIncludeTax = "(select e.priceList.priceIncludesTax from Order as e where e.id = :salesOrderId)";
 
   @Override
--- a/src/org/openbravo/dal/core/OBInterceptor.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src/org/openbravo/dal/core/OBInterceptor.java	Fri Jun 10 09:44:44 2016 +0200
@@ -45,6 +45,7 @@
 import org.openbravo.base.structure.OrganizationEnabled;
 import org.openbravo.base.structure.Traceable;
 import org.openbravo.dal.security.SecurityChecker;
+import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.access.User;
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.common.enterprise.Organization;
@@ -351,16 +352,18 @@
     // the changes from currentState to the object. This happens slighlty later.
     final OBContext obContext = OBContext.getOBContext();
     final User currentUser = getCurrentUser();
-    log.debug("OBEvent for new object " + traceable.getClass().getName() + " user "
-        + currentUser.getName());
+    if (log.isDebugEnabled()) {
+      log.debug("OBEvent for new object " + traceable.getClass().getName() + " user "
+          + currentUser.getName());
+    }
 
     Client client = null;
     Organization org = null;
     if (traceable instanceof ClientEnabled || traceable instanceof OrganizationEnabled) {
-      // reread the client and organization
-      client = SessionHandler.getInstance()
-          .find(Client.class, obContext.getCurrentClient().getId());
-      org = SessionHandler.getInstance().find(Organization.class,
+      // Client and organization in context could have been created in another session, use proxies
+      // to set them. Note DalUtil.getId won't help here as objects are already loaded in memory
+      client = OBDal.getInstance().getProxy(Client.class, obContext.getCurrentClient().getId());
+      org = OBDal.getInstance().getProxy(Organization.class,
           obContext.getCurrentOrganization().getId());
     }
     final Date currentDate = new Date();
@@ -405,8 +408,10 @@
       return;
     }
     final User currentUser = getCurrentUser();
-    log.debug("OBEvent for updated object " + t.getClass().getName() + " user "
-        + currentUser.getName());
+    if (log.isDebugEnabled()) {
+      log.debug("OBEvent for updated object " + t.getClass().getName() + " user "
+          + currentUser.getName());
+    }
     for (int i = 0; i < propertyNames.length; i++) {
       if (PROPERTY_UPDATED.equals(propertyNames[i])) {
         currentState[i] = new Date();
@@ -426,11 +431,9 @@
     }
   }
 
-  // reads the current user from the database, note multiple reads
-  // will hit the session cache
+  /** Returns a proxy for current session's user without need of a DB query */
   private User getCurrentUser() {
-    return SessionHandler.getInstance()
-        .find(User.class, OBContext.getOBContext().getUser().getId());
+    return OBDal.getInstance().getProxy(User.class, OBContext.getOBContext().getUser().getId());
   }
 
   public Interceptor getInterceptorListener() {
--- a/src/org/openbravo/dal/security/EntityAccessChecker.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src/org/openbravo/dal/security/EntityAccessChecker.java	Fri Jun 10 09:44:44 2016 +0200
@@ -71,6 +71,7 @@
   private static final Logger log = Logger.getLogger(EntityAccessChecker.class);
 
   private static final String SELECTOR_REFERENCE = "95E2A8B50A254B2AAE6774B8C2F28120";
+  private static final String MULTI_SELECTOR_REFERENCE = "87E6CFF8F71548AFA33F181C317970B5";
   private static final String WINDOW_REFERENCE = "FF80818132D8F0F30132D9BC395D0038";
 
   // Table Access Level:
@@ -585,8 +586,8 @@
     String processesInList = createWhereInCondition(processes);
 
     String hql = "select p.referenceSearchKey from OBUIAPP_Parameter p where p.reference.id in('"
-        + WINDOW_REFERENCE + "','" + SELECTOR_REFERENCE + "') and p.obuiappProcess.id in ("
-        + processesInList + ")";
+        + WINDOW_REFERENCE + "','" + SELECTOR_REFERENCE + "','" + MULTI_SELECTOR_REFERENCE
+        + "') and p.obuiappProcess.id in (" + processesInList + ")";
     @SuppressWarnings("unchecked")
     final List<Reference> references = SessionHandler.getInstance().createQuery(hql).list();
 
@@ -609,7 +610,8 @@
       addEntitiesOfWindowReference(mp, window);
 
       // Selector reference is checked and added to derivedReadableEntities entities
-    } else if (SELECTOR_REFERENCE.equals(DalUtil.getId(ref.getParentReference()))) {
+    } else if (SELECTOR_REFERENCE.equals(DalUtil.getId(ref.getParentReference()))
+        || MULTI_SELECTOR_REFERENCE.equals(DalUtil.getId(ref.getParentReference()))) {
       addEntitiesOfSelectorReference(mp, ref);
     }
   }
--- a/src/org/openbravo/dal/service/OBDal.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src/org/openbravo/dal/service/OBDal.java	Fri Jun 10 09:44:44 2016 +0200
@@ -527,25 +527,21 @@
     return result;
   }
 
-  // TODO: this is maybe not the best location for this functionality??
   protected void setClientOrganization(Object o) {
     final OBContext obContext = OBContext.getOBContext();
+    // Client and organization in context could have been created in another session, use proxies
+    // to set them. Note DalUtil.getId won't help here as objects are already loaded in memory
+
     if (o instanceof ClientEnabled) {
       final ClientEnabled ce = (ClientEnabled) o;
-      // reread the client
       if (ce.getClient() == null) {
-        final Client client = SessionHandler.getInstance().find(Client.class,
-            obContext.getCurrentClient().getId());
-        ce.setClient(client);
+        ce.setClient(getProxy(Client.class, obContext.getCurrentClient().getId()));
       }
     }
     if (o instanceof OrganizationEnabled) {
       final OrganizationEnabled oe = (OrganizationEnabled) o;
-      // reread the client and organization
       if (oe.getOrganization() == null) {
-        final Organization org = SessionHandler.getInstance().find(Organization.class,
-            obContext.getCurrentOrganization().getId());
-        oe.setOrganization(org);
+        oe.setOrganization(getProxy(Organization.class, obContext.getCurrentOrganization().getId()));
       }
     }
   }
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java	Thu Jun 09 18:46:49 2016 +0200
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java	Fri Jun 10 09:44:44 2016 +0200
@@ -301,7 +301,7 @@
 
       ImportEntry importEntry = OBProvider.getInstance().get(ImportEntry.class);
       importEntry.setId(id);
-      importEntry.setRole(OBDal.getInstance().get(Role.class,
+      importEntry.setRole(OBDal.getInstance().getProxy(Role.class,
           OBContext.getOBContext().getRole().getId()));
       importEntry.setNewOBObject(true);
       importEntry.setImportStatus("Initial");