Merge temporary head for 3.0PR17Q2.3
authorRM packaging bot <staff.rm@openbravo.com>
Thu, 14 Sep 2017 12:03:42 +0000
changeset 32424 56162cb1470e
parent 32412 7c4e4b82c202 (diff)
parent 32423 e8e89db6c0ed (current diff)
child 32448 1509bbd77a82
child 32729 7bfe29345cb5
Merge temporary head for 3.0PR17Q2.3
.hgsigs
.hgtags
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.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.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java
modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentUtils.java
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.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.service.json/src/org/openbravo/service/json/DataToJsonConverter.java
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/org/openbravo/erpCommon/ad_actionButton/CreateFrom.java
src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Invoice_data.xsql
src/org/openbravo/erpCommon/ad_callouts/SL_InOutLine_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Locator.java
src/org/openbravo/erpCommon/ad_callouts/SL_Inventory_Product.java
src/org/openbravo/erpCommon/ad_callouts/SL_Movement_Product.java
--- a/.hgsigs	Wed Sep 13 06:39:31 2017 +0000
+++ b/.hgsigs	Thu Sep 14 12:03:42 2017 +0000
@@ -209,5 +209,12 @@
 fa51600e25b24b2eb3739898d293168ea94748a7 0 iEYEABECAAYFAlh/u8wACgkQCX/oGf+2qkPTnwCfZ29b107GdizLBcC+tzdP3HlnmUUAoN2kMLXvfTYSRLAQG/ziGm5P6kYA
 9753e90ea3e81f850f904feb531120b4e185394a 0 iEYEABECAAYFAliG6A8ACgkQCX/oGf+2qkPeeQCg6D9p++eslvzqEVlYK8RS0uzgZNsAoMELVWkte/AM/ilPxZ4vP37myscv
 a131c85d1d3d55b852f97622ce068baf80b7fe67 0 iEYEABECAAYFAli+qu8ACgkQCX/oGf+2qkNTOACfTznbhwkwUplXd8QjHIuJ7uBJdK4An3KWtbUrBZleCwS1xH3aa2n9p9bM
+ff9ea5ead18501d3c6d2f782e38e172be08f8106 0 iEYEABECAAYFAlkDMfYACgkQCX/oGf+2qkPbaACfXUmwNxLBVRvD7cvYA4LinaJkUzAAoI5N7GpMTNy/NYMXetEOhuwPfSO5
 3a7510a5ee0b43ac0a65e4eae9b089f42158bbe0 0 iEYEABECAAYFAljGfFgACgkQCX/oGf+2qkOgoQCgx3u3UhiV8NyyiBZLsFjlwicCp1EAoPAl4mZZ6/wURPq39Ef6Rtbe1BRb
+835355e0fdbd35df49b4b559a4ce984192350fd2 0 iEYEABECAAYFAlkVX0kACgkQCX/oGf+2qkMVEQCfasQyxkrJdtvkEP03xKFyiwAi2f0AnRRguCtQ0qKkra8Kg55F7/9oKS7p
+1ec47090dc22cda681ebf04a2ea7491b971bb24d 0 iEYEABECAAYFAllLmP4ACgkQCX/oGf+2qkMZvgCggmmfbWJEY/hgJWXzwmfsSEHcEzkAoMGb1VsoDMaU/TIjFRvnCRXoj7Eh
+58658da4e8fc26f50c49846910da9c4ff7afd417 0 iEYEABECAAYFAlmJYmkACgkQCX/oGf+2qkNQ2ACbBnQYMdCROIRP7KW2tYz46AeqPNgAn07znI+o6t4KIJPBnqy61/mf6hEc
+74c2ec78cab6580e2c5fd67e4c7913924339df58 0 iEYEABECAAYFAlkdU7MACgkQCX/oGf+2qkMs3wCguelDCm09norUvWOnB7m/+X66yyMAoKr/DzyFXmSZTrlta3cfBpn5BY6v
+0e959ce9b986f2770ac4ac02296a59adaafdc919 0 iEYEABECAAYFAllSJLwACgkQCX/oGf+2qkOkKACfWiWW37hMTW9d4fneU+4JJsG//LYAoLkOPDVyEZCTY/IpOEuXT0hHKE9e
+4bad64e9d7577310506e2e19cacba696ed703ad6 0 iEYEABECAAYFAlmKpMUACgkQCX/oGf+2qkNGywCgobMSxQWqAp5l5HsKqlQMPn8GkNsAoOBNizvazzb9wRiYA1/57ntgR253
 9e6056c0e38e4355acf8d72a8efab6575c7f9733 0 iEYEABECAAYFAlm40qMACgkQCX/oGf+2qkPKxgCgndqN2CnOSnbnZEsQntY+mUaqZZEAoK6Xl9Q4HbgHep6JG/owLOzyehRK
--- a/.hgtags	Wed Sep 13 06:39:31 2017 +0000
+++ b/.hgtags	Thu Sep 14 12:03:42 2017 +0000
@@ -220,5 +220,12 @@
 b93f495b2cde680cf6558d93d72051429f4b9031 3.0PR16Q4.1
 31c79a32ce3a6b555dadb35c70d63113be6312e7 3.0PR16Q4.2
 eaeb76d8cd4ec1caf5bf43bc9b4111424d799a03 3.0PR16Q4.3
+3995bf60960bff841f256fa98746aa6aa0f642f2 3.0PR16Q4.4
 273c24deef8f21e870cf563073cc653582a9fe9e 3.0PR17Q1
+10c0ffee4e6ccca6771d151dd27f706e50cf4b96 3.0PR17Q1.1
+a2e2a8540b6e64102d4e019efc36ad05c7f43b24 3.0PR17Q1.2
+07a679139b1b9f7544e3d0954fd77b3a2aa8ed04 3.0PR17Q1.3
+7fd66b51c666e341168a7e5a036f7ac25a86eec9 3.0PR17Q2
+c37991aee21566d0ed397369377abdaeaf1a6f52 3.0PR17Q2.1
+632ba9b2ee8c8133be5b483482d3d99a83b4138f 3.0PR17Q2.2
 7fafd2a9f24bd0d5889253005412101631cc1efe 3.0PR17Q2.3
--- a/build.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/build.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2001-2015 Openbravo SLU
+* All portions are Copyright (C) 2001-2017 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -485,7 +485,7 @@
                            property="test.md5.wad"/>
   </target>
 
-  <target name="compile.complete.development" depends="init" unless="mode.war">
+  <target name="compile.complete.development" depends="init, core.lib, wad.lib, trl.lib" unless="mode.war">
     <updatesystemstatus v="RB43"/>
     <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
   </target>
--- a/legal/Licensing.txt	Wed Sep 13 06:39:31 2017 +0000
+++ b/legal/Licensing.txt	Thu Sep 14 12:03:42 2017 +0000
@@ -3,7 +3,7 @@
 This license file applies to the Openbravo ERP software (the "Openbravo
 Software"), except as described below.
 
-This product is Copyright 2001-2016 Openbravo S.L.U.  For other detailed notice,
+This product is Copyright 2001-2017 Openbravo S.L.U.  For other detailed notice,
 see the "NOTICE" file with this distribution.
 
 This product is free software; you can redistribute it and/or modify
--- a/lib/README	Wed Sep 13 06:39:31 2017 +0000
+++ b/lib/README	Thu Sep 14 12:03:42 2017 +0000
@@ -1,3 +1,4 @@
 When adding or removing libraries to Openbravo ERP please update this page
 with your changes:
 http://wiki.openbravo.com/wiki/Openbravo_Libraries
+
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -489,6 +489,8 @@
                 WHERE fin_payment_scheduledetail_id = v_scheduledetailid;
 
                 v_scheduledetailamount := v_scheduledetailamount - v_differenceamount;
+              ELSE
+                v_differenceamount := 0;
               END IF;
 
               IF (v_differenceamount = 0 OR (v_count <> 0 AND NOT v_psdbreakbypartialpayment)) THEN
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_SEQNUMBERPAYMENTSTATUS.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_SEQNUMBERPAYMENTSTATUS.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -16,7 +16,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) 2014 Openbravo SLU
+* All portions are Copyright (C) 2014-2017 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -25,6 +25,7 @@
   v_referencelist VARCHAR2(32):='575BCB88A4694C27BC013DE9C73E6FE7';
 
 BEGIN
+
   -- Check if the status exists
   SELECT count(*) INTO v_count FROM DUAL
   WHERE EXISTS (SELECT 1 FROM ad_ref_list
@@ -32,7 +33,8 @@
                       AND value = status);
 
   IF (v_count = 0) THEN
-    RETURN 'N';
+    -- If status is null, return minimum value for invoice paid status (RPR or PPM)
+    RETURN '40';
   END IF;
   
   SELECT seqno 
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <NAME><![CDATA[Advanced Payables and Receivables Mngmt]]></NAME>
-<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION><![CDATA[3.0.31811]]></VERSION>
+<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION><![CDATA[3.0.32382]]></VERSION>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <DESCRIPTION><![CDATA[Managing your finances with an ERP does not have to be difficult. Enjoy a radically improved user experience that combines the power of an enterprise grade financial application with the simplicity and ease of a web 2.0 personal accounting service.]]></DESCRIPTION>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <HELP><![CDATA[Advanced Payables and Receivables Management simplifies and automates the business processes around the management of financial accounts, from the receipt and issue of payment, to the reconciliation of those events with bank statements.
 If you would like to help shape this module you are welcome to take part in the forum discussions or register feature requests or issues in the corresponding (Forum and Bug Tracking) sections in the Advanced Payables and Receivable project in the OB Forge.]]></HELP>
@@ -25,7 +25,7 @@
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <UPDATEINFO><![CDATA[Fixed issue with document sequence numbers reset in case of applying dataset second time.
 Fixed issue 15305.]]></UPDATEINFO>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <REFERENCEDATAINFO><![CDATA[Document types and default algorithm for bank statement auto matching]]></REFERENCEDATAINFO>
-<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--A918E3331C404B889D69AA9BFAFB23AC-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--A918E3331C404B889D69AA9BFAFB23AC--></AD_MODULE>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <AD_DEPENDENT_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_DEPENDENT_MODULE_ID>
-<!--89326AE95DAD449D85DFAB2C5B1C6683-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--89326AE95DAD449D85DFAB2C5B1C6683-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Selector]]></DEPENDANT_MODULE_NAME>
 <!--89326AE95DAD449D85DFAB2C5B1C6683-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--B97FC854C6DD41E692161585645A900F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--B97FC854C6DD41E692161585645A900F-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--B97FC854C6DD41E692161585645A900F-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--B97FC854C6DD41E692161585645A900F-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--B97FC854C6DD41E692161585645A900F-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--B97FC854C6DD41E692161585645A900F-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--B97FC854C6DD41E692161585645A900F-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--B97FC854C6DD41E692161585645A900F-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PREFERENCE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PREFERENCE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -55,61 +55,6 @@
 <!--9B4A5EB695FEA841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--9B4A5EB695FEA841E040A8C0E1077381--></AD_PREFERENCE>
 
-<!--9B4A5EB69751A841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB69751A841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcess3C4A5FB206B74C3CA9FE20116FCA0464]]></ATTRIBUTE>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB69751A841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9B4A5EB69751A841E040A8C0E1077381--></AD_PREFERENCE>
-
-<!--9B4A5EB69752A841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB69752A841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcess4A059E4F79294640AD37B1B718C56E5D]]></ATTRIBUTE>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB69752A841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9B4A5EB69752A841E040A8C0E1077381--></AD_PREFERENCE>
-
-<!--9B4A5EB69756A841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB69756A841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcessBBA11D1A061346459AF6148920FE6629]]></ATTRIBUTE>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB69756A841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9B4A5EB69756A841E040A8C0E1077381--></AD_PREFERENCE>
-
-<!--9B4A5EB69758A841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB69758A841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcessD5B90B539C254B959045EDCA1DC99BDF]]></ATTRIBUTE>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB69758A841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9B4A5EB69758A841E040A8C0E1077381--></AD_PREFERENCE>
-
-<!--9B4A5EB6975CA841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB6975CA841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcessE54287EE357C493EB127DC3BA1758751]]></ATTRIBUTE>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB6975CA841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9B4A5EB6975CA841E040A8C0E1077381--></AD_PREFERENCE>
-
 <!--C2250516BAB0443AA56D758F10186E09--><AD_PREFERENCE>
 <!--C2250516BAB0443AA56D758F10186E09-->  <AD_PREFERENCE_ID><![CDATA[C2250516BAB0443AA56D758F10186E09]]></AD_PREFERENCE_ID>
 <!--C2250516BAB0443AA56D758F10186E09-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TAB.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TAB.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -90,7 +90,7 @@
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <UIPATTERN><![CDATA[RO]]></UIPATTERN>
-<!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <HQLWHERECLAUSE><![CDATA[e.status in ('RPR', 'PPM') and e.amount <>0 and exists ( select 1 from FinancialMgmtFinAccPaymentMethod as  fapm join fapm.account as fa where fapm.paymentMethod = e.paymentMethod and fa.id = @FIN_Financial_Account.id@ and (case when e.receipt = true then fapm.payinAllow else fapm.payoutAllow end) = true and fa.currency = e.account.currency) and not exists (select 1 from FIN_Finacc_Transaction as ft where e = ft.finPayment) and AD_ISORGINCLUDED(e.organization.id, @FIN_Financial_Account.organization@, e.client.id)<>-1]]></HQLWHERECLAUSE>
+<!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <HQLWHERECLAUSE><![CDATA[e.status in ('RPR', 'PPM') and e.amount <> 0 and exists (select 1 from FinancialMgmtFinAccPaymentMethod as fapm join fapm.account as fa where fapm.paymentMethod = e.paymentMethod and fa.id = @FIN_Financial_Account.id@ and (case when e.receipt = true then fapm.payinAllow else fapm.payoutAllow end) = true and fa.currency = e.account.currency) and not exists (select 1 from FIN_Finacc_Transaction as ft where e = ft.finPayment) and exists (select 1 from OrganizationTree as ot where ot.organization.id = e.organization.id and ot.parentOrganization.id = @FIN_Financial_Account.organization@ and ot.client.id = e.client.id)]]></HQLWHERECLAUSE>
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <HQLORDERBYCLAUSE><![CDATA[paymentDate, documentNo]]></HQLORDERBYCLAUSE>
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <HQLFILTERCLAUSE><![CDATA[e.account.id = @FIN_Financial_Account.id@]]></HQLFILTERCLAUSE>
 <!--2700A962BC484D4C9B3E30B1C3C66BFB-->  <FILTERNAME><![CDATA[Payments are filtered by the selected Financial Account]]></FILTERNAME>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -1841,6 +1841,7 @@
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <OBUIAPP_PROCESS_ID><![CDATA[CC73C4845CDC487395804946EACB225F]]></OBUIAPP_PROCESS_ID>
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <STARTINNEWLINE><![CDATA[Y]]></STARTINNEWLINE>
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <DISPLAYLOGIC><![CDATA[(@c_currency_to_id@ ! @c_currency_from_id@) & @c_currency_to_id@!undefined]]></DISPLAYLOGIC>
+<!--BF4F039785D24BA6B93A2494B89F0C47-->  <READONLYLOGIC><![CDATA[OB.PropertyStore.get('NotAllowChangeExchange')='Y']]></READONLYLOGIC>
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--BF4F039785D24BA6B93A2494B89F0C47-->  <ATT_SHOWINDESCRIPTION><![CDATA[N]]></ATT_SHOWINDESCRIPTION>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Thu Sep 14 12:03:42 2017 +0000
@@ -405,10 +405,8 @@
 
               // Updating dummy payment lines with invoice and reverse invoice
               for (FIN_PaymentScheduleDetail fpsd : psdQuery.list()) {
-
-                // Invoice payment detail associated to the order
-                FIN_PaymentDetail invoiceFPDOrder = fpsd.getPaymentDetails();
-                FIN_PaymentSchedule orderPaymentSchedule = fpsd.getOrderPaymentSchedule();
+                // invoice payment detail asociated to the order
+                boolean invoiceFPDOrder = fpsd.getPaymentDetails() != null;
 
                 // Create a payment detail
                 FIN_PaymentDetail pd = OBProvider.getInstance().get(FIN_PaymentDetail.class);
@@ -427,36 +425,22 @@
 
                 dummyPayment.getFINPaymentDetailList().add(pd);
 
-                if (invoiceFPDOrder != null) {
+                if (invoiceFPDOrder) {
                   StringBuilder orderPSDHQLQuery = new StringBuilder();
                   orderPSDHQLQuery.append(" as fpsd");
                   orderPSDHQLQuery.append(" join fpsd.paymentDetails fpd");
                   orderPSDHQLQuery.append(" where fpd.finPayment.id = :paymentId");
                   orderPSDHQLQuery.append(" and fpsd.id <> :invoicePSDId");
-                  orderPSDHQLQuery.append(" and fpsd.invoicePaymentSchedule is null");
                   OBQuery<FIN_PaymentScheduleDetail> orderPSDQuery = OBDal.getInstance()
                       .createQuery(FIN_PaymentScheduleDetail.class, orderPSDHQLQuery.toString());
-                  orderPSDQuery.setNamedParameter("paymentId", invoiceFPDOrder.getFinPayment()
-                      .getId());
+                  orderPSDQuery.setNamedParameter("paymentId", orderPayment.getId());
                   orderPSDQuery.setNamedParameter("invoicePSDId", fpsd.getId());
-                  orderPSDQuery.setMaxResult(1);
-                  FIN_PaymentScheduleDetail orderPSD = orderPSDQuery.uniqueResult();
 
-                  if (orderPSD == null) {
-                    // Order with no payment schedule detail, create a new one
-                    orderPSD = OBProvider.getInstance().get(FIN_PaymentScheduleDetail.class);
-                    orderPSD.setOrganization(fpsd.getOrganization());
-                    orderPSD.setAmount(fpsd.getAmount());
-                    orderPSD.setBusinessPartner(fpsd.getBusinessPartner());
-                    orderPSD.setPaymentDetails(invoiceFPDOrder);
-                    orderPSD.setOrderPaymentSchedule(orderPaymentSchedule);
-                  } else {
+                  for (FIN_PaymentScheduleDetail orderPSD : orderPSDQuery.list()) {
                     // Update order received amount
                     orderPSD.setAmount(orderPSD.getAmount().add(fpsd.getAmount()));
+                    OBDal.getInstance().save(orderPSD);
                   }
-                  OBDal.getInstance().save(orderPSD);
-
-                  // Update invoice payment schedule
                   FIN_PaymentSchedule ps = fpsd.getInvoicePaymentSchedule();
                   ps.setPaidAmount(BigDecimal.ZERO);
                   ps.setOutstandingAmount(fpsd.getAmount());
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Thu Sep 14 12:03:42 2017 +0000
@@ -1152,6 +1152,7 @@
    *          Payment amount
    */
   private void updateCustomerCredit(BusinessPartner businessPartner, BigDecimal amount, boolean add) {
+    OBDal.getInstance().refresh(businessPartner);
     BigDecimal creditUsed = businessPartner.getCreditUsed();
     if (add) {
       creditUsed = creditUsed.add(amount);
@@ -1160,7 +1161,7 @@
     }
     businessPartner.setCreditUsed(creditUsed);
     OBDal.getInstance().save(businessPartner);
-    // OBDal.getInstance().flush();
+    OBDal.getInstance().flush();
   }
 
   private void increaseCustomerCredit(BusinessPartner businessPartner, BigDecimal amount) {
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-findTransaction.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-findTransaction.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2014-2016 Openbravo SLU
+ * All portions are Copyright (C) 2014-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -34,16 +34,16 @@
     var i, trxSelection = view.getContextInfo().findtransactiontomatch._selection;
 
     if (trxSelection && trxSelection[0]) {
-      var totalTrxAmt = 0,
-          blineAmt = view.callerField.record.amount,
+      var totalTrxAmt = BigDecimal.prototype.ZERO,
+          blineAmt = new BigDecimal(String(view.callerField.record.amount)),
           hideSplitConfirmation = OB.PropertyStore.get('APRM_MATCHSTATEMENT_HIDE_PARTIALMATCH_POPUP', view.windowId);
       for (i = 0; i < trxSelection.length; i++) {
-        var trxDepositAmt = trxSelection[i].depositAmount,
-            trxPaymentAmt = trxSelection[i].paymentAmount,
-            trxAmt = trxDepositAmt - trxPaymentAmt;
-        totalTrxAmt = totalTrxAmt + trxAmt;
+        var trxDepositAmt = new BigDecimal(String(trxSelection[i].depositAmount)),
+            trxPaymentAmt = new BigDecimal(String(trxSelection[i].paymentAmount)),
+            trxAmt = trxDepositAmt.subtract(trxPaymentAmt);
+        totalTrxAmt = totalTrxAmt.add(trxAmt);
       }
-      if (totalTrxAmt !== blineAmt) {
+      if (totalTrxAmt.compareTo(blineAmt) !== 0) {
         // Split required
         if (hideSplitConfirmation === 'Y') {
           // Continue with the match
Binary file modules/org.openbravo.apachejdbcconnectionpool/lib/runtime/tomcat-jdbc.jar has changed
--- a/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--8A098711BB324335A19833286BDB093D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--8A098711BB324335A19833286BDB093D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8A098711BB324335A19833286BDB093D-->  <NAME><![CDATA[Apache External Connection Pool]]></NAME>
-<!--8A098711BB324335A19833286BDB093D-->  <VERSION><![CDATA[1.0.31811]]></VERSION>
+<!--8A098711BB324335A19833286BDB093D-->  <VERSION><![CDATA[1.0.32382]]></VERSION>
 <!--8A098711BB324335A19833286BDB093D-->  <DESCRIPTION><![CDATA[Apache External Connection Pool]]></DESCRIPTION>
 <!--8A098711BB324335A19833286BDB093D-->  <HELP><![CDATA[This module implements the Apache JDBC Connection Pool (http://wiki.openbravo.com/wiki/Modules:Apache_JDBC_Connection_Pool).]]></HELP>
 <!--8A098711BB324335A19833286BDB093D-->  <TYPE><![CDATA[M]]></TYPE>
@@ -20,7 +20,7 @@
 <!--8A098711BB324335A19833286BDB093D-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--8A098711BB324335A19833286BDB093D-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--8A098711BB324335A19833286BDB093D-->  <UPDATEINFO><![CDATA[fixed issue #26663: configuration is read from servlet context]]></UPDATEINFO>
-<!--8A098711BB324335A19833286BDB093D-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--8A098711BB324335A19833286BDB093D-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--8A098711BB324335A19833286BDB093D-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--8A098711BB324335A19833286BDB093D-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--8A098711BB324335A19833286BDB093D--></AD_MODULE>
--- a/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <AD_MODULE_ID><![CDATA[8A098711BB324335A19833286BDB093D]]></AD_MODULE_ID>
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <AD_DEPENDENT_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_DEPENDENT_MODULE_ID>
-<!--1467C397BC5F4999A5606F39CD6FF8A4-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--1467C397BC5F4999A5606F39CD6FF8A4-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <DEPENDANT_MODULE_NAME><![CDATA[Openbravo 3.0 Framework]]></DEPENDANT_MODULE_NAME>
 <!--1467C397BC5F4999A5606F39CD6FF8A4-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/JdbcExternalConnectionPool.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.apachejdbcconnectionpool/src/org/openbravo/apachejdbcconnectionpool/JdbcExternalConnectionPool.java	Thu Sep 14 12:03:42 2017 +0000
@@ -18,7 +18,6 @@
  */
 package org.openbravo.apachejdbcconnectionpool;
 
-import java.lang.management.ManagementFactory;
 import java.sql.Connection;
 import java.util.HashMap;
 import java.util.List;
@@ -26,9 +25,6 @@
 import java.util.Map.Entry;
 import java.util.Properties;
 
-import javax.management.InstanceAlreadyExistsException;
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
@@ -38,9 +34,9 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.base.session.SessionFactoryController;
-import org.openbravo.dal.core.DalContextListener;
 import org.openbravo.database.ExternalConnectionPool;
 import org.openbravo.database.PoolInterceptorProvider;
+import org.openbravo.jmx.MBeanRegistry;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -163,25 +159,9 @@
       DataSource ds = dse.getValue();
       try {
         if (ds.isJmxEnabled()) {
-          String context = "";
-          if (DalContextListener.getServletContext() != null) {
-            context = "context="
-                + DalContextListener.getServletContext().getContextPath().replace("/", "") + ",";
-          }
-
           // pool needs to be created before it's registered
           ds.createPool();
-          MBeanServer mbs = null;
-          mbs = ManagementFactory.getPlatformMBeanServer();
-          try {
-            ObjectName name = new ObjectName("Openbravo:" + context + "name=Pool-" + dse.getKey());
-            mbs.registerMBean(ds.getPool().getJmxPool(), name);
-          } catch (InstanceAlreadyExistsException alreadyRegistered) {
-            log.debug("JMX instance already registred for pool {}, bean name: {}", dse.getKey(),
-                alreadyRegistered.getMessage());
-          } catch (Exception ignored) {
-            log.error("Could not register {} pool as jmx bean", dse.getKey(), ignored);
-          }
+          MBeanRegistry.registerMBean("Pool-" + dse.getKey(), ds.getPool().getJmxPool());
         }
       } catch (Exception e) {
         log.error("Error creating pool {}", dse.getKey(), e);
@@ -298,6 +278,9 @@
     if (getStringProperty(props, "db.pool.logAbandoned", poolName) != null) {
       poolProperties.setLogAbandoned(getBooleanProperty(props, "db.pool.logAbandoned", poolName));
     }
+    if (getStringProperty(props, "db.pool.suspectTimeout", poolName) != null) {
+      poolProperties.setSuspectTimeout(getIntProperty(props, "db.pool.suspectTimeout", poolName));
+    }
     if (getStringProperty(props, "db.pool.testOnConnect", poolName) != null) {
       poolProperties.setTestOnConnect(getBooleanProperty(props, "db.pool.testOnConnect", poolName));
     }
@@ -322,12 +305,6 @@
     if (getStringProperty(props, "db.pool.jmxEnabled", poolName) != null) {
       poolProperties.setJmxEnabled(getBooleanProperty(props, "db.pool.jmxEnabled", poolName));
     }
-    if (getStringProperty(props, "db.pool.logAbandoned", poolName) != null) {
-      poolProperties.setLogAbandoned(getBooleanProperty(props, "db.pool.logAbandoned", poolName));
-    }
-    if (getStringProperty(props, "db.pool.suspectTimeout", poolName) != null) {
-      poolProperties.setSuspectTimeout(getIntProperty(props, "db.pool.suspectTimeout", poolName));
-    }
     return poolProperties;
   }
 
--- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <NAME><![CDATA[JBoss Weld]]></NAME>
-<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION><![CDATA[1.1.31811]]></VERSION>
+<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION><![CDATA[1.1.32382]]></VERSION>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <DESCRIPTION><![CDATA[JBoss Weld]]></DESCRIPTION>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <HELP><![CDATA[Provides the JBoss Weld framework: Java Contexts and Dependency Injection for the Java EE platform (CDI). For more information see http://seamframework.org/Weld]]></HELP>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <URL><![CDATA[http://forge.openbravo.com/projects/weld]]></URL>
@@ -22,7 +22,7 @@
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <UPDATEINFO><![CDATA[Bug fixing.]]></UPDATEINFO>
-<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--C70732EA90A14EC0916078B85CC33D2D-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--C70732EA90A14EC0916078B85CC33D2D--></AD_MODULE>
--- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <AD_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_MODULE_ID>
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME>
 <!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/WeldBaseTest.java	Thu Sep 14 12:03:42 2017 +0000
@@ -94,6 +94,9 @@
   private BeanManager beanManager;
 
   @Inject
+  private WeldUtils weldUtils;
+
+  @Inject
   private KernelInitializer kernelInitializer;
 
   /**
@@ -110,6 +113,7 @@
     if (!initialized) {
       WeldUtils.setStaticInstanceBeanManager(beanManager);
       kernelInitializer.setInterceptor();
+      weldUtils.setBeanManager(beanManager);
       initialized = true;
     }
     super.setUp();
--- a/modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -139,4 +139,12 @@
     }
     return instances;
   }
+
+  /**
+   * Sets bean manager. The purpose of this setter is to be used just in jUnit test cases. When
+   * working within a container, bean manager should be handled by container.
+   */
+  public void setBeanManager(BeanManager beanManager) {
+    this.beanManager = beanManager;
+  }
 }
--- a/modules/org.openbravo.client.application/src-db/database/model/tables/OBUIAPP_NAVBAR_COMPONENT.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/model/tables/OBUIAPP_NAVBAR_COMPONENT.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -61,6 +61,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="ISSTATICCOMPONENT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="OBUIAPP_T_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -80,5 +84,6 @@
       </unique>
       <check name="OBUIAPP_ALLROLES_CHECK"><![CDATA[ALLROLES IN ('Y', 'N')]]></check>
       <check name="OBUIAPP_CT_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="OBUIAPP_NAVBAR_COMPONT_STATIC"><![CDATA[ISSTATICCOMPONENT IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_COLUMN.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_COLUMN.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -1313,6 +1313,45 @@
 <!--1593FFD78DB544FE84B647F803900C37-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--1593FFD78DB544FE84B647F803900C37--></AD_COLUMN>
 
+<!--1607384316B843BFA61D43E41D7EC171--><AD_COLUMN>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_COLUMN_ID><![CDATA[1607384316B843BFA61D43E41D7EC171]]></AD_COLUMN_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <NAME><![CDATA[Isstaticcomponent]]></NAME>
+<!--1607384316B843BFA61D43E41D7EC171-->  <DESCRIPTION><![CDATA[Defines whether a navigation bar component is static or not.]]></DESCRIPTION>
+<!--1607384316B843BFA61D43E41D7EC171-->  <HELP><![CDATA[Defines whether a navigation bar component is static or not. Static components are generated in the same request of the session dynamic resources. Non static components requires an extra request call to generate its content.]]></HELP>
+<!--1607384316B843BFA61D43E41D7EC171-->  <COLUMNNAME><![CDATA[Isstaticcomponent]]></COLUMNNAME>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_TABLE_ID><![CDATA[6EDC4A262444493BAE672E7E144A36F7]]></AD_TABLE_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--1607384316B843BFA61D43E41D7EC171-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--1607384316B843BFA61D43E41D7EC171-->  <SEQNO><![CDATA[160]]></SEQNO>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_ELEMENT_ID><![CDATA[C1AA24FDF3714201BD68237D38243ACA]]></AD_ELEMENT_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--1607384316B843BFA61D43E41D7EC171-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--1607384316B843BFA61D43E41D7EC171-->  <POSITION><![CDATA[16]]></POSITION>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--1607384316B843BFA61D43E41D7EC171-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--1607384316B843BFA61D43E41D7EC171-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
+<!--1607384316B843BFA61D43E41D7EC171--></AD_COLUMN>
+
 <!--16B673DBB07D41D1BEB97E7D18A44DD9--><AD_COLUMN>
 <!--16B673DBB07D41D1BEB97E7D18A44DD9-->  <AD_COLUMN_ID><![CDATA[16B673DBB07D41D1BEB97E7D18A44DD9]]></AD_COLUMN_ID>
 <!--16B673DBB07D41D1BEB97E7D18A44DD9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -795,6 +795,20 @@
 <!--BAF19AAC391C420E9BA1E54641D563D9-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--BAF19AAC391C420E9BA1E54641D563D9--></AD_ELEMENT>
 
+<!--C1AA24FDF3714201BD68237D38243ACA--><AD_ELEMENT>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <AD_ELEMENT_ID><![CDATA[C1AA24FDF3714201BD68237D38243ACA]]></AD_ELEMENT_ID>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <COLUMNNAME><![CDATA[Isstaticcomponent]]></COLUMNNAME>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <NAME><![CDATA[Static Component]]></NAME>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <PRINTNAME><![CDATA[Static Component]]></PRINTNAME>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <DESCRIPTION><![CDATA[Defines whether a navigation bar component is static or not.]]></DESCRIPTION>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <HELP><![CDATA[Defines whether a navigation bar component is static or not. Static components are generated in the same request of the session dynamic resources. Non static components requires an extra request call to generate its content.]]></HELP>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--C1AA24FDF3714201BD68237D38243ACA-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--C1AA24FDF3714201BD68237D38243ACA--></AD_ELEMENT>
+
 <!--C39954911E27408CBF8F44743A1A0F51--><AD_ELEMENT>
 <!--C39954911E27408CBF8F44743A1A0F51-->  <AD_ELEMENT_ID><![CDATA[C39954911E27408CBF8F44743A1A0F51]]></AD_ELEMENT_ID>
 <!--C39954911E27408CBF8F44743A1A0F51-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_FIELD.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_FIELD.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -2670,7 +2670,7 @@
 <!--3813306379C949A6A78A775E3130B2AB-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--3813306379C949A6A78A775E3130B2AB-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--3813306379C949A6A78A775E3130B2AB-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--3813306379C949A6A78A775E3130B2AB-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--3813306379C949A6A78A775E3130B2AB-->  <SEQNO><![CDATA[90]]></SEQNO>
 <!--3813306379C949A6A78A775E3130B2AB-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--3813306379C949A6A78A775E3130B2AB-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--3813306379C949A6A78A775E3130B2AB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -7964,6 +7964,34 @@
 <!--E649C05D297F48C3B55C8F93991AE2C5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--E649C05D297F48C3B55C8F93991AE2C5--></AD_FIELD>
 
+<!--E6F5AFAE18DD408B817977955778E81B--><AD_FIELD>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_FIELD_ID><![CDATA[E6F5AFAE18DD408B817977955778E81B]]></AD_FIELD_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <NAME><![CDATA[Static Component]]></NAME>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <DESCRIPTION><![CDATA[Defines whether a navigation bar component is static or not.]]></DESCRIPTION>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <HELP><![CDATA[Defines whether a navigation bar component is static or not. Static components are generated in the same request of the session dynamic resources. Non static components requires an extra request call to generate its content.]]></HELP>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_TAB_ID><![CDATA[25EB9212730C4E88B95C75BFCD6F5EBF]]></AD_TAB_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_COLUMN_ID><![CDATA[1607384316B843BFA61D43E41D7EC171]]></AD_COLUMN_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--E6F5AFAE18DD408B817977955778E81B-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--E6F5AFAE18DD408B817977955778E81B--></AD_FIELD>
+
 <!--E78C1117FDE742F8A566278AD2E0591C--><AD_FIELD>
 <!--E78C1117FDE742F8A566278AD2E0591C-->  <AD_FIELD_ID><![CDATA[E78C1117FDE742F8A566278AD2E0591C]]></AD_FIELD_ID>
 <!--E78C1117FDE742F8A566278AD2E0591C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <NAME><![CDATA[User Interface Application]]></NAME>
-<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION><![CDATA[2.1.31811]]></VERSION>
+<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION><![CDATA[2.1.32382]]></VERSION>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <DESCRIPTION><![CDATA[Provides the main application components for the openbravo user interface]]></DESCRIPTION>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <HELP><![CDATA[Provides the main application components for the openbravo user interface. The main layout incorporates a navigation bar and a main view area.]]></HELP>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <URL><![CDATA[http://forge.openbravo.com/projects/clientapplication]]></URL>
@@ -22,7 +22,7 @@
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <UPDATEINFO><![CDATA[Styling bugfixing]]></UPDATEINFO>
-<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--9BA0836A3CD74EE4AB48753A47211BCC-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--9BA0836A3CD74EE4AB48753A47211BCC--></AD_MODULE>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <AD_DEPENDENT_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_DEPENDENT_MODULE_ID>
-<!--15D7CE8D95D043189162DBABA54A1F61-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--15D7CE8D95D043189162DBABA54A1F61-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <DEPENDANT_MODULE_NAME><![CDATA[JSON Datasource]]></DEPENDANT_MODULE_NAME>
 <!--15D7CE8D95D043189162DBABA54A1F61-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--60A170212F36499D83B8AD38D01F46B3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--60A170212F36499D83B8AD38D01F46B3-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--60A170212F36499D83B8AD38D01F46B3-->  <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID>
-<!--60A170212F36499D83B8AD38D01F46B3-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--60A170212F36499D83B8AD38D01F46B3-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--60A170212F36499D83B8AD38D01F46B3-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--60A170212F36499D83B8AD38D01F46B3-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME>
 <!--60A170212F36499D83B8AD38D01F46B3-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--824D60CB352E4099B1D8C903CA139DAE-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--824D60CB352E4099B1D8C903CA139DAE-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--824D60CB352E4099B1D8C903CA139DAE-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -49,7 +49,7 @@
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <AD_DEPENDENT_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_DEPENDENT_MODULE_ID>
-<!--E8FD820AFE3D4FE08C02FC47769026AD-->  <STARTVERSION><![CDATA[8.1.31811]]></STARTVERSION>
+<!--E8FD820AFE3D4FE08C02FC47769026AD-->  <STARTVERSION><![CDATA[8.1.32382]]></STARTVERSION>
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <DEPENDANT_MODULE_NAME><![CDATA[Smartclient]]></DEPENDANT_MODULE_NAME>
 <!--E8FD820AFE3D4FE08C02FC47769026AD-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBCLKER_TEMPLATE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/OBCLKER_TEMPLATE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -32,12 +32,28 @@
 <!--08074180655340F0B67E2BA3BA087062-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--08074180655340F0B67E2BA3BA087062-->  <NAME><![CDATA[Navbar Alert Icon ]]></NAME>
 <!--08074180655340F0B67E2BA3BA087062-->  <DESCRIPTION><![CDATA[Template to create the navbar alert icon]]></DESCRIPTION>
-<!--08074180655340F0B67E2BA3BA087062-->  <TEMPLATE><![CDATA[OBAlertIcon.create({})]]></TEMPLATE>
+<!--08074180655340F0B67E2BA3BA087062-->  <TEMPLATE><![CDATA[{
+  className: 'OBAlertIcon',
+  properties: {}
+}]]></TEMPLATE>
 <!--08074180655340F0B67E2BA3BA087062-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
 <!--08074180655340F0B67E2BA3BA087062-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
 <!--08074180655340F0B67E2BA3BA087062-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--08074180655340F0B67E2BA3BA087062--></OBCLKER_TEMPLATE>
 
+<!--0A9FD7B8976645A380920FF6411AB4A6--><OBCLKER_TEMPLATE>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <OBCLKER_TEMPLATE_ID><![CDATA[0A9FD7B8976645A380920FF6411AB4A6]]></OBCLKER_TEMPLATE_ID>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <NAME><![CDATA[Navigation Bar template]]></NAME>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <DESCRIPTION><![CDATA[Template that generates the navigation bar components]]></DESCRIPTION>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/templates/navigation-bar.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_MainLayout]]></COMPONENT_TYPE>
+<!--0A9FD7B8976645A380920FF6411AB4A6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0A9FD7B8976645A380920FF6411AB4A6--></OBCLKER_TEMPLATE>
+
 <!--33E04D0799794C6F95F05149D2E04E78--><OBCLKER_TEMPLATE>
 <!--33E04D0799794C6F95F05149D2E04E78-->  <OBCLKER_TEMPLATE_ID><![CDATA[33E04D0799794C6F95F05149D2E04E78]]></OBCLKER_TEMPLATE_ID>
 <!--33E04D0799794C6F95F05149D2E04E78-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -51,6 +67,53 @@
 <!--33E04D0799794C6F95F05149D2E04E78-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--33E04D0799794C6F95F05149D2E04E78--></OBCLKER_TEMPLATE>
 
+<!--34752CBCF4AF48E59E1283317EB0674C--><OBCLKER_TEMPLATE>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <OBCLKER_TEMPLATE_ID><![CDATA[34752CBCF4AF48E59E1283317EB0674C]]></OBCLKER_TEMPLATE_ID>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <NAME><![CDATA[Quick Create template]]></NAME>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <DESCRIPTION><![CDATA[Creates the quick create component]]></DESCRIPTION>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <TEMPLATE><![CDATA[{
+  className: 'OBQuickLaunch',
+  properties: {
+    title: '',
+    itemPrompt: 'UINAVBA_CREATE_NEW',
+    buttonType: 'createNew',
+    prefixLabel: 'UINAVBA_NEW',
+    keyboardShortcutId: 'NavBar_OBQuickCreate',
+    recentPropertyName: 'UINAVBA_RecentCreateList',
+    titleLabel: 'UINAVBA_CREATE_NEW',
+    command: 'NEW',
+    initWidget: function() {
+      if (this.createNew_src) {
+        this.setSrc(this.createNew_src);
+      }
+      this.Super('initWidget', arguments);
+    },
+    isValidMenuItem: function(menuItem) {
+      return this.isWindowAndCanCreateNewRecord(menuItem);
+    }
+  }
+}]]></TEMPLATE>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
+<!--34752CBCF4AF48E59E1283317EB0674C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--34752CBCF4AF48E59E1283317EB0674C--></OBCLKER_TEMPLATE>
+
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F--><OBCLKER_TEMPLATE>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <OBCLKER_TEMPLATE_ID><![CDATA[4C6825EEBF2C440CA6F97C8A042CCB5F]]></OBCLKER_TEMPLATE_ID>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <NAME><![CDATA[Application Menu]]></NAME>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <DESCRIPTION><![CDATA[The template creating the Application menu options]]></DESCRIPTION>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/application-menu.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_MainLayout]]></COMPONENT_TYPE>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4C6825EEBF2C440CA6F97C8A042CCB5F--></OBCLKER_TEMPLATE>
+
 <!--582D107C03FD4B56A4BEDCF4CAABBB55--><OBCLKER_TEMPLATE>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <OBCLKER_TEMPLATE_ID><![CDATA[582D107C03FD4B56A4BEDCF4CAABBB55]]></OBCLKER_TEMPLATE_ID>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -58,7 +121,14 @@
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <NAME><![CDATA[User info Navigation Bar template]]></NAME>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <DESCRIPTION><![CDATA[Template generating jscript which shows user info in the navigation bar]]></DESCRIPTION>
-<!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <TEMPLATE><![CDATA[{
+  className: 'OBUserProfile',
+  properties: {}
+},
+{
+  className: 'OBLogout',
+  properties: {}
+}]]></TEMPLATE>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
 <!--582D107C03FD4B56A4BEDCF4CAABBB55-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
@@ -71,7 +141,10 @@
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <NAME><![CDATA[Help About Navigation Bar Widget]]></NAME>
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <DESCRIPTION><![CDATA[Help About Navigation Bar Widget]]></DESCRIPTION>
-<!--614A1413D97B4392AA3C1AF486D8D76A-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/help-about.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--614A1413D97B4392AA3C1AF486D8D76A-->  <TEMPLATE><![CDATA[{
+  className: 'OBHelpAbout',
+  properties: {}
+}]]></TEMPLATE>
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
 <!--614A1413D97B4392AA3C1AF486D8D76A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
@@ -83,8 +156,17 @@
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <NAME><![CDATA[Menu template]]></NAME>
-<!--66A2AD8595D1479E904ED0D9999E2842-->  <DESCRIPTION><![CDATA[The template creating a menu]]></DESCRIPTION>
-<!--66A2AD8595D1479E904ED0D9999E2842-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/application-menu.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--66A2AD8595D1479E904ED0D9999E2842-->  <DESCRIPTION><![CDATA[The template creating the Application menu]]></DESCRIPTION>
+<!--66A2AD8595D1479E904ED0D9999E2842-->  <TEMPLATE><![CDATA[{
+  className: 'OBApplicationMenuButton',
+  properties: {
+    title: 'UINAVBA_APPLICATION_MENU',
+    initWidget: function () {
+      this.Super('initWidget', arguments);
+      this.baseData = isc.clone(OB.Application.menu);
+    }
+  }
+}]]></TEMPLATE>
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
 <!--66A2AD8595D1479E904ED0D9999E2842-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
@@ -197,6 +279,19 @@
 <!--C1D176407A354A40815DC46D24D70EB8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--C1D176407A354A40815DC46D24D70EB8--></OBCLKER_TEMPLATE>
 
+<!--CB89E38CF75545499BF0B91FA6B233E5--><OBCLKER_TEMPLATE>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <OBCLKER_TEMPLATE_ID><![CDATA[CB89E38CF75545499BF0B91FA6B233E5]]></OBCLKER_TEMPLATE_ID>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <NAME><![CDATA[User info Navigation Bar Data template]]></NAME>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <DESCRIPTION><![CDATA[Template generating the session data shown by the user info navigation bar element]]></DESCRIPTION>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
+<!--CB89E38CF75545499BF0B91FA6B233E5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB89E38CF75545499BF0B91FA6B233E5--></OBCLKER_TEMPLATE>
+
 <!--CCA227AA8C4944E88B3EB23BA491222A--><OBCLKER_TEMPLATE>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <OBCLKER_TEMPLATE_ID><![CDATA[CCA227AA8C4944E88B3EB23BA491222A]]></OBCLKER_TEMPLATE_ID>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -204,7 +299,28 @@
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <NAME><![CDATA[Quick Launch template]]></NAME>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <DESCRIPTION><![CDATA[Creates the quick launch component]]></DESCRIPTION>
-<!--CCA227AA8C4944E88B3EB23BA491222A-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/navigationbarcomponents/templates/quick-launch.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--CCA227AA8C4944E88B3EB23BA491222A-->  <TEMPLATE><![CDATA[{
+  className: 'OBQuickLaunch',
+  properties: {
+    title: '',
+    itemPrompt: 'UINAVBA_QUICK_LAUNCH',
+    buttonType: 'quickLaunch',
+    prefixLabel: '',
+    keyboardShortcutId: 'NavBar_OBQuickLaunch',
+    recentPropertyName: 'UINAVBA_RecentLaunchList',
+    titleLabel: 'UINAVBA_QUICK_LAUNCH',
+    command: 'DEFAULT',
+    initWidget: function() {
+      if (this.quickLaunch_src) {
+        this.setSrc(this.quickLaunch_src);
+      }
+      this.Super('initWidget', arguments);
+    },
+    isValidMenuItem: function(menuItem) {
+      return !this.isFolder(menuItem);
+    }
+  }
+}]]></TEMPLATE>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_NavigationBar]]></COMPONENT_TYPE>
 <!--CCA227AA8C4944E88B3EB23BA491222A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
@@ -266,6 +382,19 @@
 <!--EE3A4F4E485D47CB8057B90C40D134A0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--EE3A4F4E485D47CB8057B90C40D134A0--></OBCLKER_TEMPLATE>
 
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C--><OBCLKER_TEMPLATE>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <OBCLKER_TEMPLATE_ID><![CDATA[EE5CEC203AEA4B039CCDAD0BE8E07E3C]]></OBCLKER_TEMPLATE_ID>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <NAME><![CDATA[Heartbeat Registration]]></NAME>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <DESCRIPTION><![CDATA[Template used to generate the function that decides to show (or not) the heartbeat or registration popups]]></DESCRIPTION>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <TEMPLATECLASSPATHLOCATION><![CDATA[/org/openbravo/client/application/templates/ob-heartbeat-registration.js.ftl]]></TEMPLATECLASSPATHLOCATION>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <TEMPLATE_LANGUAGE><![CDATA[OBCLFRE_Freemarker]]></TEMPLATE_LANGUAGE>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <COMPONENT_TYPE><![CDATA[OBUIAPP_MainLayout]]></COMPONENT_TYPE>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--EE5CEC203AEA4B039CCDAD0BE8E07E3C--></OBCLKER_TEMPLATE>
+
 <!--FF808181317B723B01317B7453E90006--><OBCLKER_TEMPLATE>
 <!--FF808181317B723B01317B7453E90006-->  <OBCLKER_TEMPLATE_ID><![CDATA[FF808181317B723B01317B7453E90006]]></OBCLKER_TEMPLATE_ID>
 <!--FF808181317B723B01317B7453E90006-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -28,34 +28,6 @@
 <!--3C1148C0AB604DE1B51B7EA4112C325F-->  <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING>
 <!--3C1148C0AB604DE1B51B7EA4112C325F--></OBSERDS_DATASOURCE>
 
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--><OBSERDS_DATASOURCE>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <OBSERDS_DATASOURCE_ID><![CDATA[99B9CC42FDEA4CA7A4EE35BC49D61E0E]]></OBSERDS_DATASOURCE_ID>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <NAME><![CDATA[QuickLaunchDataSource]]></NAME>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <DESCRIPTION><![CDATA[Provides the data for the open view navigation bar widget]]></DESCRIPTION>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.QuickLaunchDataSource]]></CLASSNAME>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E-->  <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING>
-<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--></OBSERDS_DATASOURCE>
-
-<!--C17951F970E942FD9F3771B7BE91D049--><OBSERDS_DATASOURCE>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <OBSERDS_DATASOURCE_ID><![CDATA[C17951F970E942FD9F3771B7BE91D049]]></OBSERDS_DATASOURCE_ID>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <NAME><![CDATA[QuickCreateDataSource]]></NAME>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <DESCRIPTION><![CDATA[Datasource for the quick create navigation bar widget]]></DESCRIPTION>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.QuickCreateDataSource]]></CLASSNAME>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
-<!--C17951F970E942FD9F3771B7BE91D049-->  <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING>
-<!--C17951F970E942FD9F3771B7BE91D049--></OBSERDS_DATASOURCE>
-
 <!--DB9F062472294F12A0291A7BD203F922--><OBSERDS_DATASOURCE>
 <!--DB9F062472294F12A0291A7BD203F922-->  <OBSERDS_DATASOURCE_ID><![CDATA[DB9F062472294F12A0291A7BD203F922]]></OBSERDS_DATASOURCE_ID>
 <!--DB9F062472294F12A0291A7BD203F922-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE_FIELD.xml	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<data>
-<!--124A746198DD46F5958C0A299351CBB6--><OBSERDS_DATASOURCE_FIELD>
-<!--124A746198DD46F5958C0A299351CBB6-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[124A746198DD46F5958C0A299351CBB6]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--124A746198DD46F5958C0A299351CBB6-->  <OBSERDS_DATASOURCE_ID><![CDATA[99B9CC42FDEA4CA7A4EE35BC49D61E0E]]></OBSERDS_DATASOURCE_ID>
-<!--124A746198DD46F5958C0A299351CBB6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--124A746198DD46F5958C0A299351CBB6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--124A746198DD46F5958C0A299351CBB6-->  <NAME><![CDATA[icon]]></NAME>
-<!--124A746198DD46F5958C0A299351CBB6-->  <DESCRIPTION><![CDATA[icon]]></DESCRIPTION>
-<!--124A746198DD46F5958C0A299351CBB6-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--124A746198DD46F5958C0A299351CBB6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--124A746198DD46F5958C0A299351CBB6--></OBSERDS_DATASOURCE_FIELD>
-
-<!--4EBEE8A96E064B4E95F51FDD6B34154F--><OBSERDS_DATASOURCE_FIELD>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[4EBEE8A96E064B4E95F51FDD6B34154F]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <OBSERDS_DATASOURCE_ID><![CDATA[99B9CC42FDEA4CA7A4EE35BC49D61E0E]]></OBSERDS_DATASOURCE_ID>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <NAME><![CDATA[_identifier]]></NAME>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <DESCRIPTION><![CDATA[identifier]]></DESCRIPTION>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--4EBEE8A96E064B4E95F51FDD6B34154F--></OBSERDS_DATASOURCE_FIELD>
-
-<!--622AC1D0D0364D4E965F2BD28E572E93--><OBSERDS_DATASOURCE_FIELD>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[622AC1D0D0364D4E965F2BD28E572E93]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <OBSERDS_DATASOURCE_ID><![CDATA[99B9CC42FDEA4CA7A4EE35BC49D61E0E]]></OBSERDS_DATASOURCE_ID>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <NAME><![CDATA[id]]></NAME>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <DESCRIPTION><![CDATA[id]]></DESCRIPTION>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--622AC1D0D0364D4E965F2BD28E572E93-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--622AC1D0D0364D4E965F2BD28E572E93--></OBSERDS_DATASOURCE_FIELD>
-
-<!--CB0B4C3E832241758A652D115AE521FE--><OBSERDS_DATASOURCE_FIELD>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[CB0B4C3E832241758A652D115AE521FE]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <OBSERDS_DATASOURCE_ID><![CDATA[C17951F970E942FD9F3771B7BE91D049]]></OBSERDS_DATASOURCE_ID>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <NAME><![CDATA[_identifier]]></NAME>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <DESCRIPTION><![CDATA[_identifier]]></DESCRIPTION>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--CB0B4C3E832241758A652D115AE521FE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--CB0B4C3E832241758A652D115AE521FE--></OBSERDS_DATASOURCE_FIELD>
-
-<!--D74248F87B7B460C8D5F770A099DAF1C--><OBSERDS_DATASOURCE_FIELD>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[D74248F87B7B460C8D5F770A099DAF1C]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <OBSERDS_DATASOURCE_ID><![CDATA[C17951F970E942FD9F3771B7BE91D049]]></OBSERDS_DATASOURCE_ID>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <NAME><![CDATA[icon]]></NAME>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <DESCRIPTION><![CDATA[icon]]></DESCRIPTION>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--D74248F87B7B460C8D5F770A099DAF1C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--D74248F87B7B460C8D5F770A099DAF1C--></OBSERDS_DATASOURCE_FIELD>
-
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7--><OBSERDS_DATASOURCE_FIELD>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <OBSERDS_DATASOURCE_FIELD_ID><![CDATA[E872E11DC1BA4A42BCFFA8CF02BF91B7]]></OBSERDS_DATASOURCE_FIELD_ID>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <OBSERDS_DATASOURCE_ID><![CDATA[C17951F970E942FD9F3771B7BE91D049]]></OBSERDS_DATASOURCE_ID>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <NAME><![CDATA[id]]></NAME>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <DESCRIPTION><![CDATA[id]]></DESCRIPTION>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--E872E11DC1BA4A42BCFFA8CF02BF91B7--></OBSERDS_DATASOURCE_FIELD>
-
-</data>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBUIAPP_NAVBAR_COMPONENT.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/OBUIAPP_NAVBAR_COMPONENT.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -11,6 +11,7 @@
 <!--0FB5D32155C84680B9B02CD8E9C81EE9-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--0FB5D32155C84680B9B02CD8E9C81EE9-->  <SORTNO><![CDATA[60]]></SORTNO>
 <!--0FB5D32155C84680B9B02CD8E9C81EE9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0FB5D32155C84680B9B02CD8E9C81EE9-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--0FB5D32155C84680B9B02CD8E9C81EE9--></OBUIAPP_NAVBAR_COMPONENT>
 
 <!--112AFEB9A5604C349CB3D6644EAE4992--><OBUIAPP_NAVBAR_COMPONENT>
@@ -18,13 +19,14 @@
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
-<!--112AFEB9A5604C349CB3D6644EAE4992-->  <OBCLKER_TEMPLATE_ID><![CDATA[CCA227AA8C4944E88B3EB23BA491222A]]></OBCLKER_TEMPLATE_ID>
+<!--112AFEB9A5604C349CB3D6644EAE4992-->  <OBCLKER_TEMPLATE_ID><![CDATA[34752CBCF4AF48E59E1283317EB0674C]]></OBCLKER_TEMPLATE_ID>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <NAME><![CDATA[Quick Create]]></NAME>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <DESCRIPTION><![CDATA[Opens a classic OB window in insert/create mode]]></DESCRIPTION>
-<!--112AFEB9A5604C349CB3D6644EAE4992-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.QuickCreateComponent]]></CLASSNAME>
+<!--112AFEB9A5604C349CB3D6644EAE4992-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.BaseTemplateComponent]]></CLASSNAME>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <SORTNO><![CDATA[10]]></SORTNO>
 <!--112AFEB9A5604C349CB3D6644EAE4992-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--112AFEB9A5604C349CB3D6644EAE4992-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--112AFEB9A5604C349CB3D6644EAE4992--></OBUIAPP_NAVBAR_COMPONENT>
 
 <!--5AC86E8BB0464025887B6544F175177C--><OBUIAPP_NAVBAR_COMPONENT>
@@ -35,10 +37,11 @@
 <!--5AC86E8BB0464025887B6544F175177C-->  <OBCLKER_TEMPLATE_ID><![CDATA[582D107C03FD4B56A4BEDCF4CAABBB55]]></OBCLKER_TEMPLATE_ID>
 <!--5AC86E8BB0464025887B6544F175177C-->  <NAME><![CDATA[User Information]]></NAME>
 <!--5AC86E8BB0464025887B6544F175177C-->  <DESCRIPTION><![CDATA[Shows user information]]></DESCRIPTION>
-<!--5AC86E8BB0464025887B6544F175177C-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.UserInfoComponent]]></CLASSNAME>
+<!--5AC86E8BB0464025887B6544F175177C-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.BaseTemplateComponent]]></CLASSNAME>
 <!--5AC86E8BB0464025887B6544F175177C-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--5AC86E8BB0464025887B6544F175177C-->  <SORTNO><![CDATA[70]]></SORTNO>
 <!--5AC86E8BB0464025887B6544F175177C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5AC86E8BB0464025887B6544F175177C-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--5AC86E8BB0464025887B6544F175177C--></OBUIAPP_NAVBAR_COMPONENT>
 
 <!--B2CD049FB8E34CE9B35A6F2C39A3A1F1--><OBUIAPP_NAVBAR_COMPONENT>
@@ -53,6 +56,7 @@
 <!--B2CD049FB8E34CE9B35A6F2C39A3A1F1-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--B2CD049FB8E34CE9B35A6F2C39A3A1F1-->  <SORTNO><![CDATA[50]]></SORTNO>
 <!--B2CD049FB8E34CE9B35A6F2C39A3A1F1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B2CD049FB8E34CE9B35A6F2C39A3A1F1-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--B2CD049FB8E34CE9B35A6F2C39A3A1F1--></OBUIAPP_NAVBAR_COMPONENT>
 
 <!--DD54C8A48D5A4E48BC92648B9BE19474--><OBUIAPP_NAVBAR_COMPONENT>
@@ -63,10 +67,11 @@
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <OBCLKER_TEMPLATE_ID><![CDATA[CCA227AA8C4944E88B3EB23BA491222A]]></OBCLKER_TEMPLATE_ID>
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <NAME><![CDATA[Quick Launch component]]></NAME>
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <DESCRIPTION><![CDATA[Opens an class OB Window]]></DESCRIPTION>
-<!--DD54C8A48D5A4E48BC92648B9BE19474-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.QuickLaunchComponent]]></CLASSNAME>
+<!--DD54C8A48D5A4E48BC92648B9BE19474-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.BaseTemplateComponent]]></CLASSNAME>
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <SORTNO><![CDATA[20]]></SORTNO>
 <!--DD54C8A48D5A4E48BC92648B9BE19474-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--DD54C8A48D5A4E48BC92648B9BE19474-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--DD54C8A48D5A4E48BC92648B9BE19474--></OBUIAPP_NAVBAR_COMPONENT>
 
 <!--E404869052A44BC99AE27BDBAE1D6062--><OBUIAPP_NAVBAR_COMPONENT>
@@ -77,10 +82,11 @@
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <OBCLKER_TEMPLATE_ID><![CDATA[66A2AD8595D1479E904ED0D9999E2842]]></OBCLKER_TEMPLATE_ID>
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <NAME><![CDATA[Application Menu]]></NAME>
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <DESCRIPTION><![CDATA[The application menu navigation bar component]]></DESCRIPTION>
-<!--E404869052A44BC99AE27BDBAE1D6062-->  <CLASSNAME><![CDATA[org.openbravo.client.application.navigationbarcomponents.ApplicationMenuComponent]]></CLASSNAME>
+<!--E404869052A44BC99AE27BDBAE1D6062-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.BaseTemplateComponent]]></CLASSNAME>
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <ALLROLES><![CDATA[Y]]></ALLROLES>
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <SORTNO><![CDATA[30]]></SORTNO>
 <!--E404869052A44BC99AE27BDBAE1D6062-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E404869052A44BC99AE27BDBAE1D6062-->  <ISSTATICCOMPONENT><![CDATA[Y]]></ISSTATICCOMPONENT>
 <!--E404869052A44BC99AE27BDBAE1D6062--></OBUIAPP_NAVBAR_COMPONENT>
 
 </data>
--- a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/ADCSInitialization.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/ADCSInitialization.java	Thu Sep 14 12:03:42 2017 +0000
@@ -35,15 +35,13 @@
 import org.hibernate.Query;
 import org.junit.Test;
 import org.openbravo.base.exception.OBException;
-import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.base.weld.test.WeldBaseTest;
 import org.openbravo.client.application.attachment.AttachmentUtils;
 import org.openbravo.client.application.window.ApplicationDictionaryCachedStructures;
-import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.ui.Field;
 import org.openbravo.model.ad.utility.AttachmentMethod;
-import org.openbravo.test.base.HiddenObjectHelper;
+import org.openbravo.test.base.mock.HttpServletRequestMock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -131,12 +129,7 @@
 
       // We need vars in context to initialize combos: this is not an issue because vars is only
       // used for system settings such as sql formats
-      VariablesSecureApp fakedVars = new VariablesSecureApp(null, null, null);
-      try {
-        HiddenObjectHelper.set(RequestContext.get(), "variablesSecureApp", fakedVars);
-      } catch (Exception e) {
-        log.error("Errror initializating context", e);
-      }
+      HttpServletRequestMock.setRequestMockInRequestContext();
 
       setSystemAdministratorContext();
     }
--- a/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/StandardWindowTest.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src-test/org/openbravo/client/application/test/StandardWindowTest.java	Thu Sep 14 12:03:42 2017 +0000
@@ -27,16 +27,14 @@
 import org.apache.log4j.Level;
 import org.junit.Ignore;
 import org.junit.Test;
-import org.openbravo.base.secureApp.VariablesSecureApp;
 import org.openbravo.base.weld.test.WeldBaseTest;
 import org.openbravo.client.application.window.StandardWindowComponent;
 import org.openbravo.client.kernel.ComponentGenerator;
-import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.module.Module;
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.ad.ui.Window;
-import org.openbravo.test.base.HiddenObjectHelper;
+import org.openbravo.test.base.mock.HttpServletRequestMock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,12 +63,7 @@
 
     String errorMsg = "";
     try {
-      VariablesSecureApp fakedVars = new VariablesSecureApp(null, null, null);
-      try {
-        HiddenObjectHelper.set(RequestContext.get(), "variablesSecureApp", fakedVars);
-      } catch (Exception e) {
-        log.error("Errror initializating context", e);
-      }
+      HttpServletRequestMock.setRequestMockInRequestContext();
 
       List<Window> allWindows = OBDal.getInstance().createQuery(Window.class, "").list();
       int i = 0;
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Thu Sep 14 12:03:42 2017 +0000
@@ -24,12 +24,14 @@
 
 import javax.enterprise.context.ApplicationScoped;
 
-import org.openbravo.client.application.window.WindowDefinitionComponent;
+import org.hibernate.criterion.Restrictions;
 import org.openbravo.client.kernel.BaseComponentProvider;
 import org.openbravo.client.kernel.Component;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.client.kernel.KernelConstants;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
 
 /**
  * 
@@ -48,12 +50,7 @@
    */
   @Override
   public Component getComponent(String componentId, Map<String, Object> parameters) {
-    if (componentId.equals(WindowDefinitionComponent.WINDOW_DEF_COMPONENT)) {
-      final WindowDefinitionComponent component = getComponent(WindowDefinitionComponent.class);
-      component.setId(WindowDefinitionComponent.WINDOW_DEF_COMPONENT);
-      component.setParameters(parameters);
-      return component;
-    } else if (componentId.equals(ApplicationConstants.MAIN_LAYOUT_ID)) {
+    if (componentId.equals(ApplicationConstants.MAIN_LAYOUT_ID)) {
       final MainLayoutComponent component = getComponent(MainLayoutComponent.class);
       component.setId(ApplicationConstants.MAIN_LAYOUT_ID);
       component.setParameters(parameters);
@@ -63,11 +60,6 @@
       component.setId(ApplicationConstants.MAIN_LAYOUT_VIEW_COMPONENT_ID);
       component.setParameters(parameters);
       return component;
-    } else if (componentId.equals(ApplicationConstants.PROPERTIES_COMPONENT_ID)) {
-      final PropertiesComponent component = getComponent(PropertiesComponent.class);
-      component.setId(ApplicationConstants.PROPERTIES_COMPONENT_ID);
-      component.setParameters(parameters);
-      return component;
     }
     throw new IllegalArgumentException("Component id " + componentId + " not supported.");
   }
@@ -80,6 +72,7 @@
   @Override
   public List<ComponentResource> getGlobalComponentResources() {
     final List<ComponentResource> globalResources = new ArrayList<ComponentResource>();
+
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/utilities/ob-utilities.js", true));
     globalResources.add(createStaticResource(
@@ -193,13 +186,6 @@
         "web/org.openbravo.client.application/js/utilities/ob-test-registry.js", true));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/utilities/ob-remote-call-manager.js", true));
-    globalResources
-        .add(createDynamicResource("org.openbravo.client.kernel/"
-            + ApplicationConstants.COMPONENT_TYPE + "/"
-            + ApplicationConstants.PROPERTIES_COMPONENT_ID));
-    globalResources.add(createDynamicResource("org.openbravo.client.kernel/"
-        + ApplicationConstants.COMPONENT_TYPE + "/"
-        + WindowDefinitionComponent.WINDOW_DEF_COMPONENT));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/classic/ob-classic-window.js", false));
     globalResources.add(createStaticResource(
@@ -442,10 +428,17 @@
             + KernelConstants.SKIN_PARAMETER
             + "/org.openbravo.client.application/ob-navigation-bar-styles.js", false));
 
-    // Application - dynamic as it contains the generated menu also (which is user/role dependant)
-    globalResources.add(createDynamicResource("org.openbravo.client.kernel/"
-        + ApplicationConstants.COMPONENT_TYPE + "/" + ApplicationConstants.MAIN_LAYOUT_ID));
-
+    if (existsDynamicNavigationBarComponents()) {
+      // Adding this dynamic resource will result in an extra request for the 'Application'
+      // component in order to complete the creation of the navigation bar components that are
+      // generated dynamically
+      globalResources.add(createDynamicResource("org.openbravo.client.kernel/"
+          + ApplicationConstants.COMPONENT_TYPE + "/" + ApplicationConstants.MAIN_LAYOUT_ID));
+    }
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/main/ob-notes-datasource.js", false));
+    globalResources.add(createStaticResource(
+        "web/org.openbravo.client.application/js/main/ob-layout.js", false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.application/js/utilities/ob-view-manager.js", false));
     globalResources.add(createStaticResource(
@@ -491,6 +484,13 @@
     return globalResources;
   }
 
+  private static boolean existsDynamicNavigationBarComponents() {
+    OBCriteria<NavBarComponent> obc = OBDal.getInstance().createCriteria(NavBarComponent.class);
+    obc.add(Restrictions.eq(NavBarComponent.PROPERTY_ISSTATICCOMPONENT, false));
+    obc.setMaxResults(1);
+    return obc.uniqueResult() != null;
+  }
+
   @Override
   public List<String> getTestResources() {
     final List<String> testResources = new ArrayList<String>();
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationConstants.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationConstants.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -40,8 +40,12 @@
   public static final JSONObject ACTION_RESULT_SUCCESS;
   public static final String COMPONENT_TYPE = "OBUIAPP_MainLayout";
   public static final String MAIN_LAYOUT_ID = "Application";
+  public static final String NAVIGATION_BAR_ID = "NavigationBar";
+  public static final String APPLICATION_MENU_ID = "ApplicationMenu";
   public static final String MAIN_LAYOUT_VIEW_COMPONENT_ID = "View";
   public static final String MAIN_LAYOUT_TEMPLATE_ID = "9E97FF309FE44C61A761F50801F79349";
+  public static final String NAVIGATION_BAR_TEMPLATE_ID = "0A9FD7B8976645A380920FF6411AB4A6";
+  public static final String APPLICATION_MENU_TEMPLATE_ID = "4C6825EEBF2C440CA6F97C8A042CCB5F";
   public static final String HQL_TABLE_DATASOURCE_ID = "3C1148C0AB604DE1B51B7EA4112C325F";
 
   public static final String PROPERTIES_TEMPLATE_ID = "DA488BBACB294198AA36A93F03F9561B";
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/GlobalMenu.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/GlobalMenu.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2013-2016 Openbravo SLU
+ * All portions are Copyright (C) 2013-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -34,6 +34,7 @@
 import org.openbravo.client.application.MenuManager.MenuOption;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.ad.domain.ModelImplementation;
 import org.openbravo.model.ad.domain.ModelImplementationMapping;
@@ -65,7 +66,7 @@
    * ones. If it is not present there, it is generated and cached.
    * 
    */
-  synchronized List<MenuOption> getMenuOptions(String roleId, String language) {
+  List<MenuOption> getMenuOptions(String roleId, String language) {
     long t = System.currentTimeMillis();
 
     if (menuOptionsByLangAndTree == null) {
@@ -208,6 +209,7 @@
                   foundOption.setObjectId(process.getId());
                   if (process.getUIPattern().equals("Standard")) {
                     foundOption.setType(MenuEntryType.Process);
+                    foundOption.setModal(Utility.isModalProcess(process.getId()));
                   } else if (process.isReport() || process.isJasperReport()) {
                     foundOption.setType(MenuEntryType.Report);
                     foundOption.setReport(true);
@@ -221,6 +223,7 @@
             if (!found && "P".equals(menu.getAction())) {
               foundOption.setType(MenuEntryType.Process);
               foundOption.setObjectId(process.getId());
+              foundOption.setModal(Utility.isModalProcess(process.getId()));
               if (process.isExternalService() != null && process.isExternalService()
                   && "PS".equals(process.getServiceType())) {
                 foundOption.setId("/utility/OpenPentaho.html?inpadProcessId=" + process.getId());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/HeartBeatPopUpComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,158 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.application;
+
+import java.io.File;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpSession;
+
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.client.kernel.KernelConstants;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.ddlutils.util.DBSMOBUtil;
+import org.openbravo.erpCommon.ad_process.HeartbeatProcess;
+import org.openbravo.erpCommon.ad_process.HeartbeatProcess.HeartBeatOrRegistration;
+import org.openbravo.erpCommon.businessUtility.Preferences;
+import org.openbravo.erpCommon.utility.PropertyException;
+import org.openbravo.model.ad.module.Module;
+import org.openbravo.service.db.DalConnectionProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The component responsible for generating the content of the function used to determine if the
+ * HeartBeat or any kind of registration pop-up should be displayed once the user has logged in into
+ * the application.
+ */
+public class HeartBeatPopUpComponent extends SessionDynamicTemplateComponent {
+
+  private static final Logger log = LoggerFactory.getLogger(HeartBeatPopUpComponent.class);
+  private static final String APRM_MIGRATION_TOOL_ID = "4BD3D4B262B048518FE62496EF09D549";
+  private static final String COMPONENT_ID = "HeartbeatRegistration";
+  private static final String TEMPLATE_ID = "EE5CEC203AEA4B039CCDAD0BE8E07E3C";
+
+  @Override
+  public String getId() {
+    return COMPONENT_ID;
+  }
+
+  @Override
+  protected String getTemplateId() {
+    return TEMPLATE_ID;
+  }
+
+  public String getHeartBeatRegistrationFunction() {
+    try {
+      if (isUpgrading()) {
+        if (!isSystemAdmin()) {
+          return "OB.Layout.ClassicOBCompatibility.Popup.standardUpgrading()";
+        } else {
+          boolean usingAprm = true;
+          if (OBDal.getInstance().exists(Module.ENTITY_NAME, APRM_MIGRATION_TOOL_ID)) {
+            usingAprm = new AdvPaymentMngtDao().existsAPRMReadyPreference();
+          }
+          if (!usingAprm) {
+            return "OB.Layout.ClassicOBCompatibility.Popup.openAPRMPopup()";
+          }
+          String oldScripts = getConfigScriptsNotExported();
+          if (!oldScripts.isEmpty()) {
+            return "OB.Layout.ClassicOBCompatibility.Popup.openConfigScriptPopup(" + oldScripts
+                + ")";
+          } else {
+            return "OB.Layout.ClassicOBCompatibility.Popup.openSuccessUpgradePopup()";
+          }
+        }
+      }
+
+      switch (getPopUpToShow()) {
+      case OutOfDemandPlatform:
+        return "OB.Layout.ClassicOBCompatibility.openInstanceManagementForm()";
+      case InstancePurpose:
+        return "OB.Layout.ClassicOBCompatibility.Popup.openInstancePurpose()";
+      case HeartBeat:
+        return "OB.Layout.ClassicOBCompatibility.Popup.openHeartbeat()";
+      case Registration:
+        return "OB.Layout.ClassicOBCompatibility.Popup.openRegistration()";
+      default:
+        return "return";
+      }
+    } catch (Exception e) {
+      throw new OBException(e);
+    }
+  }
+
+  private boolean isUpgrading() {
+    boolean isUpgrading;
+    try {
+      isUpgrading = Preferences.YES.equals(Preferences.getPreferenceValue("isUpgrading", true, "0",
+          "0", null, null, null));
+    } catch (PropertyException ignore) {
+      isUpgrading = false;
+    }
+    return isUpgrading;
+  }
+
+  private boolean isSystemAdmin() {
+    return "S".equals(OBContext.getOBContext().getRole().getUserLevel());
+  }
+
+  private String getConfigScriptsNotExported() {
+    // Get all applied configuration scripts which are not exported in 3.0
+    OBCriteria<Module> qMod = OBDal.getInstance().createCriteria(Module.class);
+    qMod.add(Restrictions.eq(Module.PROPERTY_TYPE, "T"));
+    qMod.add(Restrictions.eq(Module.PROPERTY_ENABLED, true));
+    qMod.add(Restrictions.eq(Module.PROPERTY_APPLYCONFIGURATIONSCRIPT, true));
+    String obDir = OBPropertiesProvider.getInstance().getOpenbravoProperties()
+        .getProperty("source.path");
+    String oldScripts = "";
+    for (Module mod : qMod.list()) {
+      File cfScript = new File(obDir + "/modules/" + mod.getJavaPackage() + "/src-db/database",
+          "configScript.xml");
+      if (cfScript.exists() && DBSMOBUtil.isOldConfigScript(cfScript)) {
+        if (!oldScripts.isEmpty()) {
+          oldScripts += ", ";
+        }
+        oldScripts += "'" + mod.getName() + "'";
+        log.info(mod.getName() + " config script is not exported in 3.0");
+      }
+    }
+    return oldScripts;
+  }
+
+  private HeartBeatOrRegistration getPopUpToShow() throws ServletException {
+    Object sessionObject = getParameters().get(KernelConstants.HTTP_SESSION);
+    if (sessionObject == null) {
+      // not showing any pop-up
+      log.info("Could not check the type of registration pop-up to be displayed");
+      return HeartBeatOrRegistration.None;
+    }
+    HttpSession session = (HttpSession) sessionObject;
+    String roleId = (String) session.getAttribute("#AD_ROLE_ID");
+    String javaDateFormat = (String) session.getAttribute("#AD_JAVADATEFORMAT");
+    return HeartbeatProcess.isLoginPopupRequired(roleId, javaDateFormat, new DalConnectionProvider(
+        false));
+  }
+}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/HeartBeatPopupActionHandler.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +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) 2009-2016 Openbravo SLU 
- * All Rights Reserved. 
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application;
-
-import java.io.File;
-import java.util.Map;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.log4j.Logger;
-import org.codehaus.jettison.json.JSONObject;
-import org.hibernate.criterion.Restrictions;
-import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
-import org.openbravo.base.exception.OBException;
-import org.openbravo.base.secureApp.VariablesSecureApp;
-import org.openbravo.base.session.OBPropertiesProvider;
-import org.openbravo.client.kernel.BaseActionHandler;
-import org.openbravo.client.kernel.KernelConstants;
-import org.openbravo.client.kernel.StaticResourceComponent;
-import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBCriteria;
-import org.openbravo.dal.service.OBDal;
-import org.openbravo.ddlutils.util.DBSMOBUtil;
-import org.openbravo.erpCommon.ad_process.HeartbeatProcess;
-import org.openbravo.erpCommon.ad_process.HeartbeatProcess.HeartBeatOrRegistration;
-import org.openbravo.erpCommon.businessUtility.Preferences;
-import org.openbravo.erpCommon.utility.PropertyException;
-import org.openbravo.model.ad.module.Module;
-import org.openbravo.portal.PortalAccessible;
-import org.openbravo.service.db.DalConnectionProvider;
-
-/**
- * Action handler determines if the heartbeat or registration handler should be displayed.
- * 
- * @author mtaal
- * @see StaticResourceComponent
- */
-@ApplicationScoped
-public class HeartBeatPopupActionHandler extends BaseActionHandler implements PortalAccessible {
-  private static final Logger log = Logger.getLogger(HeartBeatPopupActionHandler.class);
-  private static final String APRM_MIGRATION_TOOL_ID = "4BD3D4B262B048518FE62496EF09D549";
-
-  protected JSONObject execute(Map<String, Object> parameters, String data) {
-    try {
-      final JSONObject result = new JSONObject();
-      boolean sysAdmin = false;
-      boolean isUpgrading = false;
-      try {
-        isUpgrading = Preferences.YES.equals(Preferences.getPreferenceValue("isUpgrading", true,
-            "0", "0", null, null, null));
-      } catch (PropertyException e) {
-        isUpgrading = false;
-      }
-
-      boolean usingAprm = true;
-      boolean exportConfigScript = false;
-      if (isUpgrading) {
-        OBContext.setAdminMode();
-        try {
-          sysAdmin = "S".equals(OBContext.getOBContext().getRole().getUserLevel());
-          if (sysAdmin) {
-            if (OBDal.getInstance().exists(Module.ENTITY_NAME, APRM_MIGRATION_TOOL_ID)) {
-              usingAprm = new AdvPaymentMngtDao().existsAPRMReadyPreference();
-            }
-
-            // Check all applied configuration scripts are exported in 3.0
-            OBCriteria<Module> qMod = OBDal.getInstance().createCriteria(Module.class);
-            qMod.add(Restrictions.eq(Module.PROPERTY_TYPE, "T"));
-            qMod.add(Restrictions.eq(Module.PROPERTY_ENABLED, true));
-            qMod.add(Restrictions.eq(Module.PROPERTY_APPLYCONFIGURATIONSCRIPT, true));
-            String obDir = OBPropertiesProvider.getInstance().getOpenbravoProperties()
-                .getProperty("source.path");
-            String oldScripts = "";
-            for (Module mod : qMod.list()) {
-              File cfScript = new File(obDir + "/modules/" + mod.getJavaPackage()
-                  + "/src-db/database", "configScript.xml");
-              if (cfScript.exists() && DBSMOBUtil.isOldConfigScript(cfScript)) {
-                if (!oldScripts.isEmpty()) {
-                  oldScripts += ", ";
-                }
-                oldScripts += mod.getName();
-                log.info(mod.getName() + " config script is not exported in 3.0");
-              }
-            }
-
-            exportConfigScript = !oldScripts.isEmpty();
-
-            if (exportConfigScript) {
-              result.put("oldConfigScripts", oldScripts);
-            }
-          }
-        } finally {
-          OBContext.restorePreviousMode();
-        }
-      }
-
-      final HeartBeatOrRegistration showHeartBeatOrRegistration = HeartbeatProcess
-          .isLoginPopupRequired(
-              new VariablesSecureApp((HttpServletRequest) parameters
-                  .get(KernelConstants.HTTP_REQUEST)), new DalConnectionProvider());
-
-      result.put("upgradingNoAdmin", isUpgrading && !sysAdmin);
-      result.put("showAPRM", isUpgrading && !usingAprm);
-      result.put("showExportScripts", isUpgrading && exportConfigScript);
-      result.put("showSuccessUpgrade", isUpgrading && usingAprm && !exportConfigScript);
-      result
-          .put(
-              "showOnDemandOffPlatform",
-              showHeartBeatOrRegistration == HeartbeatProcess.HeartBeatOrRegistration.OutOfDemandPlatform);
-      result.put("showInstancePurpose",
-          showHeartBeatOrRegistration == HeartbeatProcess.HeartBeatOrRegistration.InstancePurpose);
-      result.put("showHeartbeat",
-          showHeartBeatOrRegistration == HeartbeatProcess.HeartBeatOrRegistration.HeartBeat);
-      result.put("showRegistration",
-          showHeartBeatOrRegistration == HeartbeatProcess.HeartBeatOrRegistration.Registration);
-      return result;
-    } catch (Exception e) {
-      throw new OBException(e);
-    }
-  }
-}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/LogOutActionHandler.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/LogOutActionHandler.java	Thu Sep 14 12:03:42 2017 +0000
@@ -51,6 +51,7 @@
     final HttpServletResponse response = RequestContext.get().getResponse();
     if (response instanceof KernelHttpServletResponse) {
       final KernelHttpServletResponse kernelResponse = (KernelHttpServletResponse) response;
+      // The callback of this handler performs a redirect to the base url, letting to the AuthenticationManager the final logout actions.
       kernelResponse.setDoLogout(true);
     }
   }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/MainLayoutComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/MainLayoutComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -11,52 +11,28 @@
  * 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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
 package org.openbravo.client.application;
 
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
-import javax.inject.Inject;
-
-import org.openbravo.base.session.SessionFactoryController;
-import org.openbravo.base.util.OBClassLoader;
-import org.openbravo.base.weld.WeldUtils;
-import org.openbravo.client.kernel.BaseComponent;
+import org.openbravo.client.application.NavigationBarComponentGenerator.NBComponent;
 import org.openbravo.client.kernel.BaseTemplateComponent;
-import org.openbravo.client.kernel.Component;
-import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.client.kernel.Template;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.erpCommon.businessUtility.Preferences;
-import org.openbravo.erpCommon.obps.ActivationKey;
-import org.openbravo.erpCommon.utility.PropertyException;
-import org.openbravo.erpCommon.utility.Utility;
-import org.openbravo.model.ad.utility.Image;
-import org.openbravo.service.datasource.DataSourceConstants;
 
 /**
+ * This class generates the navigation bar components which are defined as dynamic.
  * 
  * @author iperdomo
  */
 public class MainLayoutComponent extends BaseTemplateComponent {
 
-  @Inject
-  private WeldUtils weldUtils;
-
-  @Inject
-  @ComponentProvider.Qualifier(DataSourceConstants.DS_COMPONENT_TYPE)
-  private ComponentProvider dsComponentProvider;
-
   /*
    * (non-Javadoc)
    * 
@@ -67,113 +43,16 @@
     return OBDal.getInstance().get(Template.class, ApplicationConstants.MAIN_LAYOUT_TEMPLATE_ID);
   }
 
-  @SuppressWarnings("unchecked")
   public Collection<NBComponent> getNavigationBarComponents() {
-    final List<NBComponent> nbComponents = new ArrayList<NBComponent>();
-
-    OBCriteria<NavBarComponent> obc = OBDal.getInstance().createCriteria(NavBarComponent.class);
-
-    obc.addOrderBy(NavBarComponent.PROPERTY_RECORDSORTNO, true);
-    for (NavBarComponent nbc : obc.list()) {
-
-      if (!isAccessible(nbc)) {
-        continue;
-      }
-
-      final NBComponent nbComponent = new NBComponent();
-
-      String jsCode = "";
-      try {
-        final Class<BaseTemplateComponent> clz = (Class<BaseTemplateComponent>) OBClassLoader
-            .getInstance().loadClass(nbc.getJavaClassName());
-        final BaseComponent component = weldUtils.getInstance(clz);
-        component.setId(nbc.getId());
-        if (component instanceof BaseTemplateComponent && nbc.getTemplate() != null) {
-          ((BaseTemplateComponent) component).setComponentTemplate(nbc.getTemplate());
-        }
-        component.setParameters(getParameters());
-
-        jsCode = component.generate();
-        nbComponent.setJscode(jsCode);
-      } catch (Exception e) {
-        throw new IllegalStateException("Exception when creating component " + nbc.getId(), e);
-      }
-      nbComponents.add(nbComponent);
-    }
-    return nbComponents;
-  }
-
-  private boolean isAccessible(NavBarComponent navBarComponent) {
-    if (OBContext.getOBContext().getRole().getId().equals("0")) {
-      return true;
-    }
-    if (navBarComponent.isAllroles()) {
-      return true;
-    }
-    final String currentRoleId = OBContext.getOBContext().getRole().getId();
-    for (NavbarRoleaccess roleAccess : navBarComponent.getOBUIAPPNavbarRoleaccessList()) {
-      if (currentRoleId.equals(roleAccess.getRole().getId())) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  public boolean isAddProfessionalLink() {
-    if (SessionFactoryController.isRunningInWebContainer()) {
-      return !ActivationKey.isActiveInstance();
-    }
-    return true;
-  }
-
-  public String getCompanyImageLogoWidth() {
-    Image img = null;
-    img = Utility.getImageLogoObject("yourcompanymenu", "");
-    Long imageWidthLong = null;
-    if (img != null) {
-      imageWidthLong = img.getWidth();
-    }
-    String imageWidthString = "122";
-    if (imageWidthLong != null) {
-      imageWidthString = String.valueOf(imageWidthLong.intValue());
-    }
-    return imageWidthString;
-  }
-
-  public String getCompanyImageLogoHeight() {
-    Image img = null;
-    img = Utility.getImageLogoObject("yourcompanymenu", "");
-    Long imageHeightLong = null;
-    if (img != null) {
-      imageHeightLong = img.getHeight();
-    }
-    String imageHeightString = "34";
-    if (imageHeightLong != null) {
-      imageHeightString = String.valueOf(imageHeightLong.intValue());
-    }
-    return imageHeightString;
-  }
-
-  public String getStartPage() {
-    try {
-      return Preferences.getPreferenceValue(getContextUrl()
-          + ApplicationConstants.START_PAGE_PROPERTY, true, OBContext.getOBContext()
-          .getCurrentClient(), OBContext.getOBContext().getCurrentOrganization(), OBContext
-          .getOBContext().getUser(), OBContext.getOBContext().getRole(), null);
-    } catch (PropertyException e) {
-      return getContextUrl() + "/default/Menu.html";
-    }
+    return NavigationBarComponentGenerator.getInstance().getDynamicNavigationBarComponents(
+        getParameters());
   }
 
   public String getVersion() {
     return getETag();
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.client.kernel.Component#getETag()
-   */
+  @Override
   public String getETag() {
     // also encodes the role id in the etag
     if (getModule().isInDevelopment() != null && getModule().isInDevelopment()) {
@@ -183,29 +62,4 @@
           + OBContext.getOBContext().getRole().getId() + "_" + getModule().getVersion();
     }
   }
-
-  public String getNotesDataSource() {
-    final String dsId = "090A37D22E61FE94012E621729090048";
-    final Map<String, Object> dsParameters = new HashMap<String, Object>(getParameters());
-    dsParameters.put(DataSourceConstants.DS_CREATE, true);
-    final Component component = dsComponentProvider.getComponent(dsId, dsParameters);
-    return component.generate();
-  }
-
-  public static class NBComponent {
-    // NB stands for: Navigation Bar
-    private String jscode;
-
-    public void setJscode(String jscode) {
-      this.jscode = jscode;
-    }
-
-    public String getJscode() {
-      return jscode;
-    }
-
-    public String toString() {
-      return jscode;
-    }
-  }
 }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,22 +25,16 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.context.RequestScoped;
 import javax.inject.Inject;
 
 import org.hibernate.Hibernate;
 import org.hibernate.Query;
-import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.session.SessionFactoryController;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.obps.ActivationKey;
 import org.openbravo.erpCommon.obps.ActivationKey.FeatureRestriction;
-import org.openbravo.erpCommon.utility.Utility;
-import org.openbravo.model.ad.access.Role;
-import org.openbravo.model.ad.access.TabAccess;
-import org.openbravo.model.ad.access.WindowAccess;
 import org.openbravo.model.ad.ui.Form;
 import org.openbravo.model.ad.ui.Menu;
 import org.openbravo.model.ad.ui.MenuTrl;
@@ -51,14 +45,13 @@
 
 /**
  * Configures cached global menu (@see {@link GlobalMenu}) to adapt it to the current session's
- * permissions and caches it in memory for easy consumption by components. Reads the menu from the
+ * permissions and caches it in memory for easy consumption by components.
  * 
  * @author mtaal
  */
-@SessionScoped
-public class MenuManager implements Serializable {
+@RequestScoped
+public class MenuManager {
   private static final Logger log = LoggerFactory.getLogger(MenuManager.class);
-  private static final long serialVersionUID = 1L;
 
   public static enum MenuEntryType {
     Window, Process, ProcessManual, Report, Form, External, Summary, View, ProcessDefinition
@@ -75,56 +68,48 @@
   private String roleId;
   private List<MenuOption> menuOptions;
 
-  private long cacheTimeStamp = 0;
+  public MenuOption getMenu() {
+    long t = System.currentTimeMillis();
 
-  public synchronized MenuOption getMenu() {
-    long t = System.currentTimeMillis();
-    if (cachedMenu == null || roleId == null
-        || !roleId.equals(OBContext.getOBContext().getRole().getId())
-        || cacheTimeStamp != globalMenuOptions.getCacheTimeStamp()) {
+    // set the current RoleId
+    roleId = OBContext.getOBContext().getRole().getId();
 
-      // set the current RoleId
-      roleId = OBContext.getOBContext().getRole().getId();
+    OBContext.setAdminMode();
+    try {
+      // take from global menus the one for current role and language
+      menuOptions = globalMenuOptions.getMenuOptions(roleId, OBContext.getOBContext().getLanguage()
+          .getId());
 
-      OBContext.setAdminMode();
-      try {
-        // take from global menus the one for current role and language
-        menuOptions = globalMenuOptions.getMenuOptions(roleId, OBContext.getOBContext()
-            .getLanguage().getId());
-        cacheTimeStamp = globalMenuOptions.getCacheTimeStamp();
+      // configure global menu with role permissions
+      linkWindows();
+      linkProcesses();
+      linkForms();
+      linkProcessDefinition();
+      linkViewDefinition();
 
-        // configure global menu with role permissions
-        linkWindows();
-        linkProcesses();
-        linkForms();
-        linkProcessDefinition();
-        linkViewDefinition();
+      removeInvisibleNodes();
+      removeInaccessibleNodes();
 
-        removeInvisibleNodes();
-        removeInaccessibleNodes();
+      // set the globals
+      final MenuOption localCachedRoot = new MenuOption();
+      localCachedRoot.setDbId("-1"); // just use any value
+      selectableMenuOptions = new ArrayList<MenuOption>();
+      for (MenuOption menuOption : menuOptions) {
+        if (menuOption.getParentMenuOption() == null) {
+          localCachedRoot.getChildren().add(menuOption);
+        }
+        if (menuOption.getType() != MenuEntryType.Summary) {
+          selectableMenuOptions.add(menuOption);
+        }
+      }
 
-        // set the globals
-        final MenuOption localCachedRoot = new MenuOption();
-        localCachedRoot.setDbId("-1"); // just use any value
-        selectableMenuOptions = new ArrayList<MenuOption>();
-        for (MenuOption menuOption : menuOptions) {
-          if (menuOption.getParentMenuOption() == null) {
-            localCachedRoot.getChildren().add(menuOption);
-          }
-          if (menuOption.getType() != MenuEntryType.Summary) {
-            selectableMenuOptions.add(menuOption);
-          }
-        }
+      Collections.sort(selectableMenuOptions, new MenuComparator());
 
-        Collections.sort(selectableMenuOptions, new MenuComparator());
+      cachedMenu = localCachedRoot;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
 
-        cachedMenu = localCachedRoot;
-      } finally {
-        OBContext.restorePreviousMode();
-      }
-    } else {
-      log.debug("Cached menu");
-    }
     log.debug("getMenu took {} ms", System.currentTimeMillis() - t);
     return cachedMenu;
   }
@@ -203,21 +188,35 @@
     }
   }
 
-  @SuppressWarnings("unchecked")
   private void linkWindows() {
-    final String windowsHql = "select wa.window.id " + //
+    final String windowsHql = "select wa.window.id, t.id, ta.editableField, wa.editableField" + //
         " from ADWindowAccess wa " + //
-        "where wa.role = :role" + //
-        "  and wa.active = true ";
+        " left join wa.aDTabAccessList as ta " + //
+        " left join ta.tab as t with t.tabLevel = 0 " + //
+        " where wa.role = :role" + //
+        " and wa.active = true " + //
+        " and (ta.active = true or ta.active is null) " + //
+        " order by wa.id, t.sequenceNumber DESC ";
     final Query windowsQry = OBDal.getInstance().getSession().createQuery(windowsHql);
     windowsQry.setParameter("role", OBContext.getOBContext().getRole());
 
-    for (String windowId : (List<String>) windowsQry.list()) {
+    for (Object obj : windowsQry.list()) {
+      final Object[] row = (Object[]) obj;
+      final String windowId = (String) row[0];
+      final String tabId = (String) row[1];
+      final Boolean isEditableTab = (Boolean) row[2];
+      final Boolean isEditableWindow = (Boolean) row[3];
       MenuOption option = getMenuOptionByType(MenuEntryType.Window, windowId);
       if (option != null) {
         boolean hasAccess = !SessionFactoryController.isRunningInWebContainer()
             || ActivationKey.getInstance().hasLicenseAccess("MW", windowId) == FeatureRestriction.NO_RESTRICTION;
         option.setAccessGranted(hasAccess);
+
+        if (tabId == null) {
+          option.setIsReadOnlyForRole(!isEditableWindow);
+        } else {
+          option.setIsReadOnlyForRole(!isEditableTab);
+        }
       }
     }
   }
@@ -283,10 +282,11 @@
     private MenuOption parentMenuOption;
     private List<MenuOption> children = new ArrayList<MenuOption>();
     private Boolean visible = null;
-    private boolean showInClassicMode = false;
     private String objectId;
+    private boolean isModal;
 
     private boolean accessGranted = false;
+    private Boolean isReadOnlyForRole = false;
 
     public MenuOption() {
       // Default constructor, just sets all the defaults
@@ -303,8 +303,8 @@
       this.tab = option.tab;
       this.form = option.form;
       this.isReport = option.isReport;
-      this.showInClassicMode = option.showInClassicMode;
       this.objectId = option.objectId;
+      this.isModal = option.isModal;
     }
 
     public boolean isSingleRecord() {
@@ -322,7 +322,7 @@
      */
     public boolean isReadOnly() {
       boolean tabIsReadOnlyForAll = getTab() != null && getTab().getUIPattern().equals("RO");
-      boolean tabIsReadOnlyForRole = isTabReadOnlyforRole();
+      boolean tabIsReadOnlyForRole = tabIsReadOnlyForAll || isTabReadOnlyforRole();
       return tabIsReadOnlyForAll || tabIsReadOnlyForRole;
     }
 
@@ -331,47 +331,23 @@
      * TabAccess entities
      */
     public boolean isTabReadOnlyforRole() {
-      boolean isReadOnly = false;
+
       // If there is no tab there is nothing to check
       if (getTab() == null) {
         return false;
+      } else {
+        return this.getIsReadOnlyForRole();
       }
-      // Obtains the Window Access for the current role
-      Role role = OBContext.getOBContext().getRole();
-      OBCriteria<WindowAccess> windowAccessCriteria = OBDal.getInstance().createCriteria(
-          WindowAccess.class);
-      windowAccessCriteria.add(Restrictions.eq(WindowAccess.PROPERTY_ROLE, role));
-      windowAccessCriteria.add(Restrictions.eq(WindowAccess.PROPERTY_WINDOW, getTab().getWindow()));
-      WindowAccess windowAccess = (WindowAccess) windowAccessCriteria.uniqueResult();
-      if (windowAccess != null) {
-        // there is a window access defined for this window and this role
-        OBCriteria<TabAccess> tabAccessCriteria = OBDal.getInstance().createCriteria(
-            TabAccess.class);
-        tabAccessCriteria.add(Restrictions.eq(TabAccess.PROPERTY_TAB, tab));
-        tabAccessCriteria.add(Restrictions.eq(TabAccess.PROPERTY_WINDOWACCESS, windowAccess));
-        TabAccess tabAccess = (TabAccess) tabAccessCriteria.uniqueResult();
-        if (tabAccess != null) {
-          // there is a window access defined and a tab access defined too
-          // The menu entry will be read only if the tab is not editable by this role
-          isReadOnly = !tabAccess.isEditableField();
-          //
-        } else {
-          // There is a window access defined but there is not a tab access defined
-          // The menu entry will be read only if the window is not editable by this role
-          isReadOnly = !windowAccess.isEditableField();
-        }
-      } else {
-        // there is not a window access defined. the user should not even be capable of opening the
-        // window
-        isReadOnly = true;
-      }
-      return isReadOnly;
     }
 
     public String getReadOnlyStringValue() {
       return Boolean.toString(isReadOnly());
     }
 
+    private Boolean getIsReadOnlyForRole() {
+      return isReadOnlyForRole;
+    }
+
     public boolean isEditOrDeleteOnly() {
       return getTab() != null && getTab().getUIPattern().equals("ED");
     }
@@ -418,11 +394,10 @@
 
     public boolean isAccessible() {
       // In order to be accessible, all its menu entry parents must be active;
-      Menu menuEntry = OBDal.getInstance().get(Menu.class, treeNode.getNode());
       if (parentMenuOption == null) {
-        return menuEntry.isActive();
+        return treeNode.isActive();
       } else {
-        return menuEntry.isActive() && parentMenuOption.isAccessible();
+        return treeNode.isActive() && parentMenuOption.isAccessible();
       }
     }
 
@@ -539,13 +514,11 @@
     }
 
     public boolean isModal() {
-      if (isProcess()) {
-        // done via isModelProcess(String) as is called from different request and getProcess() is
-        // not initialized
-        String processId = getMenu().getProcess().getId();
-        return Utility.isModalProcess(processId);
-      }
-      return true;
+      return isModal;
+    }
+
+    public void setModal(boolean isModal) {
+      this.isModal = isModal;
     }
 
     public boolean isProcessManual() {
@@ -574,7 +547,6 @@
 
     public void setTab(Tab tab) {
       this.tab = tab;
-      showInClassicMode = ApplicationUtils.showWindowInClassicMode(tab.getWindow());
     }
 
     public List<MenuParameter> getParameters() {
@@ -587,10 +559,6 @@
       return parameters;
     }
 
-    public boolean isShowInClassicMode() {
-      return showInClassicMode;
-    }
-
     public String getDbId() {
       return dbId;
     }
@@ -606,6 +574,10 @@
     public void setObjectId(String objectId) {
       this.objectId = objectId;
     }
+
+    public void setIsReadOnlyForRole(Boolean isReadOnlyForRole) {
+      this.isReadOnlyForRole = isReadOnlyForRole;
+    }
   }
 
   private static class MenuComparator implements Comparator<MenuOption> {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/NavigationBarComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,47 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.application;
+
+import java.util.Collection;
+
+import org.openbravo.client.application.NavigationBarComponentGenerator.NBComponent;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
+
+/**
+ * This class generates the set of navigation bar components which are accessible for the user of
+ * the current context.
+ * 
+ */
+public class NavigationBarComponent extends SessionDynamicTemplateComponent {
+
+  @Override
+  public String getId() {
+    return ApplicationConstants.NAVIGATION_BAR_ID;
+  }
+
+  @Override
+  protected String getTemplateId() {
+    return ApplicationConstants.NAVIGATION_BAR_TEMPLATE_ID;
+  }
+
+  public Collection<NBComponent> getNavigationBarComponents() {
+    return NavigationBarComponentGenerator.getInstance()
+        .getNavigationBarComponents(getParameters());
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/NavigationBarComponentGenerator.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,158 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.application;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.openbravo.base.provider.OBSingleton;
+import org.openbravo.base.util.OBClassLoader;
+import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.client.kernel.BaseComponent;
+import org.openbravo.client.kernel.BaseTemplateComponent;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+
+/**
+ * This class generates the javascript code of the navigation bar components.
+ * 
+ */
+public class NavigationBarComponentGenerator implements OBSingleton {
+
+  @Inject
+  private WeldUtils weldUtils;
+
+  private static NavigationBarComponentGenerator instance;
+
+  protected static synchronized NavigationBarComponentGenerator getInstance() {
+    if (instance == null) {
+      instance = WeldUtils.getInstanceFromStaticBeanManager(NavigationBarComponentGenerator.class);
+    }
+    return instance;
+  }
+
+  /**
+   * Generates the code of the navigation bar components.
+   * 
+   * @param parameters
+   *          A map with the parameters to be used in the generation of the component.
+   * 
+   * @return a Collection with the generated navigation bar components
+   */
+  protected Collection<NBComponent> getNavigationBarComponents(Map<String, Object> parameters) {
+    return generateNavigationBarComponents(parameters, false);
+  }
+
+  /**
+   * Generates the code of the dynamic navigation bar components.
+   * 
+   * @param parameters
+   *          A map with the parameters to be used in the generation of the component.
+   * 
+   * @return a Collection with the generated dynamic navigation bar components
+   */
+  protected Collection<NBComponent> getDynamicNavigationBarComponents(Map<String, Object> parameters) {
+    return generateNavigationBarComponents(parameters, true);
+  }
+
+  private Collection<NBComponent> generateNavigationBarComponents(Map<String, Object> parameters,
+      boolean generateDynamicComponents) {
+    final List<NBComponent> nbComponents = new ArrayList<NBComponent>();
+    for (NavBarComponent nbc : getNavigationBarComponentList()) {
+
+      if (!isAccessible(nbc) || (nbc.isStaticcomponent() && generateDynamicComponents)) {
+        continue;
+      }
+
+      final NBComponent nbComponent = new NBComponent();
+
+      String jsCode;
+      if (nbc.isStaticcomponent() || generateDynamicComponents) {
+        jsCode = generateComponent(nbc, parameters);
+      } else {
+        jsCode = "{className: '_OBNavBarDynamicComponent'}";
+      }
+      nbComponent.setJscode(jsCode);
+      nbComponents.add(nbComponent);
+    }
+    return nbComponents;
+  }
+
+  private List<NavBarComponent> getNavigationBarComponentList() {
+    OBCriteria<NavBarComponent> criteria = OBDal.getInstance()
+        .createCriteria(NavBarComponent.class);
+    criteria.addOrderBy(NavBarComponent.PROPERTY_RECORDSORTNO, true);
+    return criteria.list();
+  }
+
+  private boolean isAccessible(NavBarComponent navBarComponent) {
+    if (OBContext.getOBContext().getRole().getId().equals("0")) {
+      return true;
+    }
+    if (navBarComponent.isAllroles()) {
+      return true;
+    }
+    final String currentRoleId = OBContext.getOBContext().getRole().getId();
+    for (NavbarRoleaccess roleAccess : navBarComponent.getOBUIAPPNavbarRoleaccessList()) {
+      if (currentRoleId.equals(roleAccess.getRole().getId())) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  @SuppressWarnings("unchecked")
+  private String generateComponent(NavBarComponent nbc, Map<String, Object> parameters) {
+    try {
+      final Class<BaseTemplateComponent> clz = (Class<BaseTemplateComponent>) OBClassLoader
+          .getInstance().loadClass(nbc.getJavaClassName());
+      final BaseComponent component = weldUtils.getInstance(clz);
+      component.setId(nbc.getId());
+      if (component instanceof BaseTemplateComponent && nbc.getTemplate() != null) {
+        ((BaseTemplateComponent) component).setComponentTemplate(nbc.getTemplate());
+      }
+      component.setParameters(parameters);
+      return component.generate();
+    } catch (Exception e) {
+      throw new IllegalStateException("Exception when creating component " + nbc.getId(), e);
+    }
+  }
+
+  public static class NBComponent {
+    // NB stands for: Navigation Bar
+    private String jscode;
+
+    public void setJscode(String jscode) {
+      this.jscode = jscode;
+    }
+
+    public String getJscode() {
+      return jscode;
+    }
+
+    public String toString() {
+      return jscode;
+    }
+  }
+}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/PropertiesComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/PropertiesComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -25,10 +25,8 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
-import org.openbravo.client.kernel.BaseTemplateComponent;
-import org.openbravo.client.kernel.Template;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.model.ad.domain.Preference;
 
@@ -37,37 +35,17 @@
  * 
  * @author mtaal
  */
-public class PropertiesComponent extends BaseTemplateComponent {
+public class PropertiesComponent extends SessionDynamicTemplateComponent {
   private static final Logger log = Logger.getLogger(PropertiesComponent.class);
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.client.kernel.BaseTemplateComponent#getComponentTemplate()
-   */
   @Override
-  protected Template getComponentTemplate() {
-    return OBDal.getInstance().get(Template.class, ApplicationConstants.PROPERTIES_TEMPLATE_ID);
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.client.kernel.BaseComponent#getId()
-   */
   public String getId() {
     return ApplicationConstants.PROPERTIES_COMPONENT_ID;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.client.kernel.Component#getETag()
-   */
-  public String getETag() {
-    // is never cached
-    return OBContext.getOBContext().getUser().getId() + "_"
-        + OBContext.getOBContext().getLanguage().getId() + "_" + System.currentTimeMillis();
+  @Override
+  protected String getTemplateId() {
+    return ApplicationConstants.PROPERTIES_TEMPLATE_ID;
   }
 
   public Collection<LocalProperty> getProperties() {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Thu Sep 14 12:03:42 2017 +0000
@@ -131,7 +131,8 @@
               jTab.put("fields", jFields);
               final Set<String> fields = new TreeSet<String>();
               for (Field field : tabAccess.getTab().getADFieldList()) {
-                if (!field.isReadOnly() && !field.isShownInStatusBar()) {
+                if (!field.isReadOnly() && !field.isShownInStatusBar()
+                    && field.getColumn().isUpdatable()) {
                   final Property property = KernelUtils.getProperty(entity, field);
                   if (property != null) {
                     fields.add(property.getName());
@@ -144,8 +145,10 @@
                   if (property != null) {
                     final String name = KernelUtils.getProperty(entity, fieldAccess.getField())
                         .getName();
-                    jFields.put(name, fieldAccess.isEditableField());
-                    fields.remove(name);
+                    if (fields.contains(name)) {
+                      jFields.put(name, fieldAccess.isEditableField());
+                      fields.remove(name);
+                    }
                   }
                 }
               }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachImplementationManager.java	Thu Sep 14 12:03:42 2017 +0000
@@ -148,9 +148,6 @@
         } else {
           attachMethod = AttachmentUtils.getDefaultAttachmentMethod();
         }
-        // The information of the existing attachment may have not changed. Force the update of the
-        // 'updated' field, the rest of the audit information will be updated automatically.
-        attachment.setUpdated(new Date());
       }
       attachment.setOrganization(org);
       String strDataType = null;
@@ -516,15 +513,9 @@
 
       String strValue = "";
       if (value == null || (value instanceof String && StringUtils.isEmpty((String) value))) {
+        // There is no value for this parameter. Remove metadataStoredValue from Database.
         metadataValues.put(strMetadataId, null);
-        // There is no value for this parameter. Just do not create it if is new or set its value to
-        // null if it already existed in order to keep the correct last updated information of the
-        // attachment
-        if (metadataStoredValue.isNewOBObject()) {
-          OBDal.getInstance().remove(metadataStoredValue);
-        } else {
-          ParameterUtils.setParameterValue(metadataStoredValue, getJSONValue(""));
-        }
+        OBDal.getInstance().remove(metadataStoredValue);
       } else {
         String strReferenceId = parameter.getReference().getId();
         if (REFERENCE_LIST.equals(strReferenceId)) {
@@ -567,8 +558,12 @@
           } else {
             strValue = value.toString();
           }
-
-          ParameterUtils.setParameterValue(metadataStoredValue, getJSONValue(strValue));
+          JSONObject jsonValue = new JSONObject();
+          try {
+            jsonValue.put("value", strValue);
+          } catch (JSONException ignore) {
+          }
+          ParameterUtils.setParameterValue(metadataStoredValue, jsonValue);
           metadataValues.put(strMetadataId, ParameterUtils.getParameterValue(metadataStoredValue));
         }
         OBDal.getInstance().save(metadataStoredValue);
@@ -583,13 +578,4 @@
 
     return metadataValues;
   }
-
-  private JSONObject getJSONValue(String value) {
-    JSONObject jsonValue = new JSONObject();
-    try {
-      jsonValue.put("value", value);
-    } catch (JSONException ignore) {
-    }
-    return jsonValue;
-  }
 }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentUtils.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/attachment/AttachmentUtils.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2015-2017 Openbravo SLU
+ * All portions are Copyright (C) 2015-2016 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -169,7 +169,7 @@
     OBCriteria<Attachment> attachmentFiles = OBDao.getFilteredCriteria(Attachment.class,
         Restrictions.eq("table.id", tableId), Restrictions.in("record", recordIds));
     attachmentFiles.addOrderBy("creationDate", false);
-    List<JSONObject> attachments = new ArrayList<>();
+    List<JSONObject> attachments = new ArrayList<JSONObject>();
     // do not filter by the attachment's organization
     // if the user has access to the record where the file its attached, it has access to all its
     // attachments
@@ -179,8 +179,7 @@
       try {
         attachmentobj.put("id", attachment.getId());
         attachmentobj.put("name", attachment.getName());
-        attachmentobj.put("age", (new Date().getTime() - getLastUpdateOfAttachment(attachment)
-            .getTime()));
+        attachmentobj.put("age", (new Date().getTime() - attachment.getUpdated().getTime()));
         attachmentobj.put("updatedby", attachment.getUpdatedBy().getName());
         String attachmentMethod = DEFAULT_METHOD_ID;
         if (attachment.getAttachmentConf() != null) {
@@ -196,20 +195,6 @@
     return attachments;
   }
 
-  private static Date getLastUpdateOfAttachment(Attachment attachment) {
-    final StringBuilder hql = new StringBuilder();
-    hql.append("SELECT MAX(pv.updated) FROM OBUIAPP_ParameterValue pv");
-    hql.append(" WHERE pv.file.id =:fileId");
-    final Query query = OBDal.getInstance().getSession().createQuery(hql.toString());
-    query.setParameter("fileId", attachment.getId());
-    query.setMaxResults(1);
-    Date metadataLastUpdate = (Date) query.uniqueResult();
-    if (metadataLastUpdate == null || attachment.getUpdated().after(metadataLastUpdate)) {
-      return attachment.getUpdated();
-    }
-    return metadataLastUpdate;
-  }
-
   /**
    * Get the String value of a parameter with a property path
    * 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/ApplicationMenuComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/ApplicationMenuComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,22 +22,29 @@
 
 import javax.inject.Inject;
 
+import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.client.application.MenuManager;
 import org.openbravo.client.application.MenuManager.MenuOption;
-import org.openbravo.client.kernel.BaseTemplateComponent;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
 
 /**
- * Provides a widget to open a classic view from the database.
+ * Provides the set of menu entries which are accessible for the user of the current context.
  * 
  * @author mtaal
  */
-public class ApplicationMenuComponent extends BaseTemplateComponent {
+public class ApplicationMenuComponent extends SessionDynamicTemplateComponent {
 
   @Inject
   private MenuManager menuManager;
 
-  public String getLabel() {
-    return "UINAVBA_APPLICATION_MENU";
+  @Override
+  public String getId() {
+    return ApplicationConstants.APPLICATION_MENU_ID;
+  }
+
+  @Override
+  protected String getTemplateId() {
+    return ApplicationConstants.APPLICATION_MENU_TEMPLATE_ID;
   }
 
   // creates the menu items on the basis of the hierarchical tree
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/QuickCreateComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application.navigationbarcomponents;
-
-import javax.enterprise.inject.Any;
-import javax.inject.Inject;
-
-import org.openbravo.client.kernel.BaseTemplateComponent;
-import org.openbravo.service.datasource.DataSourceComponentProvider;
-
-/**
- * Provides a widget to open a classic view from the database in create mode.
- * 
- * @author mtaal
- */
-public class QuickCreateComponent extends BaseTemplateComponent {
-
-  public static final String DATASOURCE_ID = "C17951F970E942FD9F3771B7BE91D049";
-
-  @Inject
-  @Any
-  private DataSourceComponentProvider dataSourceomponentProvider;
-
-  public String getDataSourceJavascript() {
-    return dataSourceomponentProvider.getDataSourceJavascript(DATASOURCE_ID, getParameters());
-  }
-
-  public String getDataSourceId() {
-    return DATASOURCE_ID;
-  }
-
-  public String getPrefixRecent() {
-    return "UINAVBA_NEW";
-  }
-
-  public String getCommand() {
-    return "NEW";
-  }
-
-  public String getLabel() {
-    return "UINAVBA_CREATE_NEW";
-  }
-
-  public String getButtonType() {
-    return "createNew";
-  }
-
-  public String getRecentPropertyName() {
-    return "UINAVBA_RecentCreateList";
-  }
-
-  public String getKeyboardShortcutId() {
-    return "NavBar_OBQuickCreate";
-  }
-
-  public boolean isQuickLaunch() {
-    return false;
-  }
-
-}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/QuickCreateDataSource.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,128 +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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application.navigationbarcomponents;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.openbravo.client.application.MenuManager;
-import org.openbravo.client.application.MenuManager.MenuOption;
-import org.openbravo.dal.core.OBContext;
-import org.openbravo.service.datasource.ReadOnlyDataSourceService;
-import org.openbravo.service.json.JsonConstants;
-
-/**
- * Reads the entities which the user is allowed to create and the tabs which can be used to create
- * the entity.
- * 
- * @author mtaal
- */
-public class QuickCreateDataSource extends ReadOnlyDataSourceService {
-
-  @Inject
-  private MenuManager menuManager;
-
-  /**
-   * Returns the count of objects based on the passed parameters.
-   * 
-   * @param parameters
-   *          the parameters passed in from the request
-   * @return the total number of objects
-   */
-  protected int getCount(Map<String, String> parameters) {
-    return getData(parameters, 0, Integer.MAX_VALUE).size();
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.service.datasource.ReadOnlyDataSourceService#getData(java.util.Map, int,
-   * int)
-   */
-  protected List<Map<String, Object>> getData(Map<String, String> parameters, int startRow,
-      int endRow) {
-    OBContext.setAdminMode();
-    try {
-      final List<MenuOption> menuOptions = menuManager.getSelectableMenuOptions();
-      final List<MenuOption> filteredMenuOptions = new ArrayList<MenuOption>();
-      String filterOn = parameters.get(JsonConstants.IDENTIFIER);
-      if (filterOn != null) {
-        filterOn = filterOn.toLowerCase().trim();
-      }
-      for (MenuOption menuOption : menuOptions) {
-        if (menuOption.getType() == MenuManager.MenuEntryType.Window) {
-          if (filterOn == null || menuOption.getLabel().toLowerCase().contains(filterOn)) {
-            filteredMenuOptions.add(menuOption);
-          }
-        }
-      }
-      List<MenuOption> returnList = filteredMenuOptions;
-      if (startRow > -1 && endRow > -1) {
-        if (startRow >= returnList.size()) {
-          returnList.clear();
-        } else if (endRow >= returnList.size()) {
-          returnList = returnList.subList(startRow, returnList.size());
-        } else {
-          returnList = returnList.subList(startRow, endRow);
-        }
-      }
-      final List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
-      for (MenuOption menuOption : returnList) {
-        final Map<String, Object> data = new HashMap<String, Object>();
-
-        // read only tab
-        if (menuOption.isSingleRecord() || menuOption.isReadOnly()
-            || menuOption.isEditOrDeleteOnly()) {
-          continue;
-        }
-
-        final String icon;
-        if (menuOption.isForm()) {
-          icon = "Process";
-        } else if (menuOption.isReport()) {
-          icon = "Report";
-        } else if (menuOption.isProcess() || menuOption.isProcessManual()) {
-          icon = "Process";
-        } else {
-          icon = "Window";
-        }
-        data.put("icon", icon);
-        data.put("modal", menuOption.isModal());
-
-        data.put(JsonConstants.IDENTIFIER, menuOption.getLabel());
-        // use dbid to be sure that it is unique
-        data.put(JsonConstants.ID, menuOption.getDbId());
-        data.put("viewValue", menuOption.getId());
-        data.put(QuickLaunchDataSource.OPTION_TYPE, QuickLaunchDataSource.OPTION_TYPE_TAB);
-        if (menuOption.getMenu() != null && menuOption.getMenu().getWindow() != null) {
-          data.put(QuickLaunchDataSource.WINDOW_ID, menuOption.getMenu().getWindow().getId());
-        }
-        result.add(data);
-      }
-      sort(JsonConstants.IDENTIFIER, result);
-      return result;
-    } finally {
-      OBContext.restorePreviousMode();
-    }
-  }
-}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/QuickLaunchComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application.navigationbarcomponents;
-
-import javax.enterprise.inject.Any;
-import javax.inject.Inject;
-
-import org.openbravo.client.kernel.BaseTemplateComponent;
-import org.openbravo.service.datasource.DataSourceComponentProvider;
-
-/**
- * Provides a widget to open a classic view from the database.
- * 
- * @author mtaal
- */
-public class QuickLaunchComponent extends BaseTemplateComponent {
-
-  private static final String DATASOURCE_ID = "99B9CC42FDEA4CA7A4EE35BC49D61E0E";
-
-  @Inject
-  @Any
-  private DataSourceComponentProvider dataSourceComponentProvider;
-
-  public String getDataSourceJavascript() {
-    return dataSourceComponentProvider.getDataSourceJavascript(DATASOURCE_ID, getParameters());
-  }
-
-  public String getPrefixRecent() {
-    return "";
-  }
-
-  public String getCommand() {
-    return "DEFAULT";
-  }
-
-  public String getDataSourceId() {
-    return DATASOURCE_ID;
-  }
-
-  public String getLabel() {
-    return "UINAVBA_QUICK_LAUNCH";
-  }
-
-  public String getButtonType() {
-    return "quickLaunch";
-  }
-
-  public String getRecentPropertyName() {
-    return "UINAVBA_RecentLaunchList";
-  }
-
-  public String getKeyboardShortcutId() {
-    return "NavBar_OBQuickLaunch";
-  }
-
-  public boolean isQuickLaunch() {
-    return true;
-  }
-}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/QuickLaunchDataSource.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +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) 2010-2016 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application.navigationbarcomponents;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.openbravo.client.application.ApplicationConstants;
-import org.openbravo.client.application.MenuManager;
-import org.openbravo.client.application.MenuManager.MenuOption;
-import org.openbravo.client.application.MenuParameter;
-import org.openbravo.dal.core.OBContext;
-import org.openbravo.service.datasource.ReadOnlyDataSourceService;
-import org.openbravo.service.json.JsonConstants;
-
-/**
- * Reads the tabs which the user is allowed to see.
- * 
- * @author mtaal
- */
-public class QuickLaunchDataSource extends ReadOnlyDataSourceService {
-
-  public static final String OPTION_TYPE = "optionType";
-  public static final String OPTION_TYPE_EXTERNAL = "external";
-  public static final String OPTION_TYPE_URL = "url";
-  public static final String OPTION_TYPE_PROCESS = "process";
-  public static final String OPTION_TYPE_TAB = "tab";
-  public static final String OPTION_TYPE_PROCESS_DEFINITION = "processDefinition";
-  public static final String OPTION_SINGLE_RECORD = "singleRecord";
-  public static final String OPTION_READ_ONLY = "readOnly";
-  public static final String OPTION_EDIT_OR_DELETE_ONLY = "editOrDeleteOnly";
-  public static final String PROCESS_ID = "processId";
-  public static final String WINDOW_ID = "windowId";
-  public static final String FORM_ID = "formId";
-  public static final String OPEN_LINK_IN_BROWSER = "openLinkInBrowser";
-
-  @Inject
-  private MenuManager menuManager;
-
-  /**
-   * Returns the count of objects based on the passed parameters.
-   * 
-   * @param parameters
-   *          the parameters passed in from the request
-   * @return the total number of objects
-   */
-  protected int getCount(Map<String, String> parameters) {
-    return getData(parameters, 0, Integer.MAX_VALUE).size();
-  }
-
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.openbravo.service.datasource.ReadOnlyDataSourceService#getData(java.util.Map, int,
-   * int)
-   */
-  protected List<Map<String, Object>> getData(Map<String, String> parameters, int startRow,
-      int endRow) {
-    OBContext.setAdminMode();
-    try {
-      final List<MenuOption> menuOptions = menuManager.getSelectableMenuOptions();
-      final List<MenuOption> filteredMenuOptions = new ArrayList<MenuOption>();
-      String filterOn = parameters.get(JsonConstants.IDENTIFIER);
-      if (filterOn != null) {
-        filterOn = filterOn.toLowerCase().trim();
-      }
-      for (MenuOption menuOption : menuOptions) {
-        if (filterOn == null || menuOption.getLabel().toLowerCase().contains(filterOn)) {
-          filteredMenuOptions.add(menuOption);
-        }
-      }
-      List<MenuOption> returnList = filteredMenuOptions;
-      if (startRow > -1 && endRow > -1) {
-        if (startRow >= returnList.size()) {
-          returnList.clear();
-        } else if (endRow >= returnList.size()) {
-          returnList = returnList.subList(startRow, returnList.size());
-        } else {
-          returnList = returnList.subList(startRow, endRow);
-        }
-      }
-      final List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
-      for (MenuOption menuOption : returnList) {
-        final Map<String, Object> data = new HashMap<String, Object>();
-        data.put(JsonConstants.IDENTIFIER, menuOption.getLabel());
-        if (menuOption.isWindow()) {
-          data.put(OPTION_TYPE, OPTION_TYPE_TAB);
-          data.put(WINDOW_ID, menuOption.getMenu().getWindow().getId());
-          data.put(OPTION_SINGLE_RECORD, menuOption.isSingleRecord());
-          data.put(OPTION_READ_ONLY, menuOption.isReadOnly());
-          data.put(OPTION_EDIT_OR_DELETE_ONLY, menuOption.isEditOrDeleteOnly());
-        } else if (menuOption.isProcess()) {
-          data.put(OPTION_TYPE, "process");
-          data.put(PROCESS_ID, menuOption.getMenu().getProcess().getId());
-        } else if (menuOption.isProcessManual()) {
-          data.put(OPTION_TYPE, "processManual");
-          data.put(PROCESS_ID, menuOption.getMenu().getProcess().getId());
-        } else if (menuOption.isExternal()) {
-          data.put(OPTION_TYPE, OPTION_TYPE_EXTERNAL);
-          data.put(OPEN_LINK_IN_BROWSER, menuOption.getMenu().isOpenlinkinbrowser());
-        } else if (menuOption.isForm()) {
-          data.put(OPTION_TYPE, OPTION_TYPE_URL);
-          data.put(FORM_ID, menuOption.getFormId());
-        } else if (menuOption.isReport() && !menuOption.isProcessDefinition()) {
-          data.put(OPTION_TYPE, OPTION_TYPE_URL);
-          data.put(PROCESS_ID, menuOption.getMenu().getProcess().getId());
-        } else if (menuOption.isProcessDefinition()) {
-          data.put(OPTION_TYPE, OPTION_TYPE_PROCESS_DEFINITION);
-          data.put(PROCESS_ID, menuOption.getMenu().getOBUIAPPProcessDefinition().getId());
-        } else {
-          data.put(OPTION_TYPE, OPTION_TYPE_URL);
-        }
-
-        final String icon;
-        if (menuOption.isForm()) {
-          icon = "Form";
-        } else if (menuOption.isReport()) {
-          icon = "Report";
-        } else if (menuOption.isProcess() || menuOption.isProcessManual()
-            || menuOption.isProcessDefinition()) {
-          icon = "Process";
-        } else if (menuOption.isExternal()) {
-          icon = "ExternalLink";
-        } else {
-          icon = "Window";
-        }
-        data.put("icon", icon);
-
-        // use dbid to be sure that it is unique
-        data.put(JsonConstants.ID, menuOption.getDbId());
-        data.put("viewValue", menuOption.getId());
-        data.put("modal", menuOption.isModal());
-        for (MenuParameter parameter : menuOption.getMenu().getOBUIAPPMenuParametersList()) {
-          if (parameter.isActive()) {
-            data.put(parameter.getName(), parameter.getParameterValue());
-          }
-        }
-        // set the view id and tab title
-        if (menuOption.getMenu().getObuiappView() != null) {
-          data.put(ApplicationConstants.VIEWID, menuOption.getMenu().getObuiappView().getName());
-          data.put(ApplicationConstants.TAB_TITLE, menuOption.getLabel());
-        }
-        result.add(data);
-      }
-      sort(JsonConstants.IDENTIFIER, result);
-      return result;
-    } finally {
-      OBContext.restorePreviousMode();
-    }
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/RoleInfo.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,154 @@
+/*
+ *************************************************************************
+ * 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) 2010-2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.client.application.navigationbarcomponents;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.hibernate.Query;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.security.OrganizationStructureProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.ad.access.Role;
+
+/**
+ * This class provides the organizations and warehouses that can be accessed for a particular role.
+ * It is is used to populate the 'Profile' widget with the information related to the roles assigned
+ * to the current user.
+ */
+public class RoleInfo {
+  private String roleId;
+  private String roleName;
+  private String clientId;
+  private String clientName;
+  private Map<String, String> roleOrganizations;
+  private Map<String, List<RoleWarehouseInfo>> organizationWarehouses;
+
+  public RoleInfo(Object[] roleInfo) {
+    this.roleId = (String) roleInfo[0];
+    this.roleName = (String) roleInfo[1];
+    this.clientId = (String) roleInfo[2];
+    this.clientName = (String) roleInfo[3];
+  }
+
+  public RoleInfo(Role role) {
+    this.roleId = role.getId();
+    this.roleName = role.getIdentifier();
+    this.clientId = role.getClient().getId();
+    this.clientName = role.getClient().getIdentifier();
+  }
+
+  public String getRoleId() {
+    return roleId;
+  }
+
+  public String getRoleName() {
+    return roleName;
+  }
+
+  public String getClientId() {
+    return clientId;
+  }
+
+  public String getClientName() {
+    return clientName;
+  }
+
+  private OrganizationStructureProvider getOrganizationStructureProvider() {
+    return OBContext.getOBContext().getOrganizationStructureProvider(clientId);
+  }
+
+  public Map<String, String> getOrganizations() {
+    if (roleOrganizations != null) {
+      return roleOrganizations;
+    }
+    roleOrganizations = new LinkedHashMap<>();
+
+    final StringBuilder hql = new StringBuilder();
+    hql.append("select ro.organization.id, ro.organization.name from ADRoleOrganization ro ");
+    hql.append("where ro.role.id=:roleId and ro.organization.active=true ");
+    Query roleOrgs = OBDal.getInstance().getSession().createQuery(hql.toString());
+    roleOrgs.setString("roleId", roleId);
+    for (Object entry : roleOrgs.list()) {
+      final Object[] orgInfo = (Object[]) entry;
+      roleOrganizations.put((String) orgInfo[0], (String) orgInfo[1]);
+    }
+    return roleOrganizations;
+  }
+
+  public Map<String, List<RoleWarehouseInfo>> getOrganizationWarehouses() {
+    if (organizationWarehouses != null) {
+      return organizationWarehouses;
+    }
+    organizationWarehouses = new LinkedHashMap<>();
+
+    if (getOrganizations().isEmpty()) {
+      return organizationWarehouses;
+    }
+
+    for (String orgId : getOrganizations().keySet()) {
+      organizationWarehouses.put(orgId, new ArrayList<RoleWarehouseInfo>());
+    }
+
+    final StringBuilder hql = new StringBuilder();
+    hql.append("select w.id, w.name, w.organization.id from Warehouse w ");
+    hql.append("where w.organization.id in (:orgList) and w.client.id=:clientId and w.organization.active=true ");
+    Query orgWarehouses = OBDal.getInstance().getSession().createQuery(hql.toString());
+    orgWarehouses.setParameterList("orgList", getOrganizations().keySet());
+    orgWarehouses.setString("clientId", clientId);
+    for (Object entry : orgWarehouses.list()) {
+      RoleWarehouseInfo warehouseInfo = new RoleWarehouseInfo((Object[]) entry);
+      for (String orgId : organizationWarehouses.keySet()) {
+        Set<String> naturalTree = getOrganizationStructureProvider().getNaturalTree(orgId);
+        if (naturalTree.contains(warehouseInfo.getWarehouseOrganizationId())) {
+          organizationWarehouses.get(orgId).add(warehouseInfo);
+        }
+      }
+    }
+    return organizationWarehouses;
+  }
+
+  public class RoleWarehouseInfo {
+    private String warehouseId;
+    private String warehouseName;
+    private String warehouseOrganizationId;
+
+    public RoleWarehouseInfo(Object[] warehouseInfo) {
+      this.warehouseId = (String) warehouseInfo[0];
+      this.warehouseName = (String) warehouseInfo[1];
+      this.warehouseOrganizationId = (String) warehouseInfo[2];
+    }
+
+    public String getWarehouseId() {
+      return warehouseId;
+    }
+
+    public String getWarehouseName() {
+      return warehouseName;
+    }
+
+    public String getWarehouseOrganizationId() {
+      return warehouseOrganizationId;
+    }
+  }
+}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -11,20 +11,135 @@
  * 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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
 package org.openbravo.client.application.navigationbarcomponents;
 
-import org.openbravo.client.kernel.BaseTemplateComponent;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.hibernate.Query;
+import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.client.kernel.KernelConstants;
+import org.openbravo.client.kernel.KernelServlet;
+import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBQuery;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction;
+import org.openbravo.model.ad.access.Role;
+import org.openbravo.model.ad.system.Language;
+import org.openbravo.model.ad.system.SystemInformation;
 
 /**
- * Provides a widget to show user info.
- * 
- * @author mtaal
+ * Component that provides the context information of the current user within the 'Profile' widget.
  */
-public class UserInfoComponent extends BaseTemplateComponent {
+public class UserInfoComponent extends SessionDynamicTemplateComponent {
+  private static final String COMPONENT_ID = "UserInfo";
+  private static final String TEMPLATE_ID = "CB89E38CF75545499BF0B91FA6B233E5";
 
+  private List<RoleInfo> userRoles;
+
+  @Override
+  public String getId() {
+    return COMPONENT_ID;
+  }
+
+  @Override
+  protected String getTemplateId() {
+    return TEMPLATE_ID;
+  }
+
+  public String getContextRoleId() {
+    return OBContext.getOBContext().getRole().getId();
+  }
+
+  public String getContextClientId() {
+    return OBContext.getOBContext().getRole().getClient().getIdentifier();
+  }
+
+  public String getContextOrganizationId() {
+    return OBContext.getOBContext().getCurrentOrganization().getId();
+  }
+
+  public String getContextWarehouseId() {
+    if (OBContext.getOBContext().getWarehouse() != null) {
+      return OBContext.getOBContext().getWarehouse().getId();
+    }
+    return "";
+  }
+
+  public String getContextLanguageId() {
+    return OBContext.getOBContext().getLanguage().getId();
+  }
+
+  public List<Language> getLanguages() {
+    final OBQuery<Language> languages = OBDal.getInstance().createQuery(
+        Language.class,
+        "(" + Language.PROPERTY_SYSTEMLANGUAGE + "=true or " + Language.PROPERTY_BASELANGUAGE
+            + "=true)");
+    languages.setFilterOnReadableClients(false);
+    languages.setFilterOnReadableOrganization(false);
+    return languages.list();
+  }
+
+  public List<RoleInfo> getUserRolesInfo() {
+    if (userRoles != null) {
+      return userRoles;
+    }
+    userRoles = new ArrayList<>();
+    ActivationKey ak = ActivationKey.getInstance();
+    SystemInformation sysInfo = OBDal.getInstance().get(SystemInformation.class, "0");
+    boolean correctSystemStatus = sysInfo.getSystemStatus() == null
+        || KernelServlet.getGlobalParameters().getOBProperty("safe.mode", "false")
+            .equalsIgnoreCase("false") || sysInfo.getSystemStatus().equals("RB70");
+    if (!correctSystemStatus) {
+      userRoles.add(new RoleInfo(OBDal.getInstance().get(Role.class, "0")));
+      return userRoles;
+    }
+
+    if (getParameters().get(KernelConstants.HTTP_SESSION) != null) {
+      final HttpSession session = (HttpSession) getParameters().get(KernelConstants.HTTP_SESSION);
+      final String dbSessionId = (String) session.getAttribute("#AD_Session_ID".toUpperCase());
+      LicenseRestriction limitation = ak.checkOPSLimitations(dbSessionId);
+      if (limitation == LicenseRestriction.OPS_INSTANCE_NOT_ACTIVE
+          || limitation == LicenseRestriction.NUMBER_OF_CONCURRENT_USERS_REACHED
+          || limitation == LicenseRestriction.MODULE_EXPIRED
+          || limitation == LicenseRestriction.NOT_MATCHED_INSTANCE
+          || limitation == LicenseRestriction.HB_NOT_ACTIVE
+          || limitation == LicenseRestriction.ON_DEMAND_OFF_PLATFORM
+          || limitation == LicenseRestriction.POS_TERMINALS_EXCEEDED) {
+        userRoles.add(new RoleInfo(OBDal.getInstance().get(Role.class, "0")));
+        return userRoles;
+      }
+    }
+
+    final HttpServletRequest request = RequestContext.get().getRequest();
+    final VariablesSecureApp vars = new VariablesSecureApp(request);
+    boolean onlySystemAdminAccess = "Y".equals(vars
+        .getSessionValue("onlySystemAdminRoleShouldBeAvailableInErp"));
+    if (onlySystemAdminAccess) {
+      userRoles.add(new RoleInfo(OBDal.getInstance().get(Role.class, "0")));
+      return userRoles;
+    }
+
+    // return the complete role list for the current user
+    final StringBuilder hql = new StringBuilder();
+    hql.append("select ur.role.id, ur.role.name, ur.client.id, ur.client.name from ADUserRoles ur ");
+    hql.append("where ur.userContact.id=:userId and ur.role.active=true and ur.role.isrestrictbackend=false ");
+    Query rolesQry = OBDal.getInstance().getSession().createQuery(hql.toString());
+    rolesQry.setString("userId", OBContext.getOBContext().getUser().getId());
+    for (Object entry : rolesQry.list()) {
+      userRoles.add(new RoleInfo((Object[]) entry));
+    }
+    return userRoles;
+  }
 }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java	Thu Sep 14 12:03:42 2017 +0000
@@ -11,21 +11,18 @@
  * 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-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
 package org.openbravo.client.application.navigationbarcomponents;
 
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
 
 import org.apache.commons.lang.StringUtils;
 import org.codehaus.jettison.json.JSONArray;
@@ -35,42 +32,29 @@
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.LoginUtils;
 import org.openbravo.base.secureApp.VariablesSecureApp;
-import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.client.kernel.KernelConstants;
 import org.openbravo.client.kernel.KernelServlet;
-import org.openbravo.client.kernel.RequestContext;
-import org.openbravo.client.kernel.StaticResourceComponent;
-import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
-import org.openbravo.dal.security.OrganizationStructureProvider;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
-import org.openbravo.erpCommon.obps.ActivationKey;
-import org.openbravo.erpCommon.obps.ActivationKey.LicenseRestriction;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.access.Role;
-import org.openbravo.model.ad.access.RoleOrganization;
 import org.openbravo.model.ad.access.User;
-import org.openbravo.model.ad.access.UserRoles;
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.ad.system.Language;
-import org.openbravo.model.ad.system.SystemInformation;
 import org.openbravo.model.common.enterprise.Organization;
 import org.openbravo.model.common.enterprise.Warehouse;
 import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.db.DalConnectionProvider;
-import org.openbravo.service.json.JsonConstants;
 import org.openbravo.utils.FormatUtilities;
 
 /**
- * Action handler checks if there are alerts and if so returns these as a json object.
- * 
- * Action handler also updates the session ping value in the database.
+ * Action handler used to save the default user information of the 'Profile' widget and the password
+ * change using the 'Change Password' widget.
  * 
  * @author mtaal
- * @see StaticResourceComponent
  */
 @ApplicationScoped
 public class UserInfoWidgetActionHandler extends BaseActionHandler implements PortalAccessible {
@@ -89,8 +73,6 @@
       }
       if (command.equals(ApplicationConstants.SAVE_COMMAND)) {
         return executeSaveCommand(parameters, content);
-      } else if (command.equals(ApplicationConstants.DATA_COMMAND)) {
-        return executeDataCommand(parameters, content);
       } else if (command.equals(ApplicationConstants.CHANGE_PWD_COMMAND)) {
         return executeChangePasswordCommand(parameters, content);
       }
@@ -149,191 +131,6 @@
     return ApplicationConstants.ACTION_RESULT_SUCCESS;
   }
 
-  protected JSONObject executeDataCommand(Map<String, Object> parameters, String content)
-      throws Exception {
-    final JSONObject result = new JSONObject();
-    result.put("language", createLanguageFormItemInfo());
-    result.put("initialValues", createInitialValues());
-    result.put("role", createRoleInfo(parameters));
-    return result;
-  }
-
-  private JSONObject createRoleInfo(Map<String, Object> parameters) throws JSONException {
-    final JSONObject formItemInfo = new JSONObject();
-    formItemInfo.put("value", OBContext.getOBContext().getRole().getId());
-    final List<Role> roles = getRoles(parameters);
-    final List<Role> sortedRoles = new ArrayList<Role>(roles);
-    DalUtil.sortByIdentifier(sortedRoles);
-    final JSONArray valueMap = new JSONArray();
-    for (Role role : sortedRoles) {
-      final JSONObject valueMapItem = new JSONObject();
-      valueMapItem.put(JsonConstants.ID, role.getId());
-      valueMapItem.put(JsonConstants.IDENTIFIER, role.getIdentifier() + " - "
-          + role.getClient().getIdentifier());
-      valueMap.put(valueMapItem);
-    }
-    formItemInfo.put("valueMap", valueMap);
-
-    // now for each role store the information
-    final JSONArray jsonRoles = new JSONArray();
-
-    for (Role role : roles) {
-      final JSONObject jsonRole = new JSONObject();
-      jsonRole.put("id", role.getId());
-
-      jsonRole.put("client", role.getClient().getIdentifier());
-
-      // now set the organizations
-      final List<Organization> orgs = getOrganizations(role.getId());
-      final JSONArray orgValueMap = new JSONArray();
-      for (Organization org : orgs) {
-        final JSONObject orgValueMapItem = new JSONObject();
-        orgValueMapItem.put(JsonConstants.ID, org.getId());
-        orgValueMapItem.put(JsonConstants.IDENTIFIER, org.getIdentifier());
-        orgValueMap.put(orgValueMapItem);
-      }
-      jsonRole.put("organizationValueMap", orgValueMap);
-      jsonRole.put("warehouseOrgMap", getWarehouses(role.getClient().getId(), orgs));
-      jsonRoles.put(jsonRole);
-    }
-    formItemInfo.put("roles", jsonRoles);
-    return formItemInfo;
-  }
-
-  private JSONArray getWarehouses(String clientId, List<Organization> orgs) throws JSONException {
-    List<JSONObject> orgWarehouseArray = new ArrayList<JSONObject>();
-    final OrganizationStructureProvider osp = OBContext.getOBContext()
-        .getOrganizationStructureProvider(clientId);
-    for (Organization org : orgs) {
-      JSONObject orgWarehouse = new JSONObject();
-      orgWarehouse.put("orgId", org.getId());
-      final OBQuery<Warehouse> warehouses = OBDal
-          .getInstance()
-          .createQuery(Warehouse.class,
-              "organization.id in (:orgList) and client.id=:clientId and organization.active=true order by name");
-      warehouses.setNamedParameter("orgList", osp.getNaturalTree(org.getId()));
-      warehouses.setNamedParameter("clientId", clientId);
-      warehouses.setFilterOnReadableClients(false);
-      warehouses.setFilterOnReadableOrganization(false);
-      orgWarehouse.put("warehouseMap", createValueMapObject(warehouses.list()));
-      orgWarehouseArray.add(orgWarehouse);
-    }
-    return new JSONArray(orgWarehouseArray);
-  }
-
-  private List<Organization> getOrganizations(String roleId) throws JSONException {
-    final OBQuery<RoleOrganization> roleOrgs = OBDal.getInstance().createQuery(
-        RoleOrganization.class, "role.id=:roleId and organization.active=true");
-    roleOrgs.setFilterOnReadableClients(false);
-    roleOrgs.setFilterOnReadableOrganization(false);
-    roleOrgs.setNamedParameter("roleId", roleId);
-    final List<Organization> orgs = new ArrayList<Organization>();
-    for (RoleOrganization roleOrg : roleOrgs.list()) {
-      if (!orgs.contains(roleOrg.getOrganization())) {
-        orgs.add(roleOrg.getOrganization());
-      }
-    }
-    DalUtil.sortByIdentifier(orgs);
-    return orgs;
-  }
-
-  private JSONObject createLanguageFormItemInfo() throws JSONException {
-    final JSONObject formItemInfo = new JSONObject();
-    formItemInfo.put("value", OBContext.getOBContext().getLanguage().getId());
-
-    final OBQuery<Language> languages = OBDal.getInstance().createQuery(
-        Language.class,
-        "(" + Language.PROPERTY_SYSTEMLANGUAGE + "=true or " + Language.PROPERTY_BASELANGUAGE
-            + "=true)");
-    languages.setFilterOnReadableClients(false);
-    languages.setFilterOnReadableOrganization(false);
-    formItemInfo.put("valueMap", createValueMapObject(languages.list()));
-    return formItemInfo;
-  }
-
-  private JSONObject createInitialValues() throws JSONException {
-    final JSONObject initialValues = new JSONObject();
-    // TODO: externalize these strings
-    initialValues.put("language", OBContext.getOBContext().getLanguage().getId());
-    initialValues.put("role", OBContext.getOBContext().getRole().getId());
-    initialValues.put("client", OBContext.getOBContext().getRole().getClient().getIdentifier());
-    initialValues.put("organization", OBContext.getOBContext().getCurrentOrganization().getId());
-    if (OBContext.getOBContext().getWarehouse() != null) {
-      initialValues.put("warehouse", OBContext.getOBContext().getWarehouse().getId());
-    }
-    return initialValues;
-  }
-
-  private JSONArray createValueMapObject(List<? extends BaseOBObject> objects) throws JSONException {
-    // sort the list by their identifier
-    DalUtil.sortByIdentifier(objects);
-    final JSONArray jsonArray = new JSONArray();
-    for (BaseOBObject bob : objects) {
-      final JSONObject jsonArrayItem = new JSONObject();
-      jsonArrayItem.put(JsonConstants.ID, bob.getId());
-      jsonArrayItem.put(JsonConstants.IDENTIFIER, bob.getIdentifier());
-      jsonArray.put(jsonArrayItem);
-    }
-    return jsonArray;
-  }
-
-  protected List<Role> getRoles(Map<String, Object> parameters) {
-    ActivationKey ak = ActivationKey.getInstance();
-    SystemInformation sysInfo = OBDal.getInstance().get(SystemInformation.class, "0");
-    boolean correctSystemStatus = sysInfo.getSystemStatus() == null
-        || KernelServlet.getGlobalParameters().getOBProperty("safe.mode", "false")
-            .equalsIgnoreCase("false") || sysInfo.getSystemStatus().equals("RB70");
-    if (!correctSystemStatus) {
-      return Collections.singletonList(OBDal.getInstance().get(Role.class, "0"));
-    }
-
-    if (parameters.get(KernelConstants.HTTP_SESSION) != null) {
-      final HttpSession session = (HttpSession) parameters.get(KernelConstants.HTTP_SESSION);
-      final String dbSessionId = (String) session.getAttribute("#AD_Session_ID".toUpperCase());
-      LicenseRestriction limitation = ak.checkOPSLimitations(dbSessionId);
-      if (limitation == LicenseRestriction.OPS_INSTANCE_NOT_ACTIVE
-          || limitation == LicenseRestriction.NUMBER_OF_CONCURRENT_USERS_REACHED
-          || limitation == LicenseRestriction.MODULE_EXPIRED
-          || limitation == LicenseRestriction.NOT_MATCHED_INSTANCE
-          || limitation == LicenseRestriction.HB_NOT_ACTIVE
-          || limitation == LicenseRestriction.ON_DEMAND_OFF_PLATFORM
-          || limitation == LicenseRestriction.POS_TERMINALS_EXCEEDED) {
-        return Collections.singletonList(OBDal.getInstance().get(Role.class, "0"));
-      }
-    }
-
-    final HttpServletRequest request = RequestContext.get().getRequest();
-    final VariablesSecureApp vars = new VariablesSecureApp(request);
-    boolean onlySystemAdminAccess = "Y".equals(vars
-        .getSessionValue("onlySystemAdminRoleShouldBeAvailableInErp"));
-    if (onlySystemAdminAccess) {
-      return Collections.singletonList(OBDal.getInstance().get(Role.class, "0"));
-    }
-
-    // return the complete role list
-
-    // "        SELECT A_R.AD_ROLE_ID, A_R.NAME, A_R.AD_CLIENT_ID, A_R.CLIENTLIST " +
-    // "        FROM AD_ROLE A_R, AD_USER_ROLES A_U_R " +
-    // "        WHERE A_R.AD_ROLE_ID = A_U_R.AD_ROLE_ID " +
-    // "        AND A_U_R.ISACTIVE = 'Y' " +
-    // "        AND A_R.ISACTIVE = 'Y' " +
-    // "        AND A_U_R.AD_USER_ID = ?" +
-    // "        ORDER BY A_R.NAME";
-    final OBQuery<UserRoles> rolesQuery = OBDal.getInstance().createQuery(UserRoles.class,
-        " userContact.id=? and role.active=true and role.isrestrictbackend=false");
-    rolesQuery.setFilterOnReadableClients(false);
-    rolesQuery.setFilterOnReadableOrganization(false);
-    rolesQuery.setParameters(Collections.singletonList((Object) OBContext.getOBContext().getUser()
-        .getId()));
-    final List<Role> result = new ArrayList<Role>();
-    for (UserRoles userRole : rolesQuery.list()) {
-      if (!result.contains(userRole.getRole())) {
-        result.add(userRole.getRole());
-      }
-    }
-    return result;
-  }
-
   protected JSONObject executeSaveCommand(Map<String, Object> parameters, String content)
       throws Exception {
     final HttpServletRequest request = (HttpServletRequest) parameters
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/application-menu.js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/application-menu.js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -11,24 +11,19 @@
  * 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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
 */
 
 /* jslint */
-isc.OBApplicationMenuButton.create({
-    title: OB.I18N.getLabel('${data.label}'),
 
-    // put something in the array, otherwise there 
-    // are small styling issues
-    baseData: [        
-    <#list data.rootMenuOptions as menuOption>
-        <@createMenuItem menuOption=menuOption /><#if menuOption_has_next>,</#if>
-    </#list>
-    ]
-})
+OB.Application.menu = [
+  <#list data.rootMenuOptions as menuOption>
+    <@createMenuItem menuOption=menuOption /><#if menuOption_has_next>,</#if>
+  </#list>
+];
 
 <#macro createMenuItem menuOption>
     {title: '${menuOption.label?js_string}'
@@ -36,35 +31,60 @@
         , type: 'window'
         , tabId: '${menuOption.id?js_string}'
         , windowId: '${menuOption.menu.window.id?js_string}'
+        , optionType: 'tab'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.process>
         , type: 'process'
+        , optionType: 'process'
         , manualUrl: '${menuOption.id?js_string}'
         , processId: '${menuOption.menu.process.id}'
-        , modal: ${menuOption.modal?string}
+        , modal: '${menuOption.modal?string}'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.processManual>
         , type: 'processManual'
+        , optionType: 'processManual'
         , manualUrl: '${menuOption.id?js_string}'
         , manualProcessId: '${menuOption.menu.process.id}'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.report && !menuOption.processDefinition>
         , type: 'report'
+        , optionType: 'url'
         , manualUrl: '${menuOption.id?js_string}'
         , manualProcessId: '${menuOption.menu.process.id}'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.form>
         , type: 'form'
+        , optionType: 'url'
         , manualUrl: '${menuOption.id?js_string}'
         , formId: '${menuOption.formId?js_string}'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.external>
         , type: 'external'
+        , optionType: 'external'
         , externalUrl: '${menuOption.id?js_string}'
         , openLinkInBrowser: ${menuOption.menu.openlinkinbrowser?string}
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.view>
         , type: 'view'
+        , optionType: 'url'
         , viewId: '${menuOption.id?js_string}'
         , tabTitle: '${menuOption.label?js_string}'
+        , id:'${menuOption.dbId}'
+        , viewValue: '${menuOption.id?js_string}'
     <#elseif menuOption.processDefinition>
         , type: 'processDefinition'
+        , optionType: 'processDefinition'
         , viewId: 'processDefinition_${menuOption.menu.oBUIAPPProcessDefinition.id}'
         , uiPattern: '${menuOption.menu.oBUIAPPProcessDefinition.uIPattern?js_string}'
+        , processId: '${menuOption.menu.oBUIAPPProcessDefinition.id}'
+        , id:'${menuOption.dbId}'
+        , viewValue: 'processDefinition_${menuOption.menu.oBUIAPPProcessDefinition.id}'
     </#if>
     , singleRecord: ${menuOption.singleRecordStringValue}
     , readOnly: ${menuOption.readOnlyStringValue}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/help-about.js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
-*/
-
-OBHelpAbout.create({})
\ No newline at end of file
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/quick-launch.js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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) 2010-2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
-*/
-
-/* jslint */
-isc.OBQuickLaunch.create({
-  title: '',
-  itemPrompt: OB.I18N.getLabel('${data.label}'),
-  /* Avoid declare directly "prompt: " in this widget definition.
-     Declared as "itemPrompt" to be called later inside "draw" function (at "ob-quick-launch.js") in order to solve issue https://issues.openbravo.com/view.php?id=18192 in FF */
-  buttonType: '${data.buttonType}',
-  prefixLabel: '${data.prefixRecent}',
-  keyboardShortcutId : '${data.keyboardShortcutId}',
-  recentPropertyName: '${data.recentPropertyName}',
-  titleLabel: '${data.label}',
-  dataSourceId: '${data.dataSourceId}',
-  command: '${data.command}',
-  initWidget: function(){
-   if (this.buttonType) {
-     if (this.buttonType === 'createNew' && this.createNew_src) {
-       this.setSrc(this.createNew_src);
-     } else if (this.buttonType === 'quickLaunch' && this.quickLaunch_src) {
-       this.setSrc(this.quickLaunch_src);
-     }
-   }
-   this.Super('initWidget', arguments);
-  }
-})
\ No newline at end of file
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/templates/user-info.js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -11,12 +11,74 @@
  * 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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
 */
 
 /* jslint */
-    OBUserProfile.create({}),
-    isc.OBLogout.create({})
\ No newline at end of file
+
+OB.User.userInfo = {
+  language: {
+    value: '${data.contextLanguageId}',
+    valueMap: [
+      <#list data.languages as language>
+        {
+          id: '${language.id}',
+          _identifier: '${language.identifier}'
+        } <#if language_has_next>,</#if>
+      </#list>
+    ]
+  },
+  initialValues: {
+    language: '${data.contextLanguageId}',
+    role: '${data.contextRoleId}',
+    client: '${data.contextClientId}',
+    organization: '${data.contextOrganizationId}'<#if data.contextWarehouseId != "">,
+    warehouse: '${data.contextWarehouseId}'
+    </#if>
+  },
+  role: {
+    value: '${data.contextRoleId}',
+    valueMap: [
+      <#list data.userRolesInfo as roleInfo>
+        {
+          id: '${roleInfo.roleId}',
+          _identifier: '${roleInfo.roleName} - ${roleInfo.clientName}'
+        } <#if roleInfo_has_next>,</#if>
+      </#list>
+    ],
+    roles: [
+      <#list data.userRolesInfo as roleInfo>
+      {
+        id: '${roleInfo.roleId}',
+        client: '${roleInfo.clientName}',
+        organizationValueMap: [
+        <#list roleInfo.organizations?keys as organizationId>
+          {
+            id: '${organizationId}',
+            _identifier: '${roleInfo.organizations[organizationId]}'
+          } <#if organizationId_has_next>,</#if>
+          </#list>
+        ].sortByProperty('_identifier', true),
+        warehouseOrgMap: [
+          <#list roleInfo.organizationWarehouses?keys as key>
+          {
+            orgId: '${key}',
+            warehouseMap: [
+            <#list roleInfo.organizationWarehouses[key] as warehouse>
+              {
+                id: '${warehouse.warehouseId}',
+                _identifier: '${warehouse.warehouseName}'
+              } <#if warehouse_has_next>,</#if>
+              </#list>
+            ].sortByProperty('_identifier', true)
+          } <#if key_has_next>,</#if>
+          </#list>
+        ]
+      } <#if roleInfo_has_next>,</#if>
+      </#list>
+    ]
+  }
+};
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/layout.js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/layout.js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -11,191 +11,16 @@
  * 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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
 */
 
-// make sure that the layout is loaded in the parent window if we accidentally end up
-// in a child frame
-try {
-  if (window.parent && window.parent.OB && window.parent.OB.Layout) {
-    isc.Log.logDebug("Reloading in parent frame", "OB");
-    window.parent.location.href=window.location.href;
-  } else if (window.parent.parent && window.parent.parent.OB && window.parent.parent.OB.Layout) {
-    isc.Log.logDebug("Reloading in parent.parent frame", "OB");
-    window.parent.parent.location.href=window.location.href;
-  } else {
-    isc.Log.logDebug("loading in own frame", "OB");
-  }
-} catch(e) {
-    // ignoring on purpose
-    isc.Log.logDebug("Error when checking parent frame: " + e.message, "OB");
-}
-
-// needed for backward compatibility... to open the registration form
-function openRegistration() {
-  OB.Utilities.openProcessPopup(OB.Application.contextUrl + 'ad_forms/Registration.html', true);
-}
-
-isc.Canvas.addClassProperties({neverUsePNGWorkaround:true});
-
-OB.KeyboardManager.Shortcuts.setPredefinedList('OBUIAPP_KeyboardShortcuts');
-OB.KeyboardManager.Shortcuts.setPredefinedList('UINAVBA_KeyboardShortcuts');
-
-// should be moved to client.kernel component
-// placed here to prevent dependencies of client.kernel on Preferences
-OB.Application.startPage = '${data.startPage}';
-
-// This preference is the one which enables the accessibility for the people with reduced visual capabilities.
-if (OB.PropertyStore.get('EnableScreenReader') === 'Y') {
-    isc.screenReader = true;
-} 
-
-// the OB.Layout contains everything
-OB.Layout = isc.VLayout.create({
-  width: '100%',
-  height: '100%',
-  overflow: 'hidden'
-});
-
-// initialize the content of the layout, as late as possible
-// is called from index.jsp
-OB.Layout.initialize = function() {
-
-  // create the bar with navigation components
-  OB.NavBar = isc.ToolStrip.create({  
-    addMembers: function(members) {
-      // encapsulate the members
-      var newMembers = [], i;
-      for (i = 0; i < members.length; i++) {
-          // encapsulate in 2 hlayouts to handle correct mouse over/hover and show of box
-          if (OB.User.isPortal && !members[i].showInPortal) {
-            continue;
-          }
-          var newMember = isc.HLayout.create({layoutLeftMargin: 0, layoutRightMargin: 0, width: '100%', height: '100%', styleName: 'OBNavBarComponent', members:[members[i]]}); 
-          newMembers[i] = newMember;
-      }    
-      // note the array has to be placed in an array otherwise the newMembers
-      // is considered to the argument list
-      this.Super('addMembers', [newMembers]);
-    },
-
-    isFirstDraw: true,
-
-    draw: function() {
-      this.Super("draw", arguments);
-      if(isc.Browser.isIE && this.isFirstDraw) {
-        this.isFirstDraw = false;
-        this.markForRedraw(); //To solve issue https://issues.openbravo.com/view.php?id=18192 in IE
-      }
-    }
-  }, OB.Styles.TopLayout.NavBar);
-  
-  // the TopLayout has the navigation bar on the left and the logo on the right
-  OB.TopLayout = isc.HLayout.create({}, OB.Styles.TopLayout);
-      
-  // create the navbar on the left and the logo on the right
-  OB.TopLayout.CompanyImageLogo = isc.Img.create({
-    width: '${data.companyImageLogoWidth}',
-    height: '${data.companyImageLogoHeight}',
-    src: OB.Application.contextUrl + 'utility/ShowImageLogo?logo=yourcompanymenu',
-    imageType: 'normal'
-  });
-  OB.TestRegistry.register('org.openbravo.client.application.companylogo', OB.TopLayout.CompanyImageLogo);
-  
-  OB.TopLayout.OpenbravoLogo = isc.Img.create({
-      imageType: 'normal',
-      imageWidth: '130',
-      imageHeight: '32',
-      src: OB.Application.contextUrl + 'utility/GetOpenbravoLogo.png',
-      getInnerHTML: function() {
-          var html = this.Super('getInnerHTML', arguments);
-          <#if data.addProfessionalLink>
-          return '<a href="http://www.openbravo.com/product/erp/professional/" target="_new">' + html + '</a>';
-          <#else>
-          return html;
-          </#if>
-      }
-  });
-  OB.TestRegistry.register('org.openbravo.client.application.openbravologo', OB.TopLayout.OpenbravoLogo);    
-
-  if (OB.Styles && OB.Styles.hideOpenbravoLogo) {
-    OB.TopLayout.OpenbravoLogo.hide();
-  }
-
-  OB.TopLayout.addMember(
-    isc.HLayout.create({}, OB.Styles.TopLayout.LeftSpacer)
-  );
-  OB.TopLayout.addMember(OB.NavBar);
-  OB.TopLayout.addMember(
-    isc.HLayout.create({}, OB.Styles.TopLayout.MiddleSpacer)
-  );
-  OB.TopLayout.addMember(
-    isc.HLayout.create({
-        members: [OB.TopLayout.CompanyImageLogo, OB.TopLayout.OpenbravoLogo]
-    }, OB.Styles.TopLayout.LogosContainer)
-  );
-  
-  // add the top part to the main layout
-  OB.Layout.addMember(OB.TopLayout);
-  
-  OB.MainView = isc.VLayout.create({
-    width: '100%',
-    height: '100%'
-  });
-  OB.Layout.addMember(OB.MainView);
-
-  OB.MainView.TabSet = isc.OBTabSetMain.create({});
-  
-  OB.MainView.addMember(OB.MainView.TabSet);
-  
-  OB.TestRegistry.register('org.openbravo.client.application.mainview', OB.MainView);
-  OB.TestRegistry.register('org.openbravo.client.application.mainview.tabset', OB.MainView.TabSet);
-  OB.TestRegistry.register('org.openbravo.client.application.layout', OB.Layout);
-  
-  OB.NavBar.addMembers([
-  <#list data.navigationBarComponents as nbc>
-  ${nbc.jscode}<#if nbc_has_next>,</#if>
-  </#list>]);
-
-  // test to see if we can show the heartbeat or registration popups (or not)
-  (function _OB_checkHeartBeatRegistration() {
-   var handleReturn = function(response, data, request) {
-
-       if (data.upgradingNoAdmin) {
-         OB.Layout.ClassicOBCompatibility.Popup.standardUpgrading();
-       } else if (data.showAPRM) {
-         OB.Layout.ClassicOBCompatibility.Popup.openAPRMPopup();
-       } else if (data.showExportScripts) {
-         OB.Layout.ClassicOBCompatibility.Popup.openConfigScriptPopup(data.oldConfigScripts);
-       } else if (data.showSuccessUpgrade) {
-         OB.Layout.ClassicOBCompatibility.Popup.openSuccessUpgradePopup();
-       } else if (data.showOnDemandOffPlatform) {
-          OB.Layout.ViewManager.openView('OBClassicWindow', {
-              command: "DEFAULT",
-              formId: "8D6282279F464B1696B0EE3E23023B65",
-              icon: "Form",
-              id: "/ad_forms/InstanceManagement.html",
-              obManualURL: "/ad_forms/InstanceManagement.html",
-              tabTitle: OB.I18N.getLabel('OBUIAPP_InstanceActivation'),
-              viewId: "OBClassicWindow"
-            });
-       } else if (data.showInstancePurpose) {
-         OB.Layout.ClassicOBCompatibility.Popup.openInstancePurpose();
-       } else if (data.showHeartbeat) {
-         OB.Layout.ClassicOBCompatibility.Popup.openHeartbeat();
-       } else if (data.showRegistration) {
-         OB.Layout.ClassicOBCompatibility.Popup.openRegistration();
-       }
-   };
-
-   OB.RemoteCallManager.call('org.openbravo.client.application.HeartBeatPopupActionHandler', {}, {}, handleReturn);
-
-  }());
+OB.Application.dynamicNavigationBarComponents = function () {
+  return [<#list data.navigationBarComponents as nbc>
+           ${nbc.jscode}<#if nbc_has_next>,</#if>
+         </#list>];
 };
 
-${data.notesDataSource}
 
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/navigation-bar.js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,23 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+*/
+
+OB.Application.navigationBarComponents = [<#list data.navigationBarComponents as nbc>
+                                          ${nbc.jscode}<#if nbc_has_next>,</#if>
+                                          </#list>];
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-heartbeat-registration.js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,22 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+*/
+
+OB.Application.showHeartBeatOrRegistration = function() {
+  ${data.heartBeatRegistrationFunction};
+};
\ No newline at end of file
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -120,19 +120,20 @@
   protected JSONObject execute(Map<String, Object> parameters, String content) {
     OBContext.setAdminMode(true);
     long iniTime = System.currentTimeMillis();
+    String mode = null, tabId = null, rowId = null;
     try {
       // Execution mode. It can be:
       // - NEW: used when the user clicks on the "New record" button
       // - EDIT: used when the user opens a record in form view
       // - CHANGE: used when the user changes a field which should fire callouts or comboreloads
       // - SETSESSION: used when the user calls a process
-      String mode = readParameter(parameters, "MODE");
+      mode = readParameter(parameters, "MODE");
       // ID of the parent record
       String parentId = readParameter(parameters, "PARENT_ID");
       // The ID of the tab
-      String tabId = readParameter(parameters, "TAB_ID");
+      tabId = readParameter(parameters, "TAB_ID");
       // The ID of the record. Only relevant on EDIT, CHANGE and SETSESSION modes
-      String rowId = readParameter(parameters, "ROW_ID");
+      rowId = readParameter(parameters, "ROW_ID");
       // The IDs of the selected records in case more than one
       String multipleRowIds[] = (String[]) parameters.get("MULTIPLE_ROW_IDS");
       // The column changed by the user. Only relevant on CHANGE mode
@@ -325,7 +326,7 @@
       log.debug("Attachment exists: " + finalObject.getBoolean("attachmentExists"));
       return finalObject;
     } catch (Throwable t) {
-      t.printStackTrace(System.err);
+      log.error("TabId:" + tabId + " - Mode:" + mode + " - rowId:" + rowId, t);
       final String jsonString = JsonUtils.convertExceptionToJson(t);
       try {
         return new JSONObject(jsonString);
@@ -333,7 +334,6 @@
         log.error("Error while generating the error JSON object: " + jsonString, e);
       }
     } finally {
-
       // Clear session to prevent slow flush
       OBDal.getInstance().getSession().clear();
 
@@ -1134,31 +1134,35 @@
       if (field.getColumn() == null) {
         continue;
       }
-      String columnName = field.getColumn().getDBColumnName();
-      columns.add(columnName.toUpperCase());
+
+      String colName = null;
+      if (field.getProperty() != null && !field.getProperty().isEmpty()) {
+        colName = "_propertyField_"
+            + Sqlc.TransformaNombreColumna(field.getName()).replace(" ", "") + "_"
+            + field.getColumn().getDBColumnName();
+        columns.add(colName);
+      } else {
+        colName = field.getColumn().getDBColumnName();
+        columns.add(colName.toUpperCase());
+      }
+
       String validation = getValidation(field);
       if (!validation.equals("")) {
-        String colName = null;
-        if (field.getProperty() != null && !field.getProperty().isEmpty()) {
-          colName = "_propertyField_"
-              + Sqlc.TransformaNombreColumna(field.getName()).replace(" ", "") + "_"
-              + field.getColumn().getDBColumnName();
-        } else {
-          colName = field.getColumn().getDBColumnName();
-        }
         columnsWithValidation.add(colName);
         validations.put(colName, validation);
       }
     }
     for (String column : columnsWithValidation) {
       columnsInValidation.put(column, parseValidation(column, validations.get(column), columns));
-      String cols = "";
-      for (String col : columnsInValidation.get(column)) {
-        cols += col + ",";
+      if (log.isDebugEnabled()) {
+        String cols = "";
+        for (String col : columnsInValidation.get(column)) {
+          cols += col + ",";
+        }
+        log.debug("Column: " + column);
+        log.debug("Validation: '" + validations.get(column) + "'");
+        log.debug("Columns in validation: '" + cols + "'");
       }
-      log.debug("Column: " + column);
-      log.debug("Validation: '" + validations.get(column) + "'");
-      log.debug("Columns in validation: '" + cols + "'");
     }
 
     if (mode.equals("CHANGE") && changedColumn != null && !changedColumn.equals("inpadOrgId")) {
@@ -1244,15 +1248,20 @@
           sortedColumns.add(colName);
         }
       }
-      String cycleCols = "";
+
+      String validationErrors = "";
       for (String col : columnsWithValidation) {
         if (!sortedColumns.contains(col)) {
-          cycleCols += "," + col;
+          if (!validationErrors.isEmpty()) {
+            validationErrors += " -- ";
+          }
+          validationErrors += col + " column has a validation that depends on columns "
+              + columnsInValidation.get(col) + " which creates a cycle";
         }
       }
-      if (!cycleCols.equals("")) {
-        throw new OBException("Error. The columns " + cycleCols.substring(1)
-            + " have validations which form a cycle.");
+      if (!validationErrors.equals("")) {
+        throw new OBException(validationErrors + " -- List of sorted columns: " + sortedColumns,
+            false);
       }
     }
     String finalCols = "";
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/WindowDefinitionComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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) 2011 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  ______________________________________.
- ************************************************************************
- */
-package org.openbravo.client.application.window;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-import org.codehaus.jettison.json.JSONObject;
-import org.openbravo.base.exception.OBException;
-import org.openbravo.client.application.ApplicationComponentProvider;
-import org.openbravo.client.application.MenuManager;
-import org.openbravo.client.application.MenuManager.MenuOption;
-import org.openbravo.client.kernel.BaseComponent;
-import org.openbravo.dal.core.OBContext;
-
-/**
- * A component which generates javascript directly without a template
- * 
- * @author mtaal
- */
-@RequestScoped
-public class WindowDefinitionComponent extends BaseComponent {
-  public static final String WINDOW_DEF_COMPONENT = "WindowDefinitionComponent";
-
-  @Inject
-  private MenuManager menuManager;
-
-  @Override
-  public String generate() {
-    try {
-      final JSONObject result = new JSONObject();
-      for (MenuOption menuOption : menuManager.getSelectableMenuOptions()) {
-        if (menuOption.getTab() != null) {
-          final JSONObject windowDef = new JSONObject();
-          result.put(menuOption.getTab().getWindow().getId(), windowDef);
-          if (menuOption.isShowInClassicMode()) {
-            windowDef.put("showInClassicMode", true);
-          }
-        }
-      }
-      return "OB.WindowDefinitions = " + result.toString() + ";";
-    } catch (Exception e) {
-      throw new OBException(e);
-    }
-  }
-
-  @Override
-  public Object getData() {
-    return this;
-  }
-
-  protected String getModulePackageName() {
-    return ApplicationComponentProvider.class.getPackage().getName();
-  }
-
-  @Override
-  public String getETag() {
-    return super.getETag() + "_" + OBContext.getOBContext().getRole().getId();
-  }
-}
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-manager.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-manager.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/classic/ob-classic-compatibility.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -82,6 +82,22 @@
       }, doOpenClassicWindow);
     },
 
+    // ** {{{ openInstanceManagementForm() }}} **
+    //
+    // Opens the Instance Activation window.
+    //
+    openInstanceManagementForm: function () {
+      L.ViewManager.openView('OBClassicWindow', {
+        command: 'DEFAULT',
+        formId: '8D6282279F464B1696B0EE3E23023B65',
+        icon: 'Form',
+        id: '/ad_forms/InstanceManagement.html',
+        obManualURL: '/ad_forms/InstanceManagement.html',
+        tabTitle: OB.I18N.getLabel('OBUIAPP_InstanceActivation'),
+        viewId: 'OBClassicWindow'
+      });
+    },
+
     // ** {{{ sendDirectLink(action, form) }}} **
     //
     // Shows a new tab with the clicked link content
@@ -351,12 +367,12 @@
       // * {{{url}}} type: String - the url to be opened in the popup
       // * {{{title}}} type: String - the title to be displayed in the popup
       // * {{{theOpener}}} type: Window Object - the window object of the opener of the popup. Used in window.open to allow IE know which is the opener
-      // * {{{showMinimizeControl}}} type: Boolean - to specify if the popup should show the minimize control or not. The default value is "true" if it is not specified
-      // * {{{showMaximizeControl}}} type: Boolean - to specify if the popup should show the maximize control or not. The default value is "true" if it is not specified
-      // * {{{showCloseControl}}} type: Boolean - to specify if the popup should show the close control or not. The default value is "true" if it is not specified
+      // * {{{showMinimizeControl}}} type: Boolean - to specify if the popup should show the minimize control or not. The default value is 'true' if it is not specified
+      // * {{{showMaximizeControl}}} type: Boolean - to specify if the popup should show the maximize control or not. The default value is 'true' if it is not specified
+      // * {{{showCloseControl}}} type: Boolean - to specify if the popup should show the close control or not. The default value is 'true' if it is not specified
       // * {{{postParams}}} type: Object - parameters to be sent to the url using POST instead of GET
-      // * {{{isModal}}} type: Boolean - to specify if the popup should be modal or not. The default value is "true" if it is not specified
-      // * {{{show}}} type: Boolean - to specify if the popup should be shown or not. The default value is "true" if it is not specified
+      // * {{{isModal}}} type: Boolean - to specify if the popup should be modal or not. The default value is 'true' if it is not specified
+      // * {{{show}}} type: Boolean - to specify if the popup should be shown or not. The default value is 'true' if it is not specified
       // 
       // returns the created OBClassicPopupWindow
       open: function (name, width, height, url, title, theOpener, showMinimizeControl, showMaximizeControl, showCloseControl, postParams, isModal, show) {
@@ -378,7 +394,7 @@
           show = true;
         }
         var _htmlCode, _navUserAgent = navigator.userAgent.toUpperCase();
-        if (OB.Utilities.isIE9Strict || _navUserAgent.indexOf("MSIE") === -1) { // IE >= 9 (Strict) or any other browser
+        if (OB.Utilities.isIE9Strict || _navUserAgent.indexOf('MSIE') === -1) { // IE >= 9 (Strict) or any other browser
           _htmlCode = '<html><head></head><body style="margin: 0; padding: 0; border: none;">' + '<iframe id="MDIPopupContainer" name="MDIPopupContainer" style="margin: 0; padding: 0; border: none; width: 100%; height: 100%;"></iframe>' + '<iframe name="frameMenu" scrolling="no" src="' + OB.Application.contextUrl + 'utility/VerticalMenu.html?Command=HIDE" id="paramFrameMenuLoading" style="margin: 0px; padding: 0px; border: 0px; height: 0px; width: 0px;"></iframe>' + '</body></html>';
         } else { // IE <= 8
           _htmlCode = '<html><head></head><frameset cols="*, 0%" rows="*" frameborder="no" border="0" framespacing="0">' + '<frame id="MDIPopupContainer" name="MDIPopupContainer"></frame>' + '<frame name="frameMenu" scrolling="no" src="' + OB.Application.contextUrl + 'utility/VerticalMenu.html?Command=HIDE" id="paramFrameMenuLoading"></frame>' + '</frameset><body></body></html>';
@@ -421,6 +437,7 @@
       postOpen: function (cPopup, postParams) {
         if (!cPopup.isFramesetDraw) {
           cPopup.getIframeHtmlObj().contentWindow.document.write(cPopup.htmlCode);
+          cPopup.getIframeHtmlObj().contentWindow.document.close();
           cPopup.isFramesetDraw = true;
         }
         if (!cPopup.getIframeHtmlObj().contentWindow.frames[0].document.body) {
@@ -594,13 +611,13 @@
           click: function () {
             this.topElement.cancelClick();
             OB.Layout.ViewManager.openView('OBClassicWindow', {
-              command: "DEFAULT",
-              formId: "E4F4AAC7DD6D4FBDA3AF973B7767F374",
-              icon: "Form",
-              id: "/org.openbravo.erputil.aprmigrationtool.ad_forms/MigrationTool.html",
-              obManualURL: "/org.openbravo.erputil.aprmigrationtool.ad_forms/MigrationTool.html",
+              command: 'DEFAULT',
+              formId: 'E4F4AAC7DD6D4FBDA3AF973B7767F374',
+              icon: 'Form',
+              id: '/org.openbravo.erputil.aprmigrationtool.ad_forms/MigrationTool.html',
+              obManualURL: '/org.openbravo.erputil.aprmigrationtool.ad_forms/MigrationTool.html',
               tabTitle: OB.I18N.getLabel('APRMT_MigrationToolTitle'),
-              viewId: "OBClassicWindow"
+              viewId: 'OBClassicWindow'
             });
           }
         });
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-time.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -208,7 +208,7 @@
   },
   formSaved: function (request, response, data) {
     var UTCOffsetInMiliseconds;
-    if (this.getValue() !== data[this.name]) {
+    if (data && this.getValue() !== data[this.name]) {
       // it has not been converted to the local time yet, do it now
       if (data[this.name] && data[this.name].getFullYear() <= 1970) {
         UTCOffsetInMiliseconds = OB.Utilities.Date.getUTCOffsetInMiliseconds();
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Thu Sep 14 12:03:42 2017 +0000
@@ -3675,15 +3675,15 @@
       var focusItem = editForm.getFocusItem();
       if (focusItem && !focusItem.hasPickList) {
         focusItem.blur(focusItem.form, focusItem);
-      }
-      if (editForm.inFicCall) {
-        // use editValues object as the edit form will be re-used for a next row
-        this.setEditValue(rowNum, 'actionAfterFicReturn', {
-          target: this,
-          method: this.saveEditedValues,
-          parameters: [rowNum, colNum, newValues, oldValues, editValuesID, editCompletionEvent, saveCallback, true]
-        }, true, true);
-        return;
+        if (editForm.inFicCall) {
+          // use editValues object as the edit form will be re-used for a next row
+          this.setEditValue(rowNum, 'actionAfterFicReturn', {
+            target: this,
+            method: this.saveEditedValues,
+            parameters: [rowNum, colNum, newValues, oldValues, editValuesID, editCompletionEvent, saveCallback, true]
+          }, true, true);
+          return;
+        }
       }
     }
     // reset the new values as this can have changed because of a fic call or in the blur event of the focused item
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-layout.js	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,206 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+isc.ClassFactory.defineClass('OBLayout', isc.Layout);
+
+// make sure that the layout is loaded in the parent window if we accidentally end up
+// in a child frame
+try {
+  if (window.parent && window.parent.OB && window.parent.OB.Layout) {
+    isc.Log.logDebug('Reloading in parent frame', 'OB');
+    window.parent.location.href = window.location.href;
+  } else if (window.parent.parent && window.parent.parent.OB && window.parent.parent.OB.Layout) {
+    isc.Log.logDebug('Reloading in parent.parent frame', 'OB');
+    window.parent.parent.location.href = window.location.href;
+  } else {
+    isc.Log.logDebug('loading in own frame', 'OB');
+  }
+} catch (e) {
+  // ignoring on purpose
+  isc.Log.logDebug('Error when checking parent frame: ' + e.message, 'OB');
+}
+
+// This preference is the one which enables the accessibility for the people with reduced visual capabilities.
+if (OB.PropertyStore.get('EnableScreenReader') === 'Y') {
+  isc.screenReader = true;
+}
+
+// needed for backward compatibility... to open the registration form
+
+function openRegistration() {
+  OB.Utilities.openProcessPopup(OB.Application.contextUrl + 'ad_forms/Registration.html', true);
+}
+
+isc.Canvas.addClassProperties({
+  neverUsePNGWorkaround: true
+});
+
+OB.KeyboardManager.Shortcuts.setPredefinedList('OBUIAPP_KeyboardShortcuts');
+OB.KeyboardManager.Shortcuts.setPredefinedList('UINAVBA_KeyboardShortcuts');
+
+
+// the OB.Layout contains everything
+OB.Layout = isc.VLayout.create({
+  width: '100%',
+  height: '100%',
+  overflow: 'hidden'
+});
+
+// initialize the content of the layout, as late as possible
+// is called from index.jsp
+OB.Layout.initialize = function () {
+
+  // create the bar with navigation components
+  OB.NavBar = isc.ToolStrip.create({
+    addMembers: function (members) {
+      // encapsulate the members
+      var newMembers = [],
+          i;
+      for (i = 0; i < members.length; i++) {
+        // encapsulate in 2 hlayouts to handle correct mouse over/hover and show of box
+        if (OB.User.isPortal && !members[i].showInPortal) {
+          continue;
+        }
+        var newMember = isc.HLayout.create({
+          layoutLeftMargin: 0,
+          layoutRightMargin: 0,
+          width: '100%',
+          height: '100%',
+          styleName: 'OBNavBarComponent',
+          members: [members[i]]
+        });
+        newMembers[i] = newMember;
+      }
+      // note the array has to be placed in an array otherwise the newMembers
+      // is considered to the argument list
+      this.Super('addMembers', [newMembers]);
+    },
+
+    createMembers: function (allMembers) {
+      var members = [],
+          dynamicMembers = [],
+          i, j = 0;
+      if (!allMembers) {
+        return;
+      }
+      if (OB.Application.dynamicNavigationBarComponents) {
+        dynamicMembers = OB.Application.dynamicNavigationBarComponents();
+      }
+      for (i = 0; i < allMembers.length; i++) {
+        if (!allMembers[i].className) {
+          continue;
+        }
+        if (allMembers[i].className !== '_OBNavBarDynamicComponent') {
+          this.translateLabels(allMembers[i]);
+          members.push(isc.ClassFactory.newInstance(allMembers[i].className, allMembers[i].properties));
+        } else if (dynamicMembers && dynamicMembers[j]) {
+          members.push(dynamicMembers[j]);
+          j++;
+        }
+      }
+      this.addMembers(members);
+    },
+
+    translateLabels: function (member) {
+      if (!member.properties) {
+        return;
+      }
+      if (member.properties.title) {
+        member.properties.title = OB.I18N.getLabel(member.properties.title);
+      }
+      if (member.properties.itemPrompt) {
+        member.properties.itemPrompt = OB.I18N.getLabel(member.properties.itemPrompt);
+      }
+    },
+
+    isFirstDraw: true,
+
+    draw: function () {
+      this.Super('draw', arguments);
+      if (isc.Browser.isIE && this.isFirstDraw) {
+        this.isFirstDraw = false;
+        this.markForRedraw(); //To solve issue https://issues.openbravo.com/view.php?id=18192 in IE
+      }
+    }
+  }, OB.Styles.TopLayout.NavBar);
+  // the TopLayout has the navigation bar on the left and the logo on the right
+  OB.TopLayout = isc.HLayout.create({}, OB.Styles.TopLayout);
+
+
+  //create the navbar on the left and the logo on the right
+  OB.TopLayout.CompanyImageLogo = isc.Img.create({
+    width: OB.Application.companyImage.width,
+    height: OB.Application.companyImage.height,
+    src: OB.Application.contextUrl + 'utility/ShowImageLogo?logo=yourcompanymenu',
+    imageType: 'normal'
+  });
+
+
+  OB.TestRegistry.register('org.openbravo.client.application.companylogo', OB.TopLayout.CompanyImageLogo);
+
+  OB.TopLayout.OpenbravoLogo = isc.Img.create({
+    imageType: 'normal',
+    imageWidth: '130',
+    imageHeight: '32',
+    src: OB.Application.contextUrl + 'utility/GetOpenbravoLogo.png',
+
+    getInnerHTML: function () {
+      var html = this.Super('getInnerHTML', arguments);
+      if (!OB.Application.isActiveInstance) {
+        return '<a href="http://www.openbravo.com/product/erp/professional/" target="_new">' + html + '</a>';
+      } else {
+        return html;
+      }
+    }
+  });
+  OB.TestRegistry.register('org.openbravo.client.application.openbravologo', OB.TopLayout.OpenbravoLogo);
+  if (OB.Styles && OB.Styles.hideOpenbravoLogo) {
+    OB.TopLayout.OpenbravoLogo.hide();
+  }
+  OB.TopLayout.addMember(
+  isc.HLayout.create({}, OB.Styles.TopLayout.LeftSpacer));
+  OB.TopLayout.addMember(OB.NavBar);
+  OB.TopLayout.addMember(
+  isc.HLayout.create({}, OB.Styles.TopLayout.MiddleSpacer));
+
+  OB.TopLayout.addMember(
+  isc.HLayout.create({
+    members: [OB.TopLayout.CompanyImageLogo, OB.TopLayout.OpenbravoLogo]
+  }, OB.Styles.TopLayout.LogosContainer));
+  //add the top part to the main layout
+  OB.Layout.addMember(OB.TopLayout);
+  OB.MainView = isc.VLayout.create({
+    width: '100%',
+    height: '100%'
+  });
+  OB.Layout.addMember(OB.MainView);
+
+  OB.MainView.TabSet = isc.OBTabSetMain.create({});
+
+  OB.MainView.addMember(OB.MainView.TabSet);
+
+  OB.TestRegistry.register('org.openbravo.client.application.mainview', OB.MainView);
+  OB.TestRegistry.register('org.openbravo.client.application.mainview.tabset', OB.MainView.TabSet);
+  OB.TestRegistry.register('org.openbravo.client.application.layout', OB.Layout);
+
+  OB.NavBar.createMembers(OB.Application.navigationBarComponents);
+
+  // show the heartbeat or registration popups (if it applies)
+  OB.Application.showHeartBeatOrRegistration();
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-notes-datasource.js	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,78 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+OB.Datasource.create({
+  createClassName: '',
+  ID: '090A37D22E61FE94012E621729090048',
+  potentiallyShared: true,
+  dataURL: OB.Utilities.applicationUrl('org.openbravo.service.datasource/090A37D22E61FE94012E621729090048'),
+  requestProperties: {
+    params: {
+      _contextUrl: OB.Utilities.getLocationUrlWithoutFragment(),
+      _skinVersion: 'Default',
+      Constants_IDENTIFIER: OB.Constants.IDENTIFIER,
+      Constants_FIELDSEPARATOR: OB.Constants.FIELDSEPARATOR
+    }
+  },
+  fields: [{
+    name: 'id',
+    type: '_id_13',
+    primaryKey: true
+  }, {
+    name: 'client',
+    type: '_id_19'
+  }, {
+    name: 'client$_identifier'
+  }, {
+    name: 'organization',
+    type: '_id_19'
+  }, {
+    name: 'organization$_identifier'
+  }, {
+    name: 'table',
+    type: '_id_19'
+  }, {
+    name: 'table$_identifier'
+  }, {
+    name: 'record',
+    type: '_id_10'
+  }, {
+    name: 'note',
+    type: '_id_14'
+  }, {
+    name: 'isactive',
+    type: '_id_20'
+  }, {
+    name: 'creationDate',
+    type: '_id_16'
+  }, {
+    name: 'createdBy',
+    type: '_id_30'
+  }, {
+    name: 'createdBy$_identifier'
+  }, {
+    name: 'updated',
+    type: '_id_16'
+  }, {
+    name: 'updatedBy',
+    type: '_id_30'
+  }, {
+    name: 'updatedBy$_identifier'
+  }]
+});
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Thu Sep 14 12:03:42 2017 +0000
@@ -1269,6 +1269,10 @@
     }
 
     if (this.treeGrid && this.isShowingTree) {
+      if (this.treeGrid.data) {
+        // Force to do a datasource call keeping the current criteria
+        this.treeGrid.data.invalidateCache();
+      }
       this.treeGrid.fetchData(this.treeGrid.getCriteria());
     }
     this.viewGrid.refreshContents(callback);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-application-menu.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-application-menu.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2011-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -119,7 +119,6 @@
   },
 
   itemClick: function (item, colNum) {
-    var isClassicEnvironment = OB.Utilities.useClassicMode(item.windowId);
     var selectedView = isc.addProperties({}, item);
     if (item.tabId) {
       selectedView = OB.Utilities.openView(item.windowId, item.tabId, item.title, null, null, item.icon, item.readOnly, item.singleRecord, null, item.editOrDeleteOnly);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2014 Openbravo SLU
+ * All portions are Copyright (C) 2011-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -84,7 +84,6 @@
   beforeShow: function () {
     var valueField = this.members[2].getField('value'),
         recent = OB.RecentUtilities.getRecentValue(this.recentPropertyName);
-
     if (recent && recent.length > 0) {
       var newFields = [];
       var index = 0,
@@ -153,7 +152,7 @@
   },
 
   initWidget: function () {
-    var dummyFirstField, dummyLastField;
+    var dummyFirstField, dummyLastField, me;
     dummyFirstField = isc.OBFocusButton.create({
       getFocusTarget: function () {
         return this.parentElement.members[this.parentElement.members.length - 2];
@@ -172,6 +171,7 @@
       }
     });
 
+    me = this;
     this.members = [dummyFirstField, isc.VLayout.create({
       // To allow height grow with its contents
       height: 1,
@@ -180,6 +180,7 @@
       autoFocus: true,
       width: '100%',
       titleSuffix: '',
+      quickMenuWidget: me,
       fields: [{
         name: 'value',
         cellStyle: OB.Styles.OBFormField.DefaultComboBox.cellStyle,
@@ -196,6 +197,8 @@
         // fixes issue https://issues.openbravo.com/view.php?id=15105
         pickListCellHeight: OB.Styles.OBFormField.DefaultComboBox.quickRunPickListCellHeight,
         recentPropertyName: this.recentPropertyName,
+        displayField: OB.Constants.IDENTIFIER,
+        entries: [],
 
         getControlTableCSS: function () {
           // prevent extra width settings, super class
@@ -203,6 +206,19 @@
           return 'cursor:default;';
         },
 
+        makePickList: function () {
+          var quickMenu = this.containerWidget.quickMenuWidget;
+
+          quickMenu.getQuickMenuItems(OB.Application.menu, this.entries);
+          quickMenu.sortQuickMenuItems(this.entries);
+          quickMenu.setQuickMenuValueMap(this);
+          this.Super('makePickList', arguments);
+        },
+
+        getClientPickListData: function () {
+          return this.entries;
+        },
+
         selectOnFocus: true,
         textMatchStyle: 'substring',
         width: OB.Styles.OBFormField.DefaultComboBox.quickRunWidth,
@@ -225,6 +241,7 @@
           criteria[OB.Constants.IDENTIFIER] = this.getDisplayValue();
           return criteria;
         },
+
         pickListFields: [{
           showValueIconOnly: true,
           name: 'icon',
@@ -250,18 +267,16 @@
         filterLocally: true,
         fetchDelay: 50,
 
-        optionDataSource: OB.Datasource.get(this.dataSourceId),
         valueField: OB.Constants.ID,
-
         emptyPickListMessage: OB.I18N.getLabel('OBUISC_ListGrid.emptyMessage'),
 
         command: this.command,
 
         pickValue: function (theValue) {
+          var record;
           this.Super('pickValue', arguments);
-
-          if (this.getSelectedRecord()) {
-            var record = this.getSelectedRecord();
+          record = this.getPickListRecordForValue(theValue);
+          if (record) {
             var viewValue = record.viewValue;
             isc.OBQuickRun.currentQuickRun.doHide();
             var openObject = isc.addProperties({}, record);
@@ -327,7 +342,6 @@
             openObject.readOnly = record.readOnly;
 
             openObject.icon = record.icon;
-
             openObject = isc.addProperties({}, record, openObject);
 
             if (openObject.openLinkInBrowser && openObject.viewId === 'OBExternalPage') {
@@ -372,6 +386,84 @@
     OB.TestRegistry.register(this.recentPropertyName + '_FIELD', suggestionField);
 
     return ret;
+  },
+
+  getQuickMenuItems: function (menu, quickMenu) {
+    var i, menuItem, validMenuItem;
+    for (i = 0; i < menu.length; i++) {
+      menuItem = menu[i];
+      if (menuItem.submenu) {
+        this.getQuickMenuItems(menuItem.submenu, quickMenu);
+      } else if (this.isValidMenuItem(menuItem)) {
+        validMenuItem = isc.clone(menuItem);
+        validMenuItem._identifier = validMenuItem.title;
+        validMenuItem.icon = this.getMenuItemIcon(validMenuItem);
+        quickMenu.add(validMenuItem);
+      }
+    }
+  },
+
+  getMenuItemIcon: function (menuItem) {
+    if (menuItem.type === 'process' || menuItem.type === 'processManual') {
+      return 'Process';
+    } else if (menuItem.type === 'processDefinition') {
+      if (menuItem.uiPattern === 'OBUIAPP_Report') {
+        return 'Report';
+      } else {
+        return 'Process';
+      }
+    } else if (menuItem.type === 'report') {
+      return 'Report';
+    } else if (menuItem.type === 'form') {
+      return 'Form';
+    } else if (menuItem.type === 'external') {
+      return 'ExternalLink';
+    }
+    return 'Window';
+  },
+
+  isValidMenuItem: function (menuItem) {
+    return false;
+  },
+
+  sortQuickMenuItems: function (menuItems) {
+    menuItems.sort(function (a, b) {
+      return (a._identifier > b._identifier) - (a._identifier < b._identifier);
+    });
+  },
+
+  isFolder: function (menuItem) {
+    return menuItem.type === 'folder';
+  },
+
+  isWindowAndCanCreateNewRecord: function (menuItem) {
+    return (menuItem.type === 'window' && !menuItem.readOnly && !menuItem.singleRecord && !menuItem.editOrDeleteOnly);
+  },
+
+  setQuickMenuValueMap: function (quickMenuCombo) {
+    var i, menuEntry, menuEntries = isc.clone(quickMenuCombo.entries),
+        valueMap = {};
+
+    if (!quickMenuCombo.setValueMap) {
+      return;
+    }
+
+    for (i = 0; i < menuEntries.length; i++) {
+      menuEntry = menuEntries[i];
+      valueMap[menuEntry.id] = menuEntry._identifier;
+    }
+    quickMenuCombo.preventPickListRequest = true; // preventing 1st request triggered by setValueMap
+    quickMenuCombo.setValueMap(valueMap);
+
+    if (quickMenuCombo.pickList) {
+      quickMenuCombo.pickList.data = menuEntries;
+      quickMenuCombo.pickList.data.initialData = menuEntries;
+      quickMenuCombo.pickList.data.allRows = menuEntries;
+      quickMenuCombo.pickList.data.fetchMode = "local";
+      quickMenuCombo.pickList.data.useClientFiltering = true;
+      quickMenuCombo.pickList.data.useClientSorting = true;
+      quickMenuCombo.pickList.data.disableCacheSync = true;
+      quickMenuCombo.pickList.data.neverDropCache = true;
+    }
   }
-
 });
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-user-profile-widget.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-user-profile-widget.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -70,11 +70,7 @@
 
   initWidget: function () {
     var me = this;
-    OB.RemoteCallManager.call(this.formActionHandler, {}, {
-      'command': 'data'
-    }, function (req, data, resp) {
-      me.formData = data;
-    });
+    me.formData = isc.clone(OB.User.userInfo);
     // ** {{{ setPrompt }}} **
     // Shown on hover, shows some user information.
     if (!OB.User.isPortal) {
@@ -162,22 +158,26 @@
 
     roleField = isc.addProperties({
       name: 'role',
-      title: OB.I18N.getLabel('UINAVBA_Role')
+      title: OB.I18N.getLabel('UINAVBA_Role'),
+      sortField: 'role'
     }, comboBoxFieldProperties);
 
     orgField = isc.addProperties({
       name: 'organization',
-      title: OB.I18N.getLabel('UINAVBA_Organization')
+      title: OB.I18N.getLabel('UINAVBA_Organization'),
+      sortField: 'organization'
     }, comboBoxFieldProperties);
 
     warehouseField = isc.addProperties({
       name: 'warehouse',
-      title: OB.I18N.getLabel('UINAVBA_Warehouse')
+      title: OB.I18N.getLabel('UINAVBA_Warehouse'),
+      sortField: 'warehouse'
     }, comboBoxFieldProperties);
 
     languageField = isc.addProperties({
       name: 'language',
-      title: OB.I18N.getLabel('UINAVBA_Language')
+      title: OB.I18N.getLabel('UINAVBA_Language'),
+      sortField: 'language'
     }, comboBoxFieldProperties);
 
     checkboxFieldProperties = {
@@ -301,6 +301,7 @@
           if (role.id === roleId) {
             this.getItem('organization').setEntries(role.organizationValueMap);
             this.setValue('client', role.client);
+            break;
           }
         }
       },
@@ -319,6 +320,7 @@
               warehouseOrg = role.warehouseOrgMap[j];
               if (warehouseOrg.orgId === orgId) {
                 this.getItem('warehouse').setEntries(warehouseOrg.warehouseMap);
+                return;
               }
             }
           }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2014-2016 Openbravo SLU
+ * All portions are Copyright (C) 2014-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -55,7 +55,7 @@
   // this function is invoked on the blur action of the formitems
   // this is the proper place to execute the client-side callouts
   handleItemChange: function (item) {
-    var affectedParams, i, field, me = this,
+    var dynamicColumns, affectedParams, i, field, me = this,
         registryId;
 
     registryId = this.paramWindow.viewId || this.paramWindow.processId;
@@ -66,8 +66,9 @@
     }
     // Check validation rules (subordinated fields), when value of a
     // parent field is changed, all its subordinated are reset
-    affectedParams = this.paramWindow.dynamicColumns[item.name];
-    if (affectedParams) {
+    dynamicColumns = this.paramWindow.dynamicColumns;
+    if (dynamicColumns && dynamicColumns[item.name]) {
+      affectedParams = dynamicColumns[item.name];
       for (i = 0; i < affectedParams.length; i++) {
         field = this.getField(affectedParams[i]);
         if (field && field.setValue) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2012-2016 Openbravo SLU
+ * All portions are Copyright (C) 2012-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -222,7 +222,7 @@
       tab.setTitle(OB.I18N.getLabel('OBUIAPP_ProcessTitle_Done', [this.tabTitle]));
     }
 
-    if (data.showResultsInProcessView) {
+    if (data && data.showResultsInProcessView) {
       if (!this.resultLayout) {
         this.resultLayout = isc.HLayout.create({
           width: '100%',
@@ -316,7 +316,7 @@
 
   doProcess: function (btnValue) {
     var i, tmp, view = this,
-        grid, allProperties, selection, len, allRows, params, tab, actionHandlerCall, clientSideValidationFail, selectedRecords, recordIds;
+        grid, allProperties, selection, len, allRows, params, tab, actionHandlerCall, clientSideValidationFail, selectedRecords, recordIds, additionalInfo;
 
     if (this.button && this.button.multiRecord) {
       selectedRecords = this.buttonOwnerView.viewGrid.getSelectedRecords();
@@ -363,7 +363,9 @@
       clientSideValidationFail = function () {
         view.setAllButtonEnabled(view.allRequiredParametersSet());
       };
-      this.clientSideValidation(this, actionHandlerCall, clientSideValidationFail);
+      additionalInfo = {};
+      additionalInfo.buttonValue = allProperties._buttonValue;
+      this.clientSideValidation(this, actionHandlerCall, clientSideValidationFail, additionalInfo);
     } else {
       actionHandlerCall();
     }
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-navbar-test.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/test/ob-navbar-test.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -27,35 +27,23 @@
 });
 
 QUnit.test('Test user info data read', function (assert) {
-  var done = assert.async();
+  QUnit.expect(15);
 
-  QUnit.expect(16);
+  QUnit.ok(OB.User.userInfo.language, 'Language present');
+  QUnit.ok(OB.User.userInfo.language.value, 'Language value present');
+  QUnit.ok(OB.User.userInfo.language.valueMap, 'Language valueMap present');
 
-  var callback;
-  callback = function (rpcResponse, data, rpcRequest) {
-    QUnit.ok(data.language, 'Language present');
-    QUnit.ok(data.language.value, 'Language value present');
-    QUnit.ok(data.language.valueMap, 'Language valueMap present');
-    QUnit.ok(data.language.value, 'Language value present');
+  QUnit.ok(OB.User.userInfo.initialValues.role, 'Initial role value set');
+  QUnit.ok(OB.User.userInfo.initialValues.client, 'Initial client value set');
+  QUnit.ok(OB.User.userInfo.initialValues.organization, 'Initial organization value set');
+  QUnit.ok(OB.User.userInfo.initialValues.language, 'Initial language value set');
 
-    QUnit.ok(data.initialValues.role, 'Initial role value set');
-    QUnit.ok(data.initialValues.client, 'Initial client value set');
-    QUnit.ok(data.initialValues.organization, 'Initial organization value set');
-    QUnit.ok(data.initialValues.language, 'Initial language value set');
-
-    QUnit.ok(data.role, 'Role set');
-    QUnit.ok(data.role.value, 'Role value set');
-    QUnit.ok(data.role.valueMap, 'Role valueMap set');
-    QUnit.ok(data.role.roles, 'Role info set');
-    QUnit.ok(data.role.roles.length > 0, 'More than one role present');
-    QUnit.ok(data.role.roles[0].id, 'Role id set');
-    QUnit.ok(data.role.roles[0].organizationValueMap, 'Role org value map set');
-    QUnit.ok(data.role.roles[0].warehouseOrgMap, 'Role wh value map set');
-
-    done();
-  };
-  var action = 'org.openbravo.client.application.navigationbarcomponents.UserInfoWidgetActionHandler';
-  OB.RemoteCallManager.call(action, {}, {
-    'command': 'data'
-  }, callback);
+  QUnit.ok(OB.User.userInfo.role, 'Role set');
+  QUnit.ok(OB.User.userInfo.role.value, 'Role value set');
+  QUnit.ok(OB.User.userInfo.role.valueMap, 'Role valueMap set');
+  QUnit.ok(OB.User.userInfo.role.roles, 'Role info set');
+  QUnit.ok(OB.User.userInfo.role.roles.length > 0, 'More than one role present');
+  QUnit.ok(OB.User.userInfo.role.roles[0].id, 'Role id set');
+  QUnit.ok(OB.User.userInfo.role.roles[0].organizationValueMap, 'Role org value map set');
+  QUnit.ok(OB.User.userInfo.role.roles[0].warehouseOrgMap, 'Role wh value map set');
 });
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2011-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -328,23 +328,6 @@
   }
 };
 
-// ** {{{OB.Utilities.useClassicMode}}} **
-// Returns true if the user wants to work in classic mode, checks the url parameter
-// as well as a property value.
-OB.Utilities.useClassicMode = function (windowId) {
-  if (OB.Utilities.hasUrlParameter('mode', 'classic')) {
-    return true;
-  }
-  var propValue = OB.PropertyStore.get('OBUIAPP_UseClassicMode', windowId);
-  if (propValue === 'Y') {
-    return true;
-  }
-  if (OB.WindowDefinitions[windowId] && OB.WindowDefinitions[windowId].showInClassicMode) {
-    return true;
-  }
-  return false;
-};
-
 // ** {{{OB.Utilities.openDirectTab}}} **
 // Open a view using a tab id and record id. The tab can be a child tab. If the record id
 // is not set then the tab is opened in grid mode. If command is not set then default is
@@ -423,29 +406,14 @@
 // Open a view taking into account if a specific window should be opened in classic mode or not.
 // Returns the object used to open the window.
 OB.Utilities.openView = function (windowId, tabId, tabTitle, recordId, command, icon, readOnly, singleRecord, direct, editOrDeleteOnly) {
-  var isClassicEnvironment = OB.Utilities.useClassicMode(windowId),
-      openObject, isDirect = direct;
+  var openObject, isDirect = direct;
   if (recordId) {
     if (direct !== false) {
       isDirect = true;
     }
 
   }
-  if (isClassicEnvironment) {
-    if (recordId) {
-      OB.Layout.ClassicOBCompatibility.openLinkedItem(tabId, recordId);
-      return null;
-    }
-    openObject = {
-      viewId: 'OBClassicWindow',
-      windowId: windowId,
-      tabId: tabId,
-      id: tabId,
-      command: 'DEFAULT',
-      tabTitle: tabTitle,
-      icon: icon
-    };
-  } else if (recordId) {
+  if (recordId) {
     openObject = {
       viewId: '_' + windowId,
       id: tabId,
--- a/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <NAME><![CDATA[HTML Widget]]></NAME>
-<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION><![CDATA[1.0.31811]]></VERSION>
+<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION><![CDATA[1.0.32382]]></VERSION>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <DESCRIPTION><![CDATA[Provides the HTML Widget superclass that allows to create widget classes that embed the html code.]]></DESCRIPTION>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <HELP><![CDATA[With this module you can define your own widget classes just setting up your own html code or the html code provided by third parties.]]></HELP>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <URL><![CDATA[http://forge.openbravo.com/projects/htmlwidget]]></URL>
@@ -21,7 +21,7 @@
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--D393BE6F22BB44B7B728259B34FC795A-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--D393BE6F22BB44B7B728259B34FC795A--></AD_MODULE>
--- a/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <AD_MODULE_ID><![CDATA[D393BE6F22BB44B7B728259B34FC795A]]></AD_MODULE_ID>
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <AD_DEPENDENT_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_DEPENDENT_MODULE_ID>
-<!--DCE798FBC5B648F7A3C81A6941720A57-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--DCE798FBC5B648F7A3C81A6941720A57-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <DEPENDANT_MODULE_NAME><![CDATA[My Openbravo Tab]]></DEPENDANT_MODULE_NAME>
 <!--DCE798FBC5B648F7A3C81A6941720A57-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--4B828F4D03264080AA1D2057B13F613C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <NAME><![CDATA[User Interface Client Kernel]]></NAME>
-<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION><![CDATA[2.1.31811]]></VERSION>
+<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION><![CDATA[2.1.32382]]></VERSION>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <DESCRIPTION><![CDATA[Provides framework functionality for the Openbravo User Interface]]></DESCRIPTION>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <HELP><![CDATA[The user interface client kernel is a generation framework for generating client (browser) components used in Openbravo. Its components are mainly used by other modules to provide customizable and extendable user interfaces.]]></HELP>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <URL><![CDATA[http://forge.openbravo.com/projects/openbravoclientkernel]]></URL>
@@ -22,7 +22,7 @@
 <!--4B828F4D03264080AA1D2057B13F613C-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <UPDATEINFO><![CDATA[Bug fix for issue 15289]]></UPDATEINFO>
-<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--4B828F4D03264080AA1D2057B13F613C-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--4B828F4D03264080AA1D2057B13F613C--></AD_MODULE>
--- a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--26B041893E844A53AFA58BC326C4F0D7-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--26B041893E844A53AFA58BC326C4F0D7-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--26B041893E844A53AFA58BC326C4F0D7-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <AD_DEPENDENT_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_DEPENDENT_MODULE_ID>
-<!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <STARTVERSION><![CDATA[1.1.31811]]></STARTVERSION>
+<!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <STARTVERSION><![CDATA[1.1.32382]]></STARTVERSION>
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <DEPENDANT_MODULE_NAME><![CDATA[JBoss Weld]]></DEPENDANT_MODULE_NAME>
 <!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <AD_DEPENDENT_MODULE_ID><![CDATA[F8D1B3ECB3474E8DA5C216473C840DF1]]></AD_DEPENDENT_MODULE_ID>
-<!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <STARTVERSION><![CDATA[2.0.31811]]></STARTVERSION>
+<!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <STARTVERSION><![CDATA[2.0.32382]]></STARTVERSION>
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <DEPENDANT_MODULE_NAME><![CDATA[JSON REST Webservice]]></DEPENDANT_MODULE_NAME>
 <!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,16 +29,12 @@
 import org.openbravo.client.kernel.reference.UIDefinitionController.FormatDefinition;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.erpCommon.obps.ActivationKey;
-import org.openbravo.erpCommon.utility.OBVersion;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.ad.access.User;
 import org.openbravo.model.ad.module.Module;
 import org.openbravo.model.ad.system.Client;
-import org.openbravo.model.ad.system.SystemInformation;
 import org.openbravo.model.common.enterprise.Organization;
-import org.openbravo.service.db.DalConnectionProvider;
 
 /**
  * The component responsible for generating the static part of the application js file.
@@ -94,18 +90,6 @@
     return OBDal.getInstance().get(Template.class, KernelConstants.APPLICATION_TEMPLATE_ID);
   }
 
-  public String getSystemVersion() {
-    return KernelUtils.getInstance().getVersionParameters(getModule());
-  }
-
-  public String getLanguageId() {
-    return OBContext.getOBContext().getLanguage().getId();
-  }
-
-  public String getLanguage() {
-    return OBContext.getOBContext().getLanguage().getLanguage();
-  }
-
   public String getDateFormat() {
     final Properties props = OBPropertiesProvider.getInstance().getOpenbravoProperties();
     return props.getProperty(KernelConstants.DATE_FORMAT_PROPERTY, "dd-MM-yyyy");
@@ -151,10 +135,6 @@
     return result;
   }
 
-  /**
-   * @deprecated the value is retrieved asynchronously via the MyOpenbravoActionHandler instead
-   */
-  @Deprecated
   public String getCommunityBrandingUrl() {
     return Utility.getCommunityBrandingUrl(MYOB_UIMODE);
   }
@@ -167,45 +147,6 @@
     return Utility.BUTLER_UTILS_URL;
   }
 
-  public String getInstancePurpose() {
-    final String purpose = OBDal.getInstance().get(SystemInformation.class, "0")
-        .getInstancePurpose();
-    if (purpose == null) {
-      return "";
-    }
-    return purpose;
-  }
-
-  public String getLicenseType() {
-    return ActivationKey.getInstance().getLicenseClass().getCode();
-  }
-
-  public String getTrialStringValue() {
-    return Boolean.toString(ActivationKey.getInstance().isTrial());
-  }
-
-  public String getGoldenStringValue() {
-    return Boolean.toString(ActivationKey.getInstance().isGolden());
-  }
-
-  public String getVersionDescription() {
-    ActivationKey ak = ActivationKey.getInstance();
-    String strVersion = OBVersion.getInstance().getMajorVersion();
-    strVersion += " - ";
-    strVersion += Utility.getListValueName("OBPSLicenseEdition", ak.getLicenseClass().getCode(),
-        "en_US");
-
-    if (ak.isTrial()) {
-      strVersion += " - ";
-      strVersion += Utility.messageBD(new DalConnectionProvider(false), "OPSTrial", OBContext
-          .getOBContext().getLanguage().getLanguage());
-    }
-
-    strVersion += " - ";
-    strVersion += OBVersion.getInstance().getMP();
-    return strVersion;
-  }
-
   public static class ModuleVersionParameter {
     private String id;
     private String value;
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationDynamicComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/ApplicationDynamicComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -11,84 +11,58 @@
  * 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-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
  */
 package org.openbravo.client.kernel;
 
-import java.util.HashSet;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 
 import org.openbravo.base.model.Entity;
+import org.openbravo.base.session.SessionFactoryController;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.obps.ActivationKey;
+import org.openbravo.erpCommon.utility.OBVersion;
+import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.ad.access.User;
-import org.openbravo.model.ad.access.WindowAccess;
-import org.openbravo.model.ad.datamodel.Table;
 import org.openbravo.model.ad.system.Client;
-import org.openbravo.model.ad.ui.Window;
+import org.openbravo.model.ad.system.SystemInformation;
+import org.openbravo.model.ad.utility.Image;
 import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.service.db.DalConnectionProvider;
 
 /**
- * The component responsible for generating the dynamic part of the application js file.
+ * The component responsible for generating some dynamic elements of the application js file which
+ * are related to the user of the current context.
  * 
  * @author mtaal
  */
-public class ApplicationDynamicComponent extends BaseTemplateComponent {
+public class ApplicationDynamicComponent extends SessionDynamicTemplateComponent {
+
+  private ActivationKey activationKey;
+  private Map<String, String> imageProperties;
+
+  @Override
+  public String getId() {
+    return KernelConstants.APPLICATION_DYNAMIC_COMPONENT_ID;
+  }
+
+  @Override
+  protected String getTemplateId() {
+    return KernelConstants.APPLICATION_DYNAMIC_TEMPLATE_ID;
+  }
 
   public Set<Entity> getAccessibleEntities() {
     final Set<Entity> entities = OBContext.getOBContext().getEntityAccessChecker()
         .getReadableEntities();
     entities.addAll(OBContext.getOBContext().getEntityAccessChecker().getWritableEntities());
-    return removeInaccessibleEntities(entities);
-  }
-
-  // entities may contain entities not accessible by the current role, this function removes them
-  // see issue 20530
-  private Set<Entity> removeInaccessibleEntities(Set<Entity> entities) {
-    Role role = OBContext.getOBContext().getRole();
-    Role initializedRole = OBDal.getInstance().get(Role.class, role.getId());
-    List<WindowAccess> windowAccessList = initializedRole.getADWindowAccessList();
-    Set<Entity> accessibleEntities = new HashSet<Entity>();
-    for (Entity entity : entities) {
-      String tableId = entity.getTableId();
-      if ("800018".equals(tableId) || "203".equals(tableId)) {
-        // Special cases, may not link to its window/poWindow
-        // It is safer not to try to remove them
-        // See getTabId@ReferencedLink.java
-        accessibleEntities.add(entity);
-        continue;
-      }
-      Table table = OBDal.getInstance().get(Table.class, tableId);
-      Window window = table.getWindow();
-      Window poWindow = table.getPOWindow();
-      if (windowAccessible(windowAccessList, window)
-          || windowAccessible(windowAccessList, poWindow)) {
-        accessibleEntities.add(entity);
-      }
-    }
-    return accessibleEntities;
-  }
-
-  private boolean windowAccessible(List<WindowAccess> windowAccessList, Window window) {
-    if (window == null) {
-      return false;
-    }
-    for (WindowAccess wa : windowAccessList) {
-      if (wa.getWindow().getId().equals(window.getId())) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  @Override
-  protected Template getComponentTemplate() {
-    return OBDal.getInstance().get(Template.class, KernelConstants.APPLICATION_DYNAMIC_TEMPLATE_ID);
+    return entities;
   }
 
   public User getUser() {
@@ -107,10 +81,89 @@
     return OBContext.getOBContext().getRole();
   }
 
-  @Override
-  public String getETag() {
-    OBContext c = OBContext.getOBContext();
-    return super.getETag() + "_" + c.getRole().getId() + "_" + c.getUser().getId() + "_"
-        + c.getCurrentClient().getId() + "_" + c.getCurrentOrganization().getId();
+  public String getLanguageId() {
+    return OBContext.getOBContext().getLanguage().getId();
+  }
+
+  public String getLanguage() {
+    return OBContext.getOBContext().getLanguage().getLanguage();
+  }
+
+  public Map<String, String> getCompanyImageLogoData() {
+    if (imageProperties != null) {
+      return imageProperties;
+    }
+    imageProperties = new HashMap<>();
+    Image img = Utility.getImageLogoObject("yourcompanymenu", "");
+    String imageWidth = "122";
+    String imageHeight = "34";
+    if (img != null) {
+      if (img.getWidth() != null) {
+        imageWidth = String.valueOf(img.getWidth().intValue());
+      }
+      if (img.getHeight() != null) {
+        imageHeight = String.valueOf(img.getHeight().intValue());
+      }
+    }
+    imageProperties.put("width", imageWidth);
+    imageProperties.put("height", imageHeight);
+    return imageProperties;
+  }
+
+  public String getSystemVersion() {
+    return KernelUtils.getInstance().getVersionParameters(getModule());
+  }
+
+  public String getInstancePurpose() {
+    final String purpose = OBDal.getInstance().get(SystemInformation.class, "0")
+        .getInstancePurpose();
+    if (purpose == null) {
+      return "";
+    }
+    return purpose;
+  }
+
+  private ActivationKey getActivationKey() {
+    if (activationKey == null) {
+      activationKey = ActivationKey.getInstance();
+    }
+    return activationKey;
+  }
+
+  public String getLicenseType() {
+    return getActivationKey().getLicenseClass().getCode();
+  }
+
+  public String getTrialStringValue() {
+    return Boolean.toString(getActivationKey().isTrial());
+  }
+
+  public String getGoldenStringValue() {
+    return Boolean.toString(getActivationKey().isGolden());
+  }
+
+  public String getActiveInstanceStringValue() {
+    if (SessionFactoryController.isRunningInWebContainer()) {
+      return Boolean.toString(ActivationKey.isActiveInstance());
+    }
+    return Boolean.FALSE.toString();
+  }
+
+  public String getVersionDescription() {
+    ActivationKey ak = getActivationKey();
+    String strVersion = OBVersion.getInstance().getMajorVersion();
+    strVersion += " - ";
+    strVersion += Utility.getListValueName("OBPSLicenseEdition", ak.getLicenseClass().getCode(),
+        "en_US");
+
+    if (ak.isTrial()) {
+      strVersion += " - ";
+      strVersion += Utility.messageBD(new DalConnectionProvider(false), "OPSTrial", OBContext
+          .getOBContext().getLanguage().getLanguage());
+    }
+
+    strVersion += " - ";
+    strVersion += OBVersion.getInstance().getMP();
+    return strVersion;
   }
 }
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelApplicationInitializer.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelApplicationInitializer.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,16 +22,20 @@
 import java.util.Date;
 
 import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
 import org.hibernate.dialect.function.StandardSQLFunction;
 import org.hibernate.type.StringType;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.DateTimeData;
+import org.openbravo.jmx.MBeanRegistry;
 import org.openbravo.service.db.DalConnectionProvider;
 
 /**
- * An example {@link ApplicationInitializer}.
+ * An {@link ApplicationInitializer} in charge of doing some initialization tasks like registering
+ * core SQL functions, checking if both Tomcat and DB are configured to use the same time and
+ * registering standard jmx beans.
  * 
  * @author mtaal
  */
@@ -42,9 +46,13 @@
   private static final String javaDateTimeFormat = "dd-MM-yyyy HH:mm:ss";
   private static final long THRESHOLD = 5000; // 5 seconds
 
+  @Inject
+  private StaticResourceProvider resourceProvider;
+
   public void initialize() {
     registerSQLFunctions();
     checkDatabaseAndTomcatDateTime();
+    registerStaticResourcesMBean();
   }
 
   private void registerSQLFunctions() {
@@ -90,4 +98,8 @@
     }
     return date;
   }
+
+  private void registerStaticResourcesMBean() {
+    MBeanRegistry.registerMBean(KernelConstants.RESOURCE_COMPONENT_ID, resourceProvider);
+  }
 }
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelComponentProvider.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelComponentProvider.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2009-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -58,8 +58,11 @@
       return getComponent(StaticResourceComponent.class);
     } else if (componentId.equals(KernelConstants.APPLICATION_COMPONENT_ID)) {
       return getComponent(ApplicationComponent.class);
-    } else if (componentId.equals(KernelConstants.APPLICATION_DYNAMIC_COMPONENT_ID)) {
-      return getComponent(ApplicationDynamicComponent.class);
+    } else if (componentId.equals(KernelConstants.SESSION_DYNAMIC_COMPONENT_ID)) {
+      // generate the session dynamic resources
+      final SessionDynamicResourceComponent sessionDynamicComponent = getComponent(SessionDynamicResourceComponent.class);
+      sessionDynamicComponent.setParameters(parameters);
+      return sessionDynamicComponent;
     } else if (componentId.equals(KernelConstants.TEST_COMPONENT_ID)) {
       return getComponent(TestComponent.class);
     } else if (componentId.equals(KernelConstants.DOCUMENT_COMPONENT_ID)) {
@@ -75,7 +78,7 @@
   public String getVersionParameters(String resource) {
     final String versionParam = super.getVersionParameters(resource);
     if (resource.contains(KernelConstants.APPLICATION_COMPONENT_ID)
-        || resource.contains(KernelConstants.APPLICATION_DYNAMIC_COMPONENT_ID)) {
+        || resource.contains(KernelConstants.SESSION_DYNAMIC_COMPONENT_ID)) {
       return versionParam + "&_role=" + OBContext.getOBContext().getRole().getId() + "&_org="
           + OBContext.getOBContext().getCurrentOrganization().getId();
     }
@@ -92,9 +95,11 @@
     globalResources.add(createStaticResource("org.openbravo.client.kernel/"
         + KernelConstants.KERNEL_COMPONENT_TYPE + "/" + KernelConstants.APPLICATION_COMPONENT_ID,
         true));
+
     globalResources.add(createDynamicResource("org.openbravo.client.kernel/"
         + KernelConstants.KERNEL_COMPONENT_TYPE + "/"
-        + KernelConstants.APPLICATION_DYNAMIC_COMPONENT_ID));
+        + KernelConstants.SESSION_DYNAMIC_COMPONENT_ID));
+
     globalResources.add(createStaticResource("org.openbravo.client.kernel/"
         + KernelConstants.KERNEL_COMPONENT_TYPE + "/" + KernelConstants.LABELS_COMPONENT_ID, true));
     globalResources.add(createStaticResource(
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelConstants.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelConstants.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2009-2011 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -82,6 +82,8 @@
 
   public static final String SERVLET_CONTEXT = "_servletContext";
 
+  public static final String SESSION_DYNAMIC_COMPONENT_ID = "SessionDynamic";
+
   public static final String APPLICATION_COMPONENT_ID = "Application";
 
   public static final String APPLICATION_DYNAMIC_COMPONENT_ID = "ApplicationDynamic";
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelServlet.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelServlet.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2009-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -87,8 +87,8 @@
   private static synchronized void incBypassAuthenticationCount(HttpServletRequest request) {
     HttpSession session = request.getSession(true);
     OBContext context = OBContext.getOBContext();
-    boolean sessionForThisRequest = context == null
-        || session.getAttribute("#Authenticated_user") == null;
+    boolean sessionForThisRequest = (context == null || session.getAttribute("#Authenticated_user") == null)
+        && !"Y".equals(session.getAttribute("#LOGGINGIN"));
 
     if (sessionForThisRequest) {
       session.setAttribute("forceLogin", "Y");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/SessionDynamicResourceComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,82 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.openbravo.model.ad.module.Module;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class generates other components called session dynamic resources. This kind of resources
+ * are loaded before the javascript content used in the application and they are provided by those
+ * classes extending the {@link SessionDynamicTemplateComponent} class.
+ */
+public class SessionDynamicResourceComponent extends BaseComponent {
+
+  private static final Logger log = LoggerFactory.getLogger(SessionDynamicResourceComponent.class);
+
+  @Inject
+  @Any
+  private Instance<SessionDynamicTemplateComponent> components;
+
+  @Override
+  public String generate() {
+    StringBuilder result = new StringBuilder();
+    for (SessionDynamicTemplateComponent component : getSortedComponentList()) {
+      component.setParameters(getParameters());
+      long t = System.currentTimeMillis();
+      result.append(component.generate());
+      log.debug("Generation of session dynamic resource {} took {} ms", component.getId(),
+          System.currentTimeMillis() - t);
+    }
+    return result.toString();
+  }
+
+  @Override
+  public Object getData() {
+    return this;
+  }
+
+  @Override
+  public String getETag() {
+    // session dynamic resources are never cached
+    return "" + System.currentTimeMillis();
+  }
+
+  public List<SessionDynamicTemplateComponent> getSortedComponentList() {
+    List<SessionDynamicTemplateComponent> componentList = new ArrayList<>();
+    final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
+    for (Module module : modules) {
+      for (SessionDynamicTemplateComponent component : components) {
+        if (!component.getModule().getId().equals(module.getId())) {
+          continue;
+        }
+        componentList.add(component);
+      }
+    }
+    return componentList;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/SessionDynamicTemplateComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,43 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel;
+
+import org.openbravo.dal.service.OBDal;
+
+/**
+ * Classes extending this one will be used by {@link SessionDynamicResourceComponent} to generate
+ * the components that should be created before the loading of the javascript content of the
+ * application.
+ */
+public abstract class SessionDynamicTemplateComponent extends BaseTemplateComponent {
+
+  protected abstract String getTemplateId();
+
+  @Override
+  protected Template getComponentTemplate() {
+    return OBDal.getInstance().get(Template.class, getTemplateId());
+  }
+
+  @Override
+  public final String getETag() {
+    // session dynamic resources do not require an ETag as they are not generated directly in the
+    // KernelServlet, they are generated by the SessionDynamicResourceComponent
+    return "";
+  }
+}
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -38,7 +38,7 @@
 import org.openbravo.service.web.WebServiceUtil;
 
 /**
- * The component representing the component in the
+ * The component in charge of generating the static Javascript resources.
  * 
  * @author mtaal
  * @author iperdomo
@@ -52,6 +52,9 @@
   @Any
   private Instance<ComponentProvider> componentProviders;
 
+  @Inject
+  private StaticResourceProvider resourceProvider;
+
   private Boolean isInDevelopment;
 
   @Override
@@ -90,12 +93,6 @@
     final long t1 = System.currentTimeMillis();
 
     try {
-      // note the document.write content must be divided up like this, if the document.write
-      // contains a complete string like <script or </script> then the browser will execute
-      // them
-      // directly and not the document.write, see here:
-      // http://www.codehouse.com/javascript/articles/external/
-
       if (isClassicMode()) {
         // set in the session that we are looking at the new ui
         // note injecting the HttpSession through Weld does not work
@@ -106,29 +103,7 @@
         OBContext.getOBContext().setNewUI(true);
       }
 
-      StringBuilder result = new StringBuilder();
-      final String scriptPath = getContextUrl() + GEN_TARGET_LOCATION.substring(1) + "/"
-          + getStaticResourceFileName() + ".js";
-
-      if (isClassicMode()) {
-        result.append("document.write(\"<LINK rel='stylesheet' type='text/css' href='"
-            + getContextUrl()
-            + "org.openbravo.client.kernel/OBCLKER_Kernel/StyleSheetResources?_skinVersion="
-            + KernelConstants.SKIN_DEFAULT + "&_mode=" + KernelConstants.MODE_PARAMETER_CLASSIC
-            + "'></link>\");\n");
-        result
-            .append("var isomorphicDir='../web/org.openbravo.userinterface.smartclient/isomorphic/';\n");
-
-        final String scDevModulePackage = "org.openbravo.userinterface.smartclient.dev";
-        if (KernelUtils.getInstance().isModulePresent(scDevModulePackage)
-            && KernelUtils.getInstance().getModule(scDevModulePackage).isInDevelopment()) {
-          result
-              .append("document.write('<'+'SCRIPT SRC=' + window.isomorphicDir + 'ISC_Combined.uncompressed.js><'+'/SCRIPT>');");
-        }
-      }
-      result.append("document.write(\"<s\" + \"cript type='text/javascript' src='" + scriptPath
-          + "'><\\/s\"+\"cript>\");");
-      return result.toString();
+      return generateResult(getStaticResourceFileName());
     } catch (Exception e) {
       log.error("Error generating component; " + e.getMessage(), e);
     } finally {
@@ -138,6 +113,45 @@
     return "";
   }
 
+  /**
+   * Returns the result of the component generation. This method should be overridden by the classes
+   * extending this one in order to return its own result.
+   * 
+   * @param staticResourceFileName
+   *          The name of the static resource file already generated by the component.
+   * @return a String containing the result of the component generation. By default, it returns a
+   *         javascript expression that writes an <script> that imports the generated static
+   *         resource file.
+   */
+  protected String generateResult(String staticResourceFileName) {
+    // note the document.write content must be divided up like this, if the document.write
+    // contains a complete string like <script or </script> then the browser will execute
+    // them directly and not the document.write, see here:
+    // http://www.codehouse.com/javascript/articles/external/
+    StringBuilder result = new StringBuilder();
+    final String scriptPath = getContextUrl() + GEN_TARGET_LOCATION.substring(1) + "/"
+        + staticResourceFileName + ".js";
+    if (isClassicMode()) {
+      result.append("document.write(\"<LINK rel='stylesheet' type='text/css' href='"
+          + getContextUrl()
+          + "org.openbravo.client.kernel/OBCLKER_Kernel/StyleSheetResources?_skinVersion="
+          + KernelConstants.SKIN_DEFAULT + "&_mode=" + KernelConstants.MODE_PARAMETER_CLASSIC
+          + "'></link>\");\n");
+      result
+          .append("var isomorphicDir='../web/org.openbravo.userinterface.smartclient/isomorphic/';\n");
+
+      final String scDevModulePackage = "org.openbravo.userinterface.smartclient.dev";
+      if (KernelUtils.getInstance().isModulePresent(scDevModulePackage)
+          && KernelUtils.getInstance().getModule(scDevModulePackage).isInDevelopment()) {
+        result
+            .append("document.write('<'+'SCRIPT SRC=' + window.isomorphicDir + 'ISC_Combined.uncompressed.js><'+'/SCRIPT>');");
+      }
+    }
+    result.append("document.write(\"<s\" + \"cript type='text/javascript' src='" + scriptPath
+        + "'><\\/s\"+\"cript>\");");
+    return result.toString();
+  }
+
   public String getId() {
     return KernelConstants.RESOURCE_COMPONENT_ID;
   }
@@ -148,157 +162,176 @@
    *         client side reload or caching.
    */
   public String getStaticResourceFileName() {
-    final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
-    final ServletContext context = (ServletContext) getParameters().get(
-        KernelConstants.SERVLET_CONTEXT);
-    final StringBuffer sb = new StringBuffer();
-
-    final String skinParam;
-    if (getParameters().containsKey(KernelConstants.SKIN_PARAMETER)) {
-      skinParam = (String) getParameters().get(KernelConstants.SKIN_PARAMETER);
-    } else {
-      skinParam = KernelConstants.SKIN_DEFAULT;
+    final String appName = getApplicationName();
+    String staticResourceFileName = resourceProvider.getStaticResourceCachedInfo(appName);
+    if (staticResourceFileName != null) {
+      return staticResourceFileName;
     }
 
-    int cntDynamicScripts = 0;
-    final String appName = getApplicationName();
+    synchronized (StaticResourceComponent.class) {
+      staticResourceFileName = resourceProvider.getStaticResourceCachedInfo(appName);
+      if (staticResourceFileName != null) {
+        return staticResourceFileName;
+      }
 
-    for (Module module : modules) {
-      for (ComponentProvider provider : componentProviders) {
-        final List<ComponentResource> resources = provider.getGlobalComponentResources();
-        if (resources == null || resources.size() == 0) {
-          continue;
-        }
+      final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
+      final ServletContext context = (ServletContext) getParameters().get(
+          KernelConstants.SERVLET_CONTEXT);
+      final StringBuffer sb = new StringBuffer();
 
-        if (provider.getModule().getId().equals(module.getId())) {
-          for (ComponentResource resource : resources) {
+      final String skinParam;
+      if (getParameters().containsKey(KernelConstants.SKIN_PARAMETER)) {
+        skinParam = (String) getParameters().get(KernelConstants.SKIN_PARAMETER);
+      } else {
+        skinParam = KernelConstants.SKIN_DEFAULT;
+      }
 
-            if (!resource.isValidForApp(appName)) {
-              continue;
-            }
+      int cntDynamicScripts = 0;
 
-            log.debug("Processing resource: " + resource);
-            String resourcePath = resource.getPath();
-            if (resource.getType() == ComponentResourceType.Stylesheet) {
-              // do these differently...
-            } else if (resource.getType() == ComponentResourceType.Static) {
-              if (resourcePath.startsWith(KernelConstants.KERNEL_JAVA_PACKAGE)) {
-                final String[] pathParts = WebServiceUtil.getInstance().getSegments(
-                    resourcePath.substring(KernelConstants.KERNEL_JAVA_PACKAGE.length()));
-                final Component component = provider.getComponent(pathParts[1], getParameters());
-                sb.append(ComponentGenerator.getInstance().generate(component)).append("\n");
-              } else {
+      for (Module module : modules) {
+        for (ComponentProvider provider : componentProviders) {
+          final List<ComponentResource> resources = provider.getGlobalComponentResources();
+          if (resources == null || resources.size() == 0) {
+            continue;
+          }
 
-                // Skin version handling
-                if (resourcePath.contains(KernelConstants.SKIN_PARAMETER)) {
-                  resourcePath = resourcePath.replaceAll(KernelConstants.SKIN_PARAMETER, skinParam);
+          if (provider.getModule().getId().equals(module.getId())) {
+            for (ComponentResource resource : resources) {
+
+              if (!resource.isValidForApp(appName)) {
+                continue;
+              }
+
+              log.debug("Processing resource: " + resource);
+              String resourcePath = resource.getPath();
+              if (resource.getType() == ComponentResourceType.Stylesheet) {
+                // do these differently...
+              } else if (resource.getType() == ComponentResourceType.Static) {
+                if (resourcePath.startsWith(KernelConstants.KERNEL_JAVA_PACKAGE)) {
+                  final String[] pathParts = WebServiceUtil.getInstance().getSegments(
+                      resourcePath.substring(KernelConstants.KERNEL_JAVA_PACKAGE.length()));
+                  final Component component = provider.getComponent(pathParts[1], getParameters());
+                  sb.append(ComponentGenerator.getInstance().generate(component)).append("\n");
+                } else {
+
+                  // Skin version handling
+                  if (resourcePath.contains(KernelConstants.SKIN_PARAMETER)) {
+                    resourcePath = resourcePath.replaceAll(KernelConstants.SKIN_PARAMETER,
+                        skinParam);
+                  }
+
+                  if (!resourcePath.startsWith("/")) {
+                    // Tomcat 8 forces getRealPath to start with a slash
+                    resourcePath = "/" + resourcePath;
+                  }
+
+                  try {
+                    final File file = new File(context.getRealPath(resourcePath));
+                    if (!file.exists() || !file.canRead()) {
+                      log.error(file.getAbsolutePath() + " cannot be read");
+                      continue;
+                    }
+                    String resourceContents = FileUtils.readFileToString(file, "UTF-8");
+                    sb.append(resourceContents).append("\n");
+                  } catch (Exception e) {
+                    log.error("Error reading file: " + resource, e);
+                  }
+                }
+              } else if (resource.getType() == ComponentResourceType.Dynamic) {
+                if (resourcePath.startsWith("/") && getContextUrl().length() > 0) {
+                  resourcePath = getContextUrl() + resourcePath.substring(1);
+                } else {
+                  resourcePath = getContextUrl() + resourcePath;
                 }
 
-                if (!resourcePath.startsWith("/")) {
-                  // Tomcat 8 forces getRealPath to start with a slash
-                  resourcePath = "/" + resourcePath;
-                }
-
-                try {
-                  final File file = new File(context.getRealPath(resourcePath));
-                  if (!file.exists() || !file.canRead()) {
-                    log.error(file.getAbsolutePath() + " cannot be read");
-                    continue;
-                  }
-                  String resourceContents = FileUtils.readFileToString(file, "UTF-8");
-                  sb.append(resourceContents).append("\n");
-                } catch (Exception e) {
-                  log.error("Error reading file: " + resource, e);
-                }
+                sb.append("$LAB.script('" + resourcePath
+                    + "').wait(function(){var _exception; try{\n");
+                cntDynamicScripts++;
+              } else {
+                log.error("Resource " + resource + " not supported");
               }
-            } else if (resource.getType() == ComponentResourceType.Dynamic) {
-              if (resourcePath.startsWith("/") && getContextUrl().length() > 0) {
-                resourcePath = getContextUrl() + resourcePath.substring(1);
-              } else {
-                resourcePath = getContextUrl() + resourcePath;
-              }
-
-              sb.append("$LAB.script('" + resourcePath
-                  + "').wait(function(){var _exception; try{\n");
-              cntDynamicScripts++;
-            } else {
-              log.error("Resource " + resource + " not supported");
             }
           }
         }
       }
+
+      if (!"".equals(sb.toString())) {
+        /*
+         * If a module is in development or the application is running the tests, add the isDebug
+         * variable to the generated javascript file.
+         * 
+         * If the isDebug variable is present in the javascript files, the code that calls
+         * OB.UTIL.Debug will not be executed
+         * 
+         * This option is intended to run additional code (checks, etc) that will not be run while
+         * in production.
+         * 
+         * This improves performance at the same time that the developer have a tool to improve
+         * stability.
+         * 
+         * TODO: add an algorithm to remove the OB.UTIL.Debug code and calls from the generated
+         * javacript file
+         * 
+         * TODO: don't load the ob-debug.js file if not in use
+         */
+        if (isInDevelopment()
+            || OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
+          // append a global isDebug var and the causes that provoked the application to enter Debug
+          // mode
+          sb.insert(
+              0,
+              String
+                  .format(
+                      "var isDebug = true;\nvar debugCauses = {\n  isInDevelopment: %s,\n  isTestEnvironment: %s\n};\n\n",
+                      isInDevelopment(),
+                      OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")));
+        }
+        sb.append("if (window.onerror && window.onerror.name === '"
+            + KernelConstants.BOOTSTRAP_ERROR_HANDLER_NAME + "') { window.onerror = null; }");
+        sb.append("if (typeof OBStartApplication !== 'undefined' && Object.prototype.toString.call(OBStartApplication) === '[object Function]') { OBStartApplication(); }");
+      }
+
+      for (int i = 0; i < cntDynamicScripts; i++) {
+        // add extra exception handling code otherwise exceptions occuring in
+        // the Labs wait function are not visible.
+        sb.append("\n} catch (_exception) {");
+        sb.append("if (isc) { isc.Log.logError(_exception + ' ' + _exception.message + ' ' + _exception.stack); }");
+        sb.append("if (console && console.trace) { console.trace();}");
+        sb.append("}\n});");
+      }
+
+      // note compress, note that modules are cached in memory
+      // when changing development status, system needs to be restarted.
+      final String output;
+      // in classicmode the isc combined is included, compressing that gives errors
+      if (!isInDevelopment() && !isClassicMode()
+          && !OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
+        output = JSCompressor.getInstance().compress(sb.toString());
+      } else {
+        output = sb.toString();
+      }
+      final String md5 = DigestUtils.md5Hex(output);
+      final String getTargetLocation = context.getRealPath(GEN_TARGET_LOCATION);
+      final File dir = new File(getTargetLocation);
+      if (!dir.exists()) {
+        dir.mkdir();
+      }
+      File outFile = new File(getTargetLocation + "/" + md5 + ".js");
+
+      if (!outFile.exists()) {
+        try {
+          log.debug("Writing file: " + outFile.getAbsolutePath());
+          FileUtils.writeStringToFile(outFile, output, "UTF-8");
+        } catch (Exception e) {
+          log.error("Error writing file: " + e.getMessage(), e);
+        }
+      }
+
+      if (!isInDevelopment()) {
+        resourceProvider.putStaticResourceCachedInfo(appName, md5);
+      }
+
+      return md5;
     }
-
-    if (!"".equals(sb.toString())) {
-      /*
-       * If a module is in development or the application is running the tests, add the isDebug
-       * variable to the generated javascript file.
-       * 
-       * If the isDebug variable is present in the javascript files, the code that calls
-       * OB.UTIL.Debug will not be executed
-       * 
-       * This option is intended to run additional code (checks, etc) that will not be run while in
-       * production.
-       * 
-       * This improves performance at the same time that the developer have a tool to improve
-       * stability.
-       * 
-       * TODO: add an algorithm to remove the OB.UTIL.Debug code and calls from the generated
-       * javacript file
-       * 
-       * TODO: don't load the ob-debug.js file if not in use
-       */
-      if (isInDevelopment()
-          || OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
-        // append a global isDebug var and the causes that provoked the application to enter Debug
-        // mode
-        sb.insert(
-            0,
-            String
-                .format(
-                    "var isDebug = true;\nvar debugCauses = {\n  isInDevelopment: %s,\n  isTestEnvironment: %s\n};\n\n",
-                    isInDevelopment(),
-                    OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")));
-      }
-      sb.append("if (window.onerror && window.onerror.name === '"
-          + KernelConstants.BOOTSTRAP_ERROR_HANDLER_NAME + "') { window.onerror = null; }");
-      sb.append("if (typeof OBStartApplication !== 'undefined' && Object.prototype.toString.call(OBStartApplication) === '[object Function]') { OBStartApplication(); }");
-    }
-
-    for (int i = 0; i < cntDynamicScripts; i++) {
-      // add extra exception handling code otherwise exceptions occuring in
-      // the Labs wait function are not visible.
-      sb.append("\n} catch (_exception) {");
-      sb.append("if (isc) { isc.Log.logError(_exception + ' ' + _exception.message + ' ' + _exception.stack); }");
-      sb.append("if (console && console.trace) { console.trace();}");
-      sb.append("}\n});");
-    }
-
-    // note compress, note that modules are cached in memory
-    // when changing development status, system needs to be restarted.
-    final String output;
-    // in classicmode the isc combined is included, compressing that gives errors
-    if (!isInDevelopment() && !isClassicMode()
-        && !OBPropertiesProvider.getInstance().getBooleanProperty("test.environment")) {
-      output = JSCompressor.getInstance().compress(sb.toString());
-    } else {
-      output = sb.toString();
-    }
-    final String md5 = DigestUtils.md5Hex(output);
-    final String getTargetLocation = context.getRealPath(GEN_TARGET_LOCATION);
-    final File dir = new File(getTargetLocation);
-    if (!dir.exists()) {
-      dir.mkdir();
-    }
-    File outFile = new File(getTargetLocation + "/" + md5 + ".js");
-    if (!outFile.exists()) {
-      try {
-        log.debug("Writing file: " + outFile.getAbsolutePath());
-        FileUtils.writeStringToFile(outFile, output, "UTF-8");
-      } catch (Exception e) {
-        log.error("Error writing file: " + e.getMessage(), e);
-      }
-    }
-    return md5;
   }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceProvider.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,153 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is used as a cache for the static resources (js and css) used in the application. It
+ * keeps the information needed to make use of those resources without the need of generating them
+ * again.
+ */
+@ApplicationScoped
+public class StaticResourceProvider implements StaticResourceProviderMBean {
+  private static final Logger log = LoggerFactory.getLogger(StaticResourceProvider.class);
+
+  private String genTargetLocation;
+  private ConcurrentHashMap<String, String> staticResources = new ConcurrentHashMap<>();
+
+  /**
+   * Returns the information stored for a particular static resource whose identifying name is
+   * passed as parameter.
+   * 
+   * @param resourceName
+   *          the identifying name of the static resource
+   * 
+   * @return a String with information of the static resource
+   */
+  public String getStaticResourceCachedInfo(String resourceName) {
+    return staticResources.get(resourceName);
+  }
+
+  /**
+   * Returns the file name of a particular static resource whose identifying name is passed as
+   * parameter, if the file exists. If the file does not exists, this method returns null and
+   * removes the mapping of the static resource.
+   * 
+   * @param resourceName
+   *          the identifying name of the static resource
+   * 
+   * @return a String with information of the static resource
+   */
+  public String getStaticResourceCachedFileName(String resourceName) {
+    String resource = staticResources.get(resourceName);
+    if (resource == null) {
+      return null;
+    }
+    String jsFileName = resource + ".js";
+    Path resourceFile = Paths.get(getGenTargetLocation(), jsFileName);
+    if (!Files.exists(resourceFile)) {
+      staticResources.remove(resourceName);
+      log.info("Static resource file with name {} not found, removed its information from cache.",
+          jsFileName);
+      return null;
+    }
+    return resource;
+  }
+
+  private String getGenTargetLocation() {
+    if (genTargetLocation == null) {
+      genTargetLocation = RequestContext.getServletContext().getRealPath(
+          StaticResourceComponent.GEN_TARGET_LOCATION);
+    }
+    return genTargetLocation;
+  }
+
+  /**
+   * Stores the information related to a particular static resource.
+   * 
+   * @param resourceName
+   *          the identifying name of the static resource
+   * @param content
+   *          the information about the static resource to keep in cache
+   */
+  public void putStaticResourceCachedInfo(String resourceName, String content) {
+    String value = staticResources.putIfAbsent(resourceName, content);
+    if (value == null) {
+      log.debug("Information of {} static resource stored in cache", resourceName);
+    }
+  }
+
+  /**
+   * @return a Set with the keys used in the static resources cache.
+   */
+  @Override
+  public Set<String> getCachedStaticResourceKeys() {
+    return staticResources.keySet();
+  }
+
+  /**
+   * Removes the cached information related to a static resource whose identifying name is passed as
+   * parameter.
+   * 
+   * @param resourceName
+   *          the identifying name of the static resource
+   */
+  @Override
+  public void removeStaticResourceCachedInfo(String resourceName) {
+    if (staticResources.containsKey(resourceName)) {
+      staticResources.remove(resourceName);
+      log.info("Information of {} static resource removed from cache", resourceName);
+    }
+  }
+
+  /**
+   * Removes all the cached information of the static resources.
+   */
+  @Override
+  public void removeAllStaticResourceCachedInfo() {
+    staticResources.clear();
+    log.info("Static resources information removed from cache");
+  }
+
+  /**
+   * @return a List with the names of the files that contain static resources.
+   */
+  @Override
+  public List<String> getStaticResourceFileNames() {
+    List<String> fileNames = new ArrayList<>();
+    for (String key : staticResources.keySet()) {
+      if (!key.contains(StyleSheetResourceComponent.CSS)) {
+        fileNames.add(key + ": " + staticResources.get(key) + ".js");
+      }
+    }
+    return fileNames;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceProviderMBean.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,53 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This interface allows to define the {@link StaticResourceProvider} class as an standard MBean
+ * that can be managed through JMX.
+ */
+public interface StaticResourceProviderMBean {
+
+  /**
+   * @return a Set with the keys used in the static resources cache.
+   */
+  public Set<String> getCachedStaticResourceKeys();
+
+  /**
+   * @return a List with the names of the files that contain static resources.
+   */
+  public List<String> getStaticResourceFileNames();
+
+  /**
+   * Removes the cached information related to a static resource whose identifying name is passed as
+   * parameter.
+   * 
+   * @param resourceName
+   *          the identifying name of the static resource
+   */
+  public void removeStaticResourceCachedInfo(String resourceName);
+
+  /**
+   * Removes all the cached information about the static resources.
+   */
+  public void removeAllStaticResourceCachedInfo();
+}
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StyleSheetResourceComponent.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StyleSheetResourceComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -46,10 +46,44 @@
   private static final Logger log = Logger.getLogger(StyleSheetResourceComponent.class);
   private static final String IMGURLHOLDER = "__URLHOLDER__";
 
+  protected static final String CSS = "CSS";
+
   @Inject
   @Any
   private Instance<ComponentProvider> componentProviders;
 
+  @Inject
+  private StaticResourceProvider resourceProvider;
+
+  private Boolean isInDevelopment;
+
+  @Override
+  public boolean isInDevelopment() {
+    if (isInDevelopment == null) {
+      isInDevelopment = false;
+      final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
+      for (Module module : modules) {
+        for (ComponentProvider provider : componentProviders) {
+          final List<ComponentResource> resources = provider.getGlobalComponentResources();
+          if (resources == null || resources.size() == 0) {
+            continue;
+          }
+
+          if (provider.getModule().getId().equals(module.getId())) {
+            for (ComponentResource resource : resources) {
+              if (resource.getType() == ComponentResourceType.Stylesheet
+                  && module.isInDevelopment()) {
+                isInDevelopment = true;
+                break;
+              }
+            }
+          }
+        }
+      }
+    }
+    return isInDevelopment;
+  }
+
   /**
    * @return returns this instance
    * @see org.openbravo.client.kernel.BaseComponent#getData()
@@ -69,40 +103,24 @@
 
   @Override
   public String getETag() {
-    final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
-    final StringBuilder version = new StringBuilder();
-    for (Module module : modules) {
-      boolean hasStyleSheet = false;
-      for (ComponentProvider provider : componentProviders) {
-        final List<ComponentResource> resources = provider.getGlobalComponentResources();
-        if (resources == null || resources.size() == 0) {
-          continue;
-        }
-
-        if (provider.getModule().getId().equals(module.getId())) {
-          for (ComponentResource resource : resources) {
-            if (resource.getType() == ComponentResourceType.Stylesheet) {
-              hasStyleSheet = true;
-              break;
-            }
-          }
-        }
-      }
-      if (hasStyleSheet) {
-        if (module.isInDevelopment()) {
-          // do something unique
-          version.append(System.currentTimeMillis() + "");
-        } else {
-          version.append(KernelUtils.getInstance().getVersionParameters(module));
-        }
-      }
+    final String appNameKey = getAppNameKey();
+    if (resourceProvider.getStaticResourceCachedInfo(appNameKey) == null) {
+      // do something unique
+      return String.valueOf(System.currentTimeMillis());
+    } else {
+      // compute the md5 of the CSS cached content
+      return DigestUtils.md5Hex(resourceProvider.getStaticResourceCachedInfo(appNameKey));
     }
-    // compute the md5 of the version string and return that
-    return DigestUtils.md5Hex(version.toString());
   }
 
   @Override
   public String generate() {
+    final String appNameKey = getAppNameKey();
+    String cssContent = resourceProvider.getStaticResourceCachedInfo(appNameKey);
+    if (cssContent != null) {
+      return cssContent;
+    }
+
     final List<Module> modules = KernelUtils.getInstance().getModulesOrderedByDependency();
     final ServletContext context = (ServletContext) getParameters().get(
         KernelConstants.SERVLET_CONTEXT);
@@ -236,7 +254,25 @@
       }
     }
 
-    return sb.toString();
+    cssContent = sb.toString();
+    if (!isInDevelopment()) {
+      resourceProvider.putStaticResourceCachedInfo(appNameKey, cssContent);
+    }
+    return cssContent;
+  }
+
+  private String getAppNameKey() {
+    String appNameKey = getApplicationName() + "_" + CSS;
+
+    if (getParameters().containsKey(KernelConstants.SKIN_PARAMETER)) {
+      appNameKey += "_" + (String) getParameters().get(KernelConstants.SKIN_PARAMETER);
+    } else {
+      appNameKey += "_" + KernelConstants.SKIN_DEFAULT;
+    }
+    if ("true".equals(getParameters().get("_cssDataUri"))) {
+      appNameKey += "_cssDataUri";
+    }
+    return appNameKey;
   }
 
   public String getId() {
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-dynamic-js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-dynamic-js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -55,3 +55,18 @@
     '${entity.name?js_string}':  true<#if entity_has_next>,</#if>
     </#list>
 };
+
+OB.Application.language = '${data.languageId?js_string}';
+OB.Application.language_string = '${data.language?js_string}';
+OB.Application.systemVersion = '${data.systemVersion?js_string}'; // global version used in all hyperlinks
+OB.Application.purpose = '${data.instancePurpose?js_string}';
+OB.Application.licenseType = '${data.licenseType?js_string}';
+OB.Application.isTrial = ${data.trialStringValue};
+OB.Application.isGolden = ${data.goldenStringValue};
+OB.Application.isActiveInstance = ${data.activeInstanceStringValue};
+OB.Application.versionDescription = '${data.versionDescription?js_string}';
+OB.Application.companyImage = {
+  <#list data.companyImageLogoData?keys as key>
+    '${key}': '${data.companyImageLogoData[key]}'<#if key_has_next>,</#if>
+  </#list>
+};
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -28,17 +28,10 @@
 var OB = {
     Application : {
         testEnvironment: ${data.testEnvironment?string},
-        language: '${data.languageId?js_string}',
-        language_string: '${data.language?js_string}',
-        systemVersion : '${data.systemVersion?js_string}', // global version used in all hyperlinks
         contextUrl: '${data.contextUrl}',
         communityBrandingStaticUrl: '${data.communityBrandingStaticUrl?js_string}',
         butlerUtilsUrl: '${data.butlerUtilsUrl?js_string}',
-        purpose: '${data.instancePurpose?js_string}',
-        licenseType: '${data.licenseType?js_string}',
-        isTrial: ${data.trialStringValue},
-        isGolden: ${data.goldenStringValue},
-        versionDescription: '${data.versionDescription?js_string}'
+        communityBrandingUrl: '${data.communityBrandingUrl?js_string}'
     },
 
     Format : {
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <NAME><![CDATA[Workspace & Widgets]]></NAME>
-<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION><![CDATA[2.1.31811]]></VERSION>
+<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION><![CDATA[2.1.32382]]></VERSION>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <DESCRIPTION><![CDATA[Workspace & Widgets]]></DESCRIPTION>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <HELP><![CDATA[Provides the infrastructure of workspace tab (formerly My Openbravo)]]></HELP>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <URL><![CDATA[http://forge.openbravo.com/projects/myopenbravo]]></URL>
@@ -23,7 +23,7 @@
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <HASREFERENCEDATA><![CDATA[Y]]></HASREFERENCEDATA>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <UPDATEINFO><![CDATA[Styling bugfixing]]></UPDATEINFO>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <REFERENCEDATAINFO><![CDATA[Provides the infrastructure of workspace tab]]></REFERENCEDATAINFO>
-<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--2758CD25B2704AF6BBAD10365FC82C06-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--2758CD25B2704AF6BBAD10365FC82C06--></AD_MODULE>
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--15F51F03882F444CAB6593B4566DC929-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--15F51F03882F444CAB6593B4566DC929-->  <AD_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_MODULE_ID>
 <!--15F51F03882F444CAB6593B4566DC929-->  <AD_DEPENDENT_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_DEPENDENT_MODULE_ID>
-<!--15F51F03882F444CAB6593B4566DC929-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--15F51F03882F444CAB6593B4566DC929-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--15F51F03882F444CAB6593B4566DC929-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--15F51F03882F444CAB6593B4566DC929-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Application]]></DEPENDANT_MODULE_NAME>
 <!--15F51F03882F444CAB6593B4566DC929-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <AD_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_MODULE_ID>
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--E71B28FC949D481D9F59C17D01E46EF9-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--E71B28FC949D481D9F59C17D01E46EF9-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME>
 <!--E71B28FC949D481D9F59C17D01E46EF9-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOBUtils.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -19,6 +19,8 @@
 package org.openbravo.client.myob;
 
 import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
@@ -27,6 +29,7 @@
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.Query;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.util.OBClassLoader;
@@ -50,6 +53,8 @@
   private static String MENU_ITEM_IS_SEPARATOR = "isSeparator";
   private static String MENU_ITEM_TITLE = "title";
   private static String MENU_ITEM_CLICK = "click";
+  private ConcurrentHashMap<String, WidgetClassInfo> widgetClasses = new ConcurrentHashMap<>();
+  private List<String> anonymousWidgetClasses;
 
   /**
    * Calls {@link #getWidgetTitle(WidgetClass)} using the
@@ -130,52 +135,95 @@
 
   static List<WidgetInstance> getDefaultWidgetInstances(String availableAtLevel,
       String[] availableAtValues) {
-    OBCriteria<WidgetInstance> widgetInstancesCrit = OBDal.getInstance().createCriteria(
-        WidgetInstance.class);
-    widgetInstancesCrit.add(Restrictions.isNull(WidgetInstance.PROPERTY_VISIBLEATUSER));
     if ("OB".equals(availableAtLevel)) {
-      widgetInstancesCrit.setFilterOnReadableClients(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, 0L));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, OBDal.getInstance()
-          .get(Client.class, "0")));
-      widgetInstancesCrit.setFilterOnReadableOrganization(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_ORGANIZATION, OBDal
-          .getInstance().get(Organization.class, "0")));
+      return getDefaultWidgetInstancesAtOBLevel();
     } else if ("SYSTEM".equals(availableAtLevel)) {
-      widgetInstancesCrit.setFilterOnReadableClients(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, 1L));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, OBDal.getInstance()
-          .get(Client.class, "0")));
-      widgetInstancesCrit.setFilterOnReadableOrganization(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_ORGANIZATION, OBDal
-          .getInstance().get(Organization.class, "0")));
+      return getDefaultWidgetInstancesAtSystemLevel();
     } else if ("CLIENT".equals(availableAtLevel)) {
-      widgetInstancesCrit.setFilterOnReadableClients(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, OBDal.getInstance()
-          .get(Client.class, availableAtValues[0])));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, 2L));
+      return getDefaultWidgetInstancesAtClientLevel(availableAtValues[0]);
     } else if ("ORG".equals(availableAtLevel)) {
-      final Organization organization = OBDal.getInstance().get(Organization.class,
-          availableAtValues[0]);
-      widgetInstancesCrit.setFilterOnReadableClients(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT,
-          organization.getClient()));
-      widgetInstancesCrit.setFilterOnReadableOrganization(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_ORGANIZATION, organization));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, 3L));
+      return getDefaultWidgetInstancesAtOrgLevel(availableAtValues);
     } else if ("ROLE".equals(availableAtLevel)) {
-      final Role role = OBDal.getInstance().get(Role.class, availableAtValues[0]);
-      widgetInstancesCrit.setFilterOnReadableClients(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, role.getClient()));
-      widgetInstancesCrit.setFilterOnReadableOrganization(false);
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_ORGANIZATION, OBDal
-          .getInstance().get(Organization.class, "0")));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_VISIBLEATROLE, role));
-      widgetInstancesCrit.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, 4L));
-    } else if ("USER".equals(availableAtLevel)) {
-      // not supported
+      return getDefaultWidgetInstancesAtRoleLevel(availableAtValues[0]);
+    } else {
+      // USER level is not supported
     }
-    return widgetInstancesCrit.list();
+    OBCriteria<WidgetInstance> criteria = OBDal.getInstance().createCriteria(WidgetInstance.class);
+    criteria.add(Restrictions.isNull(WidgetInstance.PROPERTY_VISIBLEATUSER));
+    return criteria.list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtOBLevel() {
+    Client client = OBDal.getInstance().getProxy(Client.class, "0");
+    Organization org = OBDal.getInstance().getProxy(Organization.class, "0");
+    return getWidgetInstanceCriteria(0L, client, org, null).list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtSystemLevel() {
+    Client client = OBDal.getInstance().getProxy(Client.class, "0");
+    Organization org = OBDal.getInstance().getProxy(Organization.class, "0");
+    return getWidgetInstanceCriteria(1L, client, org, null).list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtClientLevel(String clientId) {
+    Client client = OBDal.getInstance().getProxy(Client.class, clientId);
+    return getWidgetInstanceCriteria(2L, client, null, null).list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtOrgLevel(Set<String> orgIds) {
+    return getWidgetInstanceCriteriaForOrgs(3L, null, orgIds, null).list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtOrgLevel(String[] orgIds) {
+    return getWidgetInstanceCriteriaForOrgs(3L, null, orgIds, null).list();
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtRoleLevel(String roleId) {
+    final Role role = OBDal.getInstance().getProxy(Role.class, roleId);
+    return getDefaultWidgetInstancesAtRoleLevel(role);
+  }
+
+  static List<WidgetInstance> getDefaultWidgetInstancesAtRoleLevel(Role role) {
+    Organization org = OBDal.getInstance().getProxy(Organization.class, "0");
+    return getWidgetInstanceCriteria(4L, null, org, role).list();
+  }
+
+  private static OBCriteria<WidgetInstance> getWidgetInstanceCriteria(Long priority, Client client,
+      Organization organization, Role role) {
+    OBCriteria<WidgetInstance> criteria = OBDal.getInstance().createCriteria(WidgetInstance.class);
+    criteria.add(Restrictions.isNull(WidgetInstance.PROPERTY_VISIBLEATUSER));
+    criteria.setFilterOnReadableClients(false);
+    criteria.add(Restrictions.eq(WidgetInstance.PROPERTY_RELATIVEPRIORITY, priority));
+    if (client != null) {
+      criteria.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, client));
+    }
+    if (organization != null) {
+      criteria.setFilterOnReadableOrganization(false);
+      criteria.add(Restrictions.eq(WidgetInstance.PROPERTY_ORGANIZATION, organization));
+    }
+    if (role != null) {
+      criteria.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, role.getClient()));
+      criteria.add(Restrictions.eq(WidgetInstance.PROPERTY_VISIBLEATROLE, role));
+    }
+    return criteria;
+  }
+
+  private static OBCriteria<WidgetInstance> getWidgetInstanceCriteriaForOrgs(Long priority,
+      Client client, String[] orgIds, Role role) {
+    OBCriteria<WidgetInstance> criteria = getWidgetInstanceCriteria(priority, client, null, role);
+    criteria.setFilterOnReadableOrganization(false);
+    criteria.add(Restrictions.in(WidgetInstance.PROPERTY_ORGANIZATION + "."
+        + Organization.PROPERTY_ID, orgIds));
+    return criteria;
+  }
+
+  private static OBCriteria<WidgetInstance> getWidgetInstanceCriteriaForOrgs(Long priority,
+      Client client, Set<String> orgIds, Role role) {
+    OBCriteria<WidgetInstance> criteria = getWidgetInstanceCriteria(priority, client, null, role);
+    criteria.setFilterOnReadableOrganization(false);
+    criteria.add(Restrictions.in(WidgetInstance.PROPERTY_ORGANIZATION + "."
+        + Organization.PROPERTY_ID, orgIds));
+    return criteria;
   }
 
   static List<WidgetInstance> getUserWidgetInstances() {
@@ -227,4 +275,37 @@
     }
   }
 
+  WidgetClassInfo getWidgetClassInfo(WidgetClass widgetClass) {
+    if (!widgetClasses.containsKey(widgetClass.getId())) {
+      widgetClasses.putIfAbsent(widgetClass.getId(), getWidgetClassInfoFromDatabase(widgetClass));
+    }
+    return widgetClasses.get(widgetClass.getId());
+  }
+
+  WidgetClassInfo getWidgetClassInfoFromDatabase(WidgetClass widgetClass) {
+    final WidgetProvider widgetProvider = getWidgetProvider(widgetClass);
+    if (!widgetProvider.validate()) {
+      return null;
+    }
+    return new WidgetClassInfo(widgetProvider);
+  }
+
+  List<String> getAnonymousAccessibleWidgetClasses() {
+    if (anonymousWidgetClasses == null) {
+      anonymousWidgetClasses = getAnonymousAccessibleWidgetClassesFromDatabase();
+    }
+    return anonymousWidgetClasses;
+  }
+
+  @SuppressWarnings("unchecked")
+  List<String> getAnonymousAccessibleWidgetClassesFromDatabase() {
+    final StringBuilder hql = new StringBuilder();
+    hql.append("SELECT widgetClass.id ");
+    hql.append("FROM OBKMO_WidgetClass widgetClass ");
+    hql.append("WHERE widgetClass.allowAnonymousAccess IS true ");
+    hql.append("AND widgetClass.superclass IS false ");
+    hql.append("AND widgetClass.availableInWorkspace IS true");
+    Query query = OBDal.getInstance().getSession().createQuery(hql.toString());
+    return query.list();
+  }
 }
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -60,7 +60,6 @@
   private static final String WIDGET_REMOVED = "WIDGET_REMOVED";
   private static final String PUBLISH_CHANGES = "PUBLISH_CHANGES";
   private static final String RELOAD_WIDGETS = "RELOAD_WIDGETS";
-  private static final String GET_COMMUNITY_BRANDING_URL = "GET_COMMUNITY_BRANDING_URL";
   private static final String GET_AVAILABLE_WIDGET_CLASSES = "GET_AVAILABLE_WIDGET_CLASSES";
 
   @Inject
@@ -119,8 +118,6 @@
             roleId = availableAtLevelValue[0];
           }
           addAvailableWidgetClasses(o, roleId, isAdminMode);
-        } else if (strEventType.equals(GET_COMMUNITY_BRANDING_URL)) {
-          o.put("url", Utility.getCommunityBrandingUrl("MyOB"));
         } else {
           message.setType("Error");
           message.setMessage("@OBKMO_UnknownEventType@");
@@ -185,8 +182,11 @@
     List<String> availableClasses = null;
     try {
       final String strEventType = o.getString("eventType");
-      boolean onlyWorkspaceWidgets = GET_AVAILABLE_WIDGET_CLASSES.equals(strEventType);
-      availableClasses = component.getAvailableWidgetClasses(roleId, onlyWorkspaceWidgets);
+      if (GET_AVAILABLE_WIDGET_CLASSES.equals(strEventType)) {
+        availableClasses = component.getAvailableWorkspaceWidgetClasses(roleId);
+      } else {
+        availableClasses = component.getAvailableWidgetClasses(roleId);
+      }
       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	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponent.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -19,14 +19,10 @@
 package org.openbravo.client.myob;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.UUID;
 
 import javax.inject.Inject;
 
@@ -34,14 +30,14 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
-import org.openbravo.base.exception.OBException;
+import org.hibernate.Query;
+import org.hibernate.criterion.Restrictions;
 import org.openbravo.client.application.ApplicationUtils;
-import org.openbravo.client.kernel.BaseTemplateComponent;
-import org.openbravo.client.kernel.Template;
+import org.openbravo.client.kernel.SessionDynamicTemplateComponent;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.dal.service.OBQuery;
 import org.openbravo.model.ad.access.Role;
 import org.openbravo.model.ad.access.RoleOrganization;
 import org.openbravo.model.ad.access.User;
@@ -50,33 +46,31 @@
 import org.openbravo.model.common.enterprise.Organization;
 
 /**
- * Creates the properties list which is initially loaded in the client.
+ * Creates the Workspace properties list which is initially loaded in the client.
  * 
  * @author mtaal
  */
-public class MyOpenbravoComponent extends BaseTemplateComponent {
+public class MyOpenbravoComponent extends SessionDynamicTemplateComponent {
 
   static final String COMPONENT_ID = "MyOpenbravo";
   private static final String TEMPLATEID = "CA8047B522B44F61831A8CAA3AE2A7CD";
 
-  private List<WidgetInstance> widgets = null;
-  private List<String> widgetClassDefinitions = null;
   private Logger log = Logger.getLogger(MyOpenbravoComponent.class);
 
   @Inject
   private MyOBUtils myOBUtils;
 
-  /*
+  /**
    * (non-Javadoc)
    * 
    * @see org.openbravo.client.kernel.BaseTemplateComponent#getComponentTemplate()
    */
   @Override
-  protected Template getComponentTemplate() {
-    return OBDal.getInstance().get(Template.class, TEMPLATEID);
+  protected String getTemplateId() {
+    return TEMPLATEID;
   }
 
-  /*
+  /**
    * (non-Javadoc)
    * 
    * @see org.openbravo.client.kernel.BaseComponent#getId()
@@ -85,48 +79,55 @@
     return COMPONENT_ID;
   }
 
-  List<String> getAvailableWidgetClasses(String roleId, boolean shouldBeDisplayed) throws Exception {
+  List<String> getAvailableWorkspaceWidgetClasses(String roleId) throws Exception {
+    List<String> filters = new ArrayList<String>();
+    filters.add("widgetClassAccess.widgetClass.availableInWorkspace IS true");
+    filters.add("widgetClassAccess.widgetClass.superclass IS false");
+    return getAccessibleWidgetClasses(roleId, filters);
+  }
+
+  List<String> getAvailableWidgetClasses(String roleId) throws Exception {
+    List<String> filters = new ArrayList<String>();
+    filters.add("widgetClassAccess.widgetClass.superclass IS false");
+    return getAccessibleWidgetClasses(roleId, filters);
+  }
+
+  /**
+   * @param roleId
+   *          The id of the role whose available widget classes will be retrieved.
+   * @param additionalFilters
+   *          A list of filters to be applied on the base query to retrieve the accessible widget
+   *          classes of a role.
+   * @return the list of available widget classes for the role whose id is passed as parameter.
+   */
+  private List<String> getAccessibleWidgetClasses(String roleId, List<String> additionalFilters)
+      throws Exception {
     OBContext.setAdminMode();
     try {
-      if (widgetClassDefinitions != null) {
-        return widgetClassDefinitions;
-      }
-
-      final List<JSONObject> definitions = new ArrayList<JSONObject>();
-      final List<String> tmp = new ArrayList<String>();
-      String classDef = "";
-      String strConditionQuery = WidgetClass.PROPERTY_SUPERCLASS + " is false";
-      if (shouldBeDisplayed) {
-        strConditionQuery += " and " + WidgetClass.PROPERTY_AVAILABLEINWORKSPACE + " is true";
-      }
-
-      final OBQuery<WidgetClass> widgetClassesQry = OBDal.getInstance().createQuery(
-          WidgetClass.class, strConditionQuery);
-      for (WidgetClass widgetClass : widgetClassesQry.list()) {
-        if (isAccessible(widgetClass, roleId)) {
-          final WidgetProvider widgetProvider = myOBUtils.getWidgetProvider(widgetClass);
-          if (!widgetProvider.validate()) {
-            continue;
-          }
-
-          definitions.add(widgetProvider.getWidgetClassDefinition());
-
-          try {
-            classDef = widgetProvider.generate();
-            classDef = classDef.substring(0, classDef.length() - 1);
-            tmp.add(classDef);
-          } catch (Exception e) {
-            // Do nothing as the definition is already in a loaded js file
-          }
+      List<String> widgetClassDefinitions = new ArrayList<String>();
+      StringBuilder whereClause = new StringBuilder();
+      if (additionalFilters != null) {
+        for (String filter : additionalFilters) {
+          whereClause.append("AND " + filter + " ");
         }
       }
-      Collections.sort(definitions, new WidgetClassComparator());
-
-      widgetClassDefinitions = new ArrayList<String>();
-      for (JSONObject json : definitions) {
-        widgetClassDefinitions.add(json.toString());
+      for (String widgetClassId : getAccessibleWidgetClassIds(roleId, whereClause.toString())) {
+        WidgetClass widgetClass = OBDal.getInstance().getProxy(WidgetClass.class, widgetClassId);
+        WidgetClassInfo widgetClassInfo;
+        if (isInDevelopment()) {
+          widgetClassInfo = myOBUtils.getWidgetClassInfoFromDatabase(widgetClass);
+        } else {
+          widgetClassInfo = myOBUtils.getWidgetClassInfo(widgetClass);
+        }
+        if (widgetClassInfo == null) {
+          log.debug("Not found information for widget class with id " + widgetClass.getId());
+          continue;
+        }
+        widgetClassDefinitions.add(widgetClassInfo.getWidgetClassProperties());
+        if (!StringUtils.isEmpty(widgetClassInfo.getWidgetClassDefinition())) {
+          widgetClassDefinitions.add(widgetClassInfo.getWidgetClassDefinition());
+        }
       }
-      widgetClassDefinitions.addAll(tmp);
       log.debug("Available Widget Classes: " + widgetClassDefinitions.size());
       return widgetClassDefinitions;
     } finally {
@@ -134,11 +135,45 @@
     }
   }
 
+  @SuppressWarnings("unchecked")
+  private List<String> getAccessibleWidgetClassIds(String roleId, String additionalWhereClause) {
+    final StringBuilder hql = new StringBuilder();
+    hql.append("SELECT widgetClassAccess.widgetClass.id ");
+    hql.append("FROM OBKMO_WidgetClassAccess widgetClassAccess ");
+    hql.append("WHERE widgetClassAccess.role.id=:roleId ");
+    if (!StringUtils.isEmpty(additionalWhereClause)) {
+      hql.append(additionalWhereClause);
+    }
+    Query query = OBDal.getInstance().getSession().createQuery(hql.toString());
+    if (StringUtils.isEmpty(roleId)) {
+      query.setString("roleId", OBContext.getOBContext().getRole().getId());
+    } else {
+      query.setString("roleId", roleId);
+    }
+    List<String> widgetClassIds = query.list();
+    List<String> anonymousWidgetClasses;
+    if (isInDevelopment()) {
+      anonymousWidgetClasses = myOBUtils.getAnonymousAccessibleWidgetClassesFromDatabase();
+    } else {
+      anonymousWidgetClasses = myOBUtils.getAnonymousAccessibleWidgetClasses();
+    }
+    // Include the widget classes which allow anonymous access
+    for (String anonymousWidgetClass : anonymousWidgetClasses) {
+      if (!widgetClassIds.contains(anonymousWidgetClass)) {
+        widgetClassIds.add(anonymousWidgetClass);
+      }
+    }
+    return widgetClassIds;
+  }
+
+  /**
+   * @return the list of available widget instances in the current context.
+   */
   public List<String> getWidgetInstanceDefinitions() {
     OBContext.setAdminMode();
     try {
       final List<String> result = new ArrayList<String>();
-      for (WidgetInstance widget : getContextWidgetInstances()) {
+      for (WidgetInstance widget : retrieveContextWidgetInstances()) {
         final JSONObject jsonObject = myOBUtils.getWidgetProvider(widget.getWidgetClass())
             .getWidgetInstanceDefinition(widget);
         result.add(jsonObject.toString());
@@ -226,113 +261,89 @@
     return "{}";
   }
 
-  @Override
-  public String getETag() {
-    return UUID.randomUUID().toString();
-  }
+  private List<WidgetInstance> retrieveContextWidgetInstances() {
+    final User user = OBContext.getOBContext().getUser();
+    final Role role = OBContext.getOBContext().getRole();
+    final Client client = OBContext.getOBContext().getCurrentClient();
+    final List<String> accessibleWidgetClasses = getAccessibleWidgetClassIds(role.getId(), null);
+    final List<WidgetInstance> userWidgets = getWidgetInstances(client, role, user,
+        accessibleWidgetClasses);
+    final List<WidgetInstance> defaultWidgets = getRoleDefaultWidgets(OBContext.getOBContext()
+        .getRole(), client.getId(), OBContext.getOBContext().getWritableOrganizations());
 
-  private List<WidgetInstance> getContextWidgetInstances() {
-    if (widgets != null) {
-      return widgets;
-    }
-    copyWidgets();
-
-    widgets = new ArrayList<WidgetInstance>();
-    final List<WidgetInstance> userWidgets = new ArrayList<WidgetInstance>(
-        MyOBUtils.getUserWidgetInstances());
-    log.debug("Defined User widgets:" + userWidgets.size());
-    // filter on the basis of role access
-    for (WidgetInstance widget : userWidgets) {
-      if (isAccessible(widget.getWidgetClass(), null)) {
-        widgets.add(widget);
+    final List<WidgetInstance> contextWidgets = new ArrayList<WidgetInstance>();
+    final List<WidgetInstance> copiedWidgets = new ArrayList<WidgetInstance>();
+    for (WidgetInstance userWidget : userWidgets) {
+      if (userWidget.isActive()) {
+        contextWidgets.add(userWidget);
+      }
+      if (userWidget.getCopiedFrom() != null) {
+        copiedWidgets.add(userWidget);
       }
     }
 
-    log.debug("Available User widgets:" + widgets.size());
-    return widgets;
-  }
-
-  private void copyWidgets() {
-    final List<WidgetInstance> userWidgets = new ArrayList<WidgetInstance>(
-        MyOBUtils.getUserWidgetInstances(false));
-    final User user = OBDal.getInstance().get(User.class,
-        OBContext.getOBContext().getUser().getId());
-    final Role role = OBDal.getInstance().get(Role.class,
-        OBContext.getOBContext().getRole().getId());
-    final Client client = OBDal.getInstance().get(Client.class,
-        OBContext.getOBContext().getCurrentClient().getId());
-    final Set<WidgetInstance> defaultWidgets = new HashSet<WidgetInstance>();
-
-    if (!OBContext.getOBContext().getRole().isForPortalUsers()) {
-      // do not include global widgets in portal roles
-      defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("OB", null));
-      defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("SYSTEM", null));
-    }
-
-    defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("CLIENT",
-        new String[] { client.getId() }));
-    final Set<String> orgs = OBContext.getOBContext().getWritableOrganizations();
-    for (String org : orgs) {
-      defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstances("ORG", new String[] { org }));
-    }
-    defaultWidgets
-        .addAll(MyOBUtils.getDefaultWidgetInstances("ROLE", new String[] { role.getId() }));
     log.debug("Copying new widget instances on user: " + user.getId() + " role: " + role.getId());
-
-    // remove the default widgets which are already defined on the user
-    for (WidgetInstance widget : userWidgets) {
-      if (widget.getCopiedFrom() != null) {
-        defaultWidgets.remove(widget.getCopiedFrom());
-      }
-    }
-    // now copy all the default widgets that are not defined on the user
     final Organization orgZero = OBDal.getInstance().get(Organization.class, "0");
     boolean copyDone = false;
-    for (WidgetInstance widget : defaultWidgets) {
-      final WidgetInstance copy = (WidgetInstance) DalUtil.copy(widget);
+    for (WidgetInstance defaultWidget : defaultWidgets) {
+      boolean defaultWidgetPresent = false;
+      for (WidgetInstance copiedWidget : copiedWidgets) {
+        if (copiedWidget.getCopiedFrom().getId().equals(defaultWidget.getId())) {
+          defaultWidgetPresent = true;
+          break;
+        }
+      }
+      if (defaultWidgetPresent) {
+        // do not copy the default widgets which are already defined on the user
+        continue;
+      }
+      final WidgetInstance copy = (WidgetInstance) DalUtil.copy(defaultWidget);
       copy.setClient(client);
       copy.setOrganization(orgZero);
       copy.setVisibleAtRole(role);
       copy.setVisibleAtUser(user);
-      copy.setCopiedFrom(widget);
+      copy.setCopiedFrom(defaultWidget);
       OBDal.getInstance().save(copy);
       log.debug("Copied widget instance: " + copy.getId() + " of Widget Class: "
           + copy.getWidgetClass().getWidgetTitle());
       copyDone = true;
+      if (accessibleWidgetClasses.contains(copy.getWidgetClass().getId())) {
+        contextWidgets.add(copy);
+      }
     }
     if (copyDone) {
       OBDal.getInstance().flush();
     }
+    log.debug("Available User widgets:" + contextWidgets.size());
+    return contextWidgets;
   }
 
-  private boolean isAccessible(WidgetClass widgetClass, String _roleId) {
-    if (widgetClass.isAllowAnonymousAccess()) {
-      return true;
-    }
-    String roleId = _roleId;
-    if (StringUtils.isEmpty(roleId)) {
-      roleId = OBContext.getOBContext().getRole().getId();
-    }
-    for (WidgetClassAccess widgetClassAccess : widgetClass.getOBKMOWidgetClassAccessList()) {
-      if (widgetClassAccess.getRole().getId().equals(roleId)) {
-        return true;
-      }
-    }
-    return false;
+  private List<WidgetInstance> getWidgetInstances(Client client, Role visibleAtRole,
+      User visibleAtUser, List<String> widgetClasses) {
+    OBCriteria<WidgetInstance> obc = OBDal.getInstance().createCriteria(WidgetInstance.class);
+    obc.setFilterOnReadableClients(false);
+    obc.setFilterOnActive(false);
+    obc.add(Restrictions.eq(WidgetInstance.PROPERTY_CLIENT, client));
+    obc.add(Restrictions.eq(WidgetInstance.PROPERTY_VISIBLEATROLE, visibleAtRole));
+    obc.add(Restrictions.eq(WidgetInstance.PROPERTY_VISIBLEATUSER, visibleAtUser));
+    obc.add(Restrictions.in(WidgetInstance.PROPERTY_WIDGETCLASS + "." + WidgetClass.PROPERTY_ID,
+        widgetClasses));
+    return obc.list();
   }
 
-  private class WidgetClassComparator implements Comparator<JSONObject> {
+  private List<WidgetInstance> getRoleDefaultWidgets(Role role, String clientId, Set<String> orgs) {
+    final List<WidgetInstance> defaultWidgets = new ArrayList<WidgetInstance>();
 
-    @Override
-    public int compare(JSONObject arg0, JSONObject arg1) {
-      try {
-        final String title0 = arg0.getString(WidgetProvider.TITLE);
-        final String title1 = arg1.getString(WidgetProvider.TITLE);
-        return title0.compareTo(title1);
-      } catch (Exception e) {
-        throw new OBException(e);
-      }
+    if (!role.isForPortalUsers()) {
+      // do not include global widgets in portal roles
+      defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstancesAtOBLevel());
+      defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstancesAtSystemLevel());
     }
 
+    defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstancesAtClientLevel(clientId));
+    defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstancesAtOrgLevel(orgs));
+    defaultWidgets.addAll(MyOBUtils.getDefaultWidgetInstancesAtRoleLevel(role));
+
+    return defaultWidgets;
   }
 }
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponentProvider.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoComponentProvider.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2013 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -41,11 +41,6 @@
 
   @Override
   public Component getComponent(String componentId, Map<String, Object> parameters) {
-    if (componentId.equals(MyOpenbravoComponent.COMPONENT_ID)) {
-      final MyOpenbravoComponent component = getComponent(MyOpenbravoComponent.class);
-      component.setParameters(parameters);
-      return component;
-    }
     if (componentId.equals(MyOpenbravoWidgetComponent.COMPONENT_ID)) {
       final MyOpenbravoWidgetComponent component = getComponent(MyOpenbravoWidgetComponent.class);
       component.setParameters(parameters);
@@ -61,8 +56,6 @@
         false));
     globalResources.add(createStaticResource(
         "web/org.openbravo.client.myob/js/ob-getting-started-view.js", false));
-    globalResources.add(createDynamicResource("org.openbravo.client.kernel/" + COMPONENT_TYPE + "/"
-        + MyOpenbravoComponent.COMPONENT_ID));
     globalResources
         .add(createStaticResource("web/org.openbravo.client.myob/js/ob-widget.js", false));
     globalResources.add(createStaticResource("web/org.openbravo.client.myob/js/ob-url-widget.js",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/WidgetClassInfo.java	Thu Sep 14 12:03:42 2017 +0000
@@ -0,0 +1,74 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.myob;
+
+/**
+ * This class is used to keep information about the definition of a WidgetClass.
+ */
+class WidgetClassInfo {
+  private WidgetProvider widgetProvider;
+  private String widgetClassProperties;
+  private String widgetClassDefinition;
+
+  public WidgetClassInfo(WidgetProvider widgetProvider) {
+    this.widgetProvider = widgetProvider;
+  }
+
+  /**
+   * @return the WidgetProvider used to retrieve the information of a particular WidgetClass.
+   */
+  public WidgetProvider getWidgetProvider() {
+    return widgetProvider;
+  }
+
+  /**
+   * @return a String containing the WidgetClass properties.
+   */
+  public String getWidgetClassProperties() {
+    if (widgetClassProperties == null) {
+      widgetClassProperties = widgetProvider.getWidgetClassDefinition().toString();
+    }
+    return widgetClassProperties;
+  }
+
+  /**
+   * This method returns the definition of those widget classes whose definition is generated at
+   * runtime. For those widget classes whose definition is loaded through a js file this method
+   * returns an empty String.
+   * 
+   * @return a String with the generated definition of the WidgetClass or an empty String if the
+   *         widget class definition is loaded through a js file.
+   */
+  public String getWidgetClassDefinition() {
+    if (widgetClassDefinition == null) {
+      widgetClassDefinition = "";
+      try {
+        widgetClassDefinition = widgetProvider.generate();
+        // remove ending semicolon to avoid errors when evaluating the widget class definition on
+        // the client side
+        widgetClassDefinition = widgetClassDefinition.substring(0,
+            widgetClassDefinition.length() - 1);
+      } catch (Exception e) {
+        // The widget provider does not support the generate operation. This means that the widget
+        // class definition will be completely created as part of the static Javascript content
+      }
+    }
+    return widgetClassDefinition;
+  }
+}
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/templates/my_ob_js.ftl	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/templates/my_ob_js.ftl	Thu Sep 14 12:03:42 2017 +0000
@@ -11,15 +11,13 @@
  * 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-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
 */
 
-isc.OBMyOpenbravoImplementation.addProperties({
+OB.OBMyOpenbravoProperties = {
   enableAdminMode: ${data.enableAdminMode},
   adminModeValueMap: ${data.adminModeValueMap}
-});
-
-//isc.Page.loadStyleSheet('OB.Styles.skinsPath + 'Default/org.openbravo.client.myob/ob-widget-styles.css?' + OB.Application.moduleVersionParameters['2758CD25B2704AF6BBAD10365FC82C06']);
+};
\ No newline at end of file
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-community-branding-widget.js	Thu Sep 14 12:03:42 2017 +0000
@@ -13,7 +13,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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -72,10 +72,8 @@
       clearTimeout(timerNoInternet);
 
       if (haveInternet) {
-        OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (response, data, request) {
-          var communityBrandingUrl = data.url;
-          me.setOBContent(haveInternet, communityBrandingUrl);
-        });
+        var communityBrandingUrl = OB.Application.communityBrandingUrl;
+        me.setOBContent(haveInternet, communityBrandingUrl);
       } else {
         me.setOBContent(false);
       }
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2016 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -440,10 +440,21 @@
       this.portalLayout.members[0].colNum = 0;
       this.portalLayout.members[1].colNum = 1;
       this.portalLayout.sendEvents = true;
-      this.reloadWidgets();
+      this.loadWidgets();
     }
   },
 
+  loadWidgets: function () {
+    var params = {
+      'preventWidgetMove': true
+    };
+    this.portalLayout.sendEvents = false;
+    this.isReloading = true;
+    this.portalLayout.getMembers()[0].removeAllRows();
+    this.portalLayout.getMembers()[1].removeAllRows();
+    this.notifyEvent('RELOAD_WIDGETS', params);
+  },
+
   setRecentList: function (layout) {
     var recentList, newRecent, handleClickFunction, recentIndex = 0,
         recent, lbl, newIcon, entryLayout, icon, destroyFunction, handleEnterKeyPressFunction;
@@ -694,7 +705,7 @@
     widgetManager.addWidget(widgetProperties);
   },
 
-  notifyEvent: function (eventType) {
+  notifyEvent: function (eventType, callbackProperties) {
     var post;
     if (!eventType) {
       return;
@@ -716,6 +727,8 @@
     }
 
     OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
+      data = data || {};
+      data.extraProperties = callbackProperties || {};
       OB.MyOB.eventResponseHandler(rpcResponse, data, rpcRequest);
     });
   },
@@ -741,7 +754,9 @@
       this.isReloading = false;
       this.portalLayout.sendEvents = !this.adminMode;
 
-      this.notifyEvent('WIDGET_MOVED');
+      if (!data.extraProperties || !data.extraProperties.preventWidgetMove) {
+        this.notifyEvent('WIDGET_MOVED');
+      }
     }
 
     if (data.eventType === 'PUBLISH_CHANGES') {
@@ -992,8 +1007,10 @@
   }
 });
 
-
-isc.defineClass('OBMyOpenbravoImplementation', isc.OBMyOpenbravo);
+isc.defineClass('OBMyOpenbravoImplementation', isc.OBMyOpenbravo).addProperties({
+  enableAdminMode: OB.OBMyOpenbravoProperties.enableAdminMode,
+  adminModeValueMap: OB.OBMyOpenbravoProperties.adminModeValueMap
+});
 
 isc.defineClass('OBMyOBDialog', isc.Window).addProperties({
   width: '100%',
@@ -1110,6 +1127,7 @@
         titleSuffix: '',
         requiredTitleSuffix: '',
         type: 'select',
+        sortField: 'widget',
         valueMap: {},
         changed: function (form, item, value) {
           if (value) {
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/test/ob-myopenbravo-test.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/test/ob-myopenbravo-test.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,7 +29,19 @@
 };
 
 OB.MyOB = OB.MyOB || {};
-OB.MyOB.widgets = OB.MyOB.widgets || {};
+
+function reloadWidgetsBeforeTest(callback) {
+  var post = isc.addProperties({}, d, {
+    'eventType': 'RELOAD_WIDGETS',
+    'widgets': []
+  });
+  OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
+
+    OB.MyOB.widgets = data && data.widgets;
+
+    callback(data);
+  });
+}
 
 function checkMissingDbInstanceId(w) {
   var i, widgets = w || OB.MyOB.widgets;
@@ -42,28 +54,27 @@
 }
 
 QUnit.asyncTest('Add widget', function () {
+  QUnit.expect(2);
+  reloadWidgetsBeforeTest(function (data) {
+    var post = isc.addProperties({}, d, {
+      'eventType': 'WIDGET_ADDED',
+      'widgets': OB.MyOB.widgets
+    }),
+        widget = isc.addProperties({}, OB.MyOB.widgets[0]);
 
-  var post = isc.addProperties({}, d, {
-    'eventType': 'WIDGET_ADDED',
-    'widgets': OB.MyOB.widgets
-  }),
-      widget = isc.addProperties({}, OB.MyOB.widgets[0]);
+    widget.rowNum += 1;
+    widget.dbInstanceId = '';
 
-  QUnit.expect(2);
+    OB.MyOB.widgets.push(widget);
+    OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
 
-  widget.rowNum += 1;
-  widget.dbInstanceId = '';
+      QUnit.strictEqual(data.message.type, 'Success', 'Widget added');
 
-  OB.MyOB.widgets.push(widget);
+      OB.MyOB.widgets = data && data.widgets ? eval(data.widgets) : OB.MyOB.widgets; // refreshing widgets
+      QUnit.ok(!checkMissingDbInstanceId(), 'All widgets have a dbInstanceId');
 
-  OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
-
-    QUnit.strictEqual(data.message.type, 'Success', 'Widget added');
-
-    OB.MyOB.widgets = data && data.widgets ? eval(data.widgets) : OB.MyOB.widgets; // refreshing widgets
-    QUnit.ok(!checkMissingDbInstanceId(), 'All widgets have a dbInstanceId');
-
-    QUnit.start(); // restart the flow
+      QUnit.start(); // restart the flow
+    });
   });
 });
 
@@ -112,41 +123,31 @@
 });
 
 QUnit.asyncTest('Remove widget', function () {
+  QUnit.expect(2);
+  reloadWidgetsBeforeTest(function (data) {
+    var post = isc.addProperties({}, d, {
+      'eventType': 'WIDGET_REMOVED',
+      'widgets': OB.MyOB.widgets
+    }),
+        removed = OB.MyOB.widgets.splice(-1, 1);
+    OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
 
-  var post = isc.addProperties({}, d, {
-    'eventType': 'WIDGET_REMOVED',
-    'widgets': OB.MyOB.widgets
-  }),
-      removed = OB.MyOB.widgets.splice(-1, 1);
+      QUnit.strictEqual(data.message.type, 'Success', 'Widget removed');
 
-  QUnit.expect(2);
+      OB.MyOB.widgets = data && data.widgets ? eval(data.widgets) : OB.MyOB.widgets; // refreshing widgets
+      QUnit.ok(!checkMissingDbInstanceId(), 'All widgets have a dbInstanceId');
 
-  OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
-
-    QUnit.strictEqual(data.message.type, 'Success', 'Widget removed');
-
-    OB.MyOB.widgets = data && data.widgets ? eval(data.widgets) : OB.MyOB.widgets; // refreshing widgets
-    QUnit.ok(!checkMissingDbInstanceId(), 'All widgets have a dbInstanceId');
-
-    QUnit.start(); // restart the flow
+      QUnit.start(); // restart the flow
+    });
   });
 });
 
 QUnit.asyncTest('Get user widgets', function () {
-
-  var post = isc.addProperties({}, d, {
-    'eventType': 'RELOAD_WIDGETS',
-    'widgets': []
-  });
-
   QUnit.expect(2);
-
-  OB.RemoteCallManager.call('org.openbravo.client.myob.MyOpenbravoActionHandler', post, {}, function (rpcResponse, data, rpcRequest) {
+  reloadWidgetsBeforeTest(function (data) {
 
     QUnit.strictEqual(data.message.type, 'Success', 'Widgets reloaded');
 
-    OB.MyOB = OB.MyOB || {};
-    OB.MyOB.widgets = data && data.widgets; // refreshing widgets
     QUnit.ok(!checkMissingDbInstanceId(), 'All widgets have a dbInstanceId');
 
     QUnit.start(); // restart the flow
--- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <NAME><![CDATA[Query/List Widget]]></NAME>
-<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION><![CDATA[1.0.31811]]></VERSION>
+<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION><![CDATA[1.0.32382]]></VERSION>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <DESCRIPTION><![CDATA[Provides the Query/List superclass widget that allows to create widget classes that prints a grid of data based on a query.]]></DESCRIPTION>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <HELP><![CDATA[With this module you can define your own widget classes that just with simple Application Dictionary shows a grid of data based on a HQL Query.]]></HELP>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <URL><![CDATA[http://forge.openbravo.com/projects/querylistwidget]]></URL>
@@ -21,7 +21,7 @@
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--0A060B2AF1974E8EAA8DB61388E9AECC--></AD_MODULE>
--- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--26558497C31140BFAB067BA4BC47D799-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--26558497C31140BFAB067BA4BC47D799-->  <AD_MODULE_ID><![CDATA[0A060B2AF1974E8EAA8DB61388E9AECC]]></AD_MODULE_ID>
 <!--26558497C31140BFAB067BA4BC47D799-->  <AD_DEPENDENT_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_DEPENDENT_MODULE_ID>
-<!--26558497C31140BFAB067BA4BC47D799-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--26558497C31140BFAB067BA4BC47D799-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--26558497C31140BFAB067BA4BC47D799-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--26558497C31140BFAB067BA4BC47D799-->  <DEPENDANT_MODULE_NAME><![CDATA[My Openbravo Tab]]></DEPENDANT_MODULE_NAME>
 <!--26558497C31140BFAB067BA4BC47D799-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.querylist/web/org.openbravo.client.querylist/js/ob-querylist-widget.js	Thu Sep 14 12:03:42 2017 +0000
@@ -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-2015 Openbravo SLU
+ * All portions are Copyright (C) 2010-2017 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -74,7 +74,9 @@
 
   setDbInstanceId: function (instanceId) {
     this.Super('setDbInstanceId', instanceId);
-    this.grid.fetchData();
+    if (this.allRequiredParametersSet()) {
+      this.grid.fetchData();
+    }
   },
 
   setWidgetHeight: function () {
@@ -139,7 +141,7 @@
     }
     // sometimes when removing the form, this gets called
     // at that point this.grid is not set anymore
-    if (this.grid) {
+    if (this.grid && this.allRequiredParametersSet()) {
       this.grid.invalidateCache();
       this.grid.filterData();
     }
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--FF8080812D842086012D844F3CC0003E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--FF8080812D842086012D844F3CC0003E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080812D842086012D844F3CC0003E-->  <NAME><![CDATA[Widgets Collection]]></NAME>
-<!--FF8080812D842086012D844F3CC0003E-->  <VERSION><![CDATA[0.0.31811]]></VERSION>
+<!--FF8080812D842086012D844F3CC0003E-->  <VERSION><![CDATA[0.0.32382]]></VERSION>
 <!--FF8080812D842086012D844F3CC0003E-->  <DESCRIPTION><![CDATA[Collection of Workspace Widgets]]></DESCRIPTION>
 <!--FF8080812D842086012D844F3CC0003E-->  <HELP><![CDATA[Collection of Workspace Widgets]]></HELP>
 <!--FF8080812D842086012D844F3CC0003E-->  <URL><![CDATA[http://forge.openbravo.com/projects/widgetscollection]]></URL>
@@ -22,7 +22,7 @@
 <!--FF8080812D842086012D844F3CC0003E-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--FF8080812D842086012D844F3CC0003E-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--FF8080812D842086012D844F3CC0003E-->  <UPDATEINFO><![CDATA[Added Currency Converter. Added Google Docs]]></UPDATEINFO>
-<!--FF8080812D842086012D844F3CC0003E-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--FF8080812D842086012D844F3CC0003E-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--FF8080812D842086012D844F3CC0003E-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--FF8080812D842086012D844F3CC0003E-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--FF8080812D842086012D844F3CC0003E--></AD_MODULE>
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--FF8080812D842086012D845002070046-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080812D842086012D845002070046-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
 <!--FF8080812D842086012D845002070046-->  <AD_DEPENDENT_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_DEPENDENT_MODULE_ID>
-<!--FF8080812D842086012D845002070046-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--FF8080812D842086012D845002070046-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--FF8080812D842086012D845002070046-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--FF8080812D842086012D845002070046-->  <DEPENDANT_MODULE_NAME><![CDATA[Workspace & Widgets]]></DEPENDANT_MODULE_NAME>
 <!--FF8080812D842086012D845002070046-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <NAME><![CDATA[Payment Report]]></NAME>
-<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION><![CDATA[3.0.31811]]></VERSION>
+<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION><![CDATA[3.0.32382]]></VERSION>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <DESCRIPTION><![CDATA[Payment Report]]></DESCRIPTION>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <URL><![CDATA[http://forge.openbravo.com/projects/paymentreport]]></URL>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <TYPE><![CDATA[M]]></TYPE>
@@ -22,7 +22,7 @@
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--2A5EE903D7974AC298C0504FBC4501A7-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--2A5EE903D7974AC298C0504FBC4501A7--></AD_MODULE>
--- a/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <AD_DEPENDENT_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_DEPENDENT_MODULE_ID>
-<!--A3B449C4D5FE4D688CC58236FE33B802-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--A3B449C4D5FE4D688CC58236FE33B802-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <DEPENDANT_MODULE_NAME><![CDATA[Advanced Payables and Receivables Mngmt]]></DEPENDANT_MODULE_NAME>
 <!--A3B449C4D5FE4D688CC58236FE33B802-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_PREFERENCE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_PREFERENCE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -11,15 +11,4 @@
 <!--9B4A5EB695FFA841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
 <!--9B4A5EB695FFA841E040A8C0E1077381--></AD_PREFERENCE>
 
-<!--9B4A5EB6975EA841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB6975EA841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcess6AD04479EC134BD4826077F36B709876]]></ATTRIBUTE>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB6975EA841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[2A5EE903D7974AC298C0504FBC4501A7]]></AD_MODULE_ID>
-<!--9B4A5EB6975EA841E040A8C0E1077381--></AD_PREFERENCE>
-
 </data>
--- a/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.financial.paymentreport/src/org/openbravo/financial/paymentreport/erpCommon/ad_reports/PaymentReportDao.java	Thu Sep 14 12:03:42 2017 +0000
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SL 
- * All portions are Copyright (C) 2009-2016 Openbravo SL 
+ * All portions are Copyright (C) 2009-2017 Openbravo SL 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -298,12 +298,14 @@
       } else if (StringUtils.isNotEmpty(strFinancialAccountId)) {
         hsqlScript.append(" left join inv.businessPartner as invbp");
       }
-      hsqlScript.append(" where (fpd is not null or invps is not null)");
-      hsqlScript.append(" and fpsd.organization.id in ");
-      hsqlScript.append(concatOrganizations(OBContext.getOBContext().getReadableOrganizations()));
+      hsqlScript
+          .append(" where (fpsd.paymentDetails is not null or fpsd.invoicePaymentSchedule is not null)");
 
       // organization + include sub-organization
-      if (!strOrg.isEmpty()) {
+      if (StringUtils.isEmpty(strOrg) || StringUtils.equals(strOrg, "0")) {
+        hsqlScript.append(" and fpsd.organization.id in ");
+        hsqlScript.append(concatOrganizations(OBContext.getOBContext().getReadableOrganizations()));
+      } else {
         if (!strInclSubOrg.equalsIgnoreCase("include")) {
           hsqlScript.append(" and fpsd.");
           hsqlScript.append(FIN_PaymentScheduleDetail.PROPERTY_ORGANIZATION);
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--3A3A943684D64DEF9EC39F588A656848-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <NAME><![CDATA[Orders Awaiting Delivery]]></NAME>
-<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION><![CDATA[1.1.31811]]></VERSION>
+<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION><![CDATA[1.1.32382]]></VERSION>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <DESCRIPTION><![CDATA[Report displaying sales orders not shipped.]]></DESCRIPTION>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <URL><![CDATA[http://forge.openbravo.com/projects/ordersawaitingdlivery]]></URL>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <TYPE><![CDATA[M]]></TYPE>
@@ -19,7 +19,7 @@
 <!--3A3A943684D64DEF9EC39F588A656848-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--3A3A943684D64DEF9EC39F588A656848-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--3A3A943684D64DEF9EC39F588A656848--></AD_MODULE>
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <AD_MODULE_ID><![CDATA[3A3A943684D64DEF9EC39F588A656848]]></AD_MODULE_ID>
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_PREFERENCE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_PREFERENCE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -11,15 +11,4 @@
 <!--9B4A5EB69600A841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[3A3A943684D64DEF9EC39F588A656848]]></AD_MODULE_ID>
 <!--9B4A5EB69600A841E040A8C0E1077381--></AD_PREFERENCE>
 
-<!--9B4A5EB6975FA841E040A8C0E1077381--><AD_PREFERENCE>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <AD_PREFERENCE_ID><![CDATA[9B4A5EB6975FA841E040A8C0E1077381]]></AD_PREFERENCE_ID>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <ATTRIBUTE><![CDATA[ModalProcess3DAA5E63A30D45A8ABF87701F8BD91EF]]></ATTRIBUTE>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <VALUE><![CDATA[N]]></VALUE>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
-<!--9B4A5EB6975FA841E040A8C0E1077381-->  <AD_MODULE_ID><![CDATA[3A3A943684D64DEF9EC39F588A656848]]></AD_MODULE_ID>
-<!--9B4A5EB6975FA841E040A8C0E1077381--></AD_PREFERENCE>
-
 </data>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <NAME><![CDATA[JSON Datasource]]></NAME>
-<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION><![CDATA[2.1.31811]]></VERSION>
+<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION><![CDATA[2.1.32382]]></VERSION>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <DESCRIPTION><![CDATA[Provides data source CRUD functionality using JSON as the data format]]></DESCRIPTION>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <HELP><![CDATA[This module implements the datasource concept. Datasources play a central role in Smartclient applications. The datasource module automatically creates a datasource for each Openbravo entity. In addition custom data source implementations can be defined.]]></HELP>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <URL><![CDATA[http://forge.openbravo.com/projects/datasourceservice]]></URL>
@@ -22,7 +22,7 @@
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <UPDATEINFO><![CDATA[Bug fixing & new development for 3.0]]></UPDATEINFO>
-<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4--></AD_MODULE>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <AD_DEPENDENT_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_DEPENDENT_MODULE_ID>
-<!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <STARTVERSION><![CDATA[1.1.31811]]></STARTVERSION>
+<!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <STARTVERSION><![CDATA[1.1.32382]]></STARTVERSION>
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <DEPENDANT_MODULE_NAME><![CDATA[JBoss Weld]]></DEPENDANT_MODULE_NAME>
 <!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <AD_DEPENDENT_MODULE_ID><![CDATA[F8D1B3ECB3474E8DA5C216473C840DF1]]></AD_DEPENDENT_MODULE_ID>
-<!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <STARTVERSION><![CDATA[2.0.31811]]></STARTVERSION>
+<!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <STARTVERSION><![CDATA[2.0.32382]]></STARTVERSION>
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <DEPENDANT_MODULE_NAME><![CDATA[JSON REST Webservice]]></DEPENDANT_MODULE_NAME>
 <!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--4FCE95802A854F7E8623AFF7C33D13EE-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--4FCE95802A854F7E8623AFF7C33D13EE-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--4FCE95802A854F7E8623AFF7C33D13EE-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -49,7 +49,7 @@
 <!--54AF8B39C55E4E7496902893ECD82786-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--54AF8B39C55E4E7496902893ECD82786-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--54AF8B39C55E4E7496902893ECD82786-->  <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID>
-<!--54AF8B39C55E4E7496902893ECD82786-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--54AF8B39C55E4E7496902893ECD82786-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--54AF8B39C55E4E7496902893ECD82786-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--54AF8B39C55E4E7496902893ECD82786-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME>
 <!--54AF8B39C55E4E7496902893ECD82786-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -63,7 +63,7 @@
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <AD_DEPENDENT_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_DEPENDENT_MODULE_ID>
-<!--D03C56D8A4E14F45A5466350E05C631F-->  <STARTVERSION><![CDATA[8.1.31811]]></STARTVERSION>
+<!--D03C56D8A4E14F45A5466350E05C631F-->  <STARTVERSION><![CDATA[8.1.32382]]></STARTVERSION>
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <DEPENDANT_MODULE_NAME><![CDATA[Smartclient]]></DEPENDANT_MODULE_NAME>
 <!--D03C56D8A4E14F45A5466350E05C631F-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/TreeDatasourceService.java	Thu Sep 14 12:03:42 2017 +0000
@@ -660,7 +660,7 @@
               savedNode.put("isOpen", true);
             }
           }
-          // We have to make sure that the filtered node was not aboute the
+          // We have to make sure that the filtered node was not about the
           // root nodes as defined by the hqlTreeWhereClauseRootNodes
           if (this.nodeConformsToWhereClause(tableTree, node.getString("id"),
               hqlTreeWhereClauseRootNodes)) {
--- a/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--FF8080813129ADA401312CA1222A0005-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--FF8080813129ADA401312CA1222A0005-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080813129ADA401312CA1222A0005-->  <NAME><![CDATA[Integration with Google APIs]]></NAME>
-<!--FF8080813129ADA401312CA1222A0005-->  <VERSION><![CDATA[0.1.31811]]></VERSION>
+<!--FF8080813129ADA401312CA1222A0005-->  <VERSION><![CDATA[0.1.32382]]></VERSION>
 <!--FF8080813129ADA401312CA1222A0005-->  <DESCRIPTION><![CDATA[Integration with Google APIs]]></DESCRIPTION>
 <!--FF8080813129ADA401312CA1222A0005-->  <TYPE><![CDATA[M]]></TYPE>
 <!--FF8080813129ADA401312CA1222A0005-->  <LICENSE><![CDATA[Licensed under the Openbravo Public License Version 1.1.
@@ -19,7 +19,7 @@
 <!--FF8080813129ADA401312CA1222A0005-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--FF8080813129ADA401312CA1222A0005-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--FF8080813129ADA401312CA1222A0005-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--FF8080813129ADA401312CA1222A0005-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--FF8080813129ADA401312CA1222A0005-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--FF8080813129ADA401312CA1222A0005-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--FF8080813129ADA401312CA1222A0005-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--FF8080813129ADA401312CA1222A0005--></AD_MODULE>
--- a/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--FF8080813141B198013141BA0F7D0012-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080813141B198013141BA0F7D0012-->  <AD_MODULE_ID><![CDATA[FF8080813129ADA401312CA1222A0005]]></AD_MODULE_ID>
 <!--FF8080813141B198013141BA0F7D0012-->  <AD_DEPENDENT_MODULE_ID><![CDATA[FF8080813141B198013141B86DD70003]]></AD_DEPENDENT_MODULE_ID>
-<!--FF8080813141B198013141BA0F7D0012-->  <STARTVERSION><![CDATA[0.1.31811]]></STARTVERSION>
+<!--FF8080813141B198013141BA0F7D0012-->  <STARTVERSION><![CDATA[0.1.32382]]></STARTVERSION>
 <!--FF8080813141B198013141BA0F7D0012-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--FF8080813141B198013141BA0F7D0012-->  <DEPENDANT_MODULE_NAME><![CDATA[OpenID Service Integration]]></DEPENDANT_MODULE_NAME>
 <!--FF8080813141B198013141BA0F7D0012-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--FF8080813151AEE1013151C4ACE6001B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080813151AEE1013151C4ACE6001B-->  <AD_MODULE_ID><![CDATA[FF8080813129ADA401312CA1222A0005]]></AD_MODULE_ID>
 <!--FF8080813151AEE1013151C4ACE6001B-->  <AD_DEPENDENT_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_DEPENDENT_MODULE_ID>
-<!--FF8080813151AEE1013151C4ACE6001B-->  <STARTVERSION><![CDATA[2.1.31811]]></STARTVERSION>
+<!--FF8080813151AEE1013151C4ACE6001B-->  <STARTVERSION><![CDATA[2.1.32382]]></STARTVERSION>
 <!--FF8080813151AEE1013151C4ACE6001B-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--FF8080813151AEE1013151C4ACE6001B-->  <DEPENDANT_MODULE_NAME><![CDATA[Openbravo 3.0 Framework]]></DEPENDANT_MODULE_NAME>
 <!--FF8080813151AEE1013151C4ACE6001B-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--FF8080813141B198013141B86DD70003-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--FF8080813141B198013141B86DD70003-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080813141B198013141B86DD70003-->  <NAME><![CDATA[OpenID Service Integration]]></NAME>
-<!--FF8080813141B198013141B86DD70003-->  <VERSION><![CDATA[0.1.31811]]></VERSION>
+<!--FF8080813141B198013141B86DD70003-->  <VERSION><![CDATA[0.1.32382]]></VERSION>
 <!--FF8080813141B198013141B86DD70003-->  <DESCRIPTION><![CDATA[OpenID Service Integration]]></DESCRIPTION>
 <!--FF8080813141B198013141B86DD70003-->  <TYPE><![CDATA[M]]></TYPE>
 <!--FF8080813141B198013141B86DD70003-->  <LICENSE><![CDATA[Licensed under the Openbravo Public License Version 1.1.
@@ -19,7 +19,7 @@
 <!--FF8080813141B198013141B86DD70003-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--FF8080813141B198013141B86DD70003-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--FF8080813141B198013141B86DD70003-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--FF8080813141B198013141B86DD70003-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--FF8080813141B198013141B86DD70003-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--FF8080813141B198013141B86DD70003-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--FF8080813141B198013141B86DD70003-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--FF8080813141B198013141B86DD70003--></AD_MODULE>
--- a/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--FF8080813141B198013141B8B21B0006-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--FF8080813141B198013141B8B21B0006-->  <AD_MODULE_ID><![CDATA[FF8080813141B198013141B86DD70003]]></AD_MODULE_ID>
 <!--FF8080813141B198013141B8B21B0006-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--FF8080813141B198013141B8B21B0006-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--FF8080813141B198013141B8B21B0006-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--FF8080813141B198013141B8B21B0006-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--FF8080813141B198013141B8B21B0006-->  <DEPENDANT_MODULE_NAME><![CDATA[Core]]></DEPENDANT_MODULE_NAME>
 <!--FF8080813141B198013141B8B21B0006-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -6,7 +6,7 @@
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <NAME><![CDATA[JSON REST Webservice]]></NAME>
-<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION><![CDATA[2.0.31811]]></VERSION>
+<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION><![CDATA[2.0.32382]]></VERSION>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <DESCRIPTION><![CDATA[Provides a JSON REST webservice for CRUD service requests]]></DESCRIPTION>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <HELP><![CDATA[Provides a JSON REST webservice for CRUD service requests. Both the servlet implementation (receiving HTTP REST requests in JSON) as the backend processing are provided.]]></HELP>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <URL><![CDATA[http://forge.openbravo.com/projects/openbravojsonrest]]></URL>
@@ -22,7 +22,7 @@
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <UPDATEINFO><![CDATA[Bug fixing & new development for 3.0]]></UPDATEINFO>
-<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION_LABEL><![CDATA[PR17Q2.3]]></VERSION_LABEL>
+<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--F8D1B3ECB3474E8DA5C216473C840DF1--></AD_MODULE>
--- a/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Sep 14 12:03:42 2017 +0000
@@ -7,7 +7,7 @@
 <!--9E3E7B42DB16405FB794496D309D7044-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--9E3E7B42DB16405FB794496D309D7044-->  <AD_MODULE_ID><![CDATA[F8D1B3ECB3474E8DA5C216473C840DF1]]></AD_MODULE_ID>
 <!--9E3E7B42DB16405FB794496D309D7044-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--9E3E7B42DB16405FB794496D309D7044-->  <STARTVERSION><![CDATA[3.0.31811]]></STARTVERSION>
+<!--9E3E7B42DB16405FB794496D309D7044-->  <STARTVERSION><![CDATA[3.0.32382]]></STARTVERSION>
 <!--9E3E7B42DB16405FB794496D309D7044-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--9E3E7B42DB16405FB794496D309D7044-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--9E3E7B42DB16405FB794496D309D7044-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Thu Sep 14 12:03:42 2017 +0000
@@ -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) 2009-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -214,8 +214,7 @@
         if (value == null) {
           jsonObject.put(replaceDots(additionalProperty), (Object) null);
         } else if (value instanceof BaseOBObject) {
-          final Property additonalPropertyObject = DalUtil.getPropertyFromPath(bob.getEntity(),
-              additionalProperty);
+          final Property additonalPropertyObject = getPropertyFromPath(bob, additionalProperty);
           addBaseOBObject(jsonObject, additonalPropertyObject, additionalProperty,
               additonalPropertyObject.getReferencedProperty(), (BaseOBObject) value);
         } else {
@@ -257,6 +256,34 @@
     return value.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR);
   }
 
+  private Property getPropertyFromPath(BaseOBObject bob, String propertyPath) {
+    final String[] parts = propertyPath.split("\\.");
+    BaseOBObject currentBob = bob;
+    Property result = null;
+    Object value = null;
+    for (String part : parts) {
+      // only consider it as an identifier if it is called an identifier and
+      // the entity does not accidentally have an identifier property
+      // && !currentEntity.hasProperty(part)
+      // NOTE disabled for now, there is one special case: AD_Column.IDENTIFIER
+      // which is NOT HANDLED
+      final Entity currentEntity = currentBob.getEntity();
+      if (!currentEntity.hasProperty(part)) {
+        return null;
+      }
+      result = currentEntity.getProperty(part);
+      value = currentBob.get(part);
+      // if there is a next step, just make it
+      // if it is last then we stop anyway
+      if (value instanceof BaseOBObject) {
+        currentBob = (BaseOBObject) value;
+      } else {
+        return currentEntity.getProperty(part);
+      }
+    }
+    return result;
+  }
+
   private void addBaseOBObject(JSONObject jsonObject, Property referencingProperty,
       String propertyName, Property referencedProperty, BaseOBObject obObject) throws JSONException {
     String identifier = null;
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Wed Sep 13 06:39:31 2017 +0000
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Thu Sep 14 12:03:42 2017 +0000
@@ -18,6 +18,8 @@
  */
 package org.openbravo.service.json;
 
+import static org.openbravo.userinterface.selector.SelectorConstants.includeOrgFilter;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -371,17 +373,21 @@
   }
 
   private boolean isLastRecordSelected(List<BaseOBObject> bobs) {
-    if (bobs.size() == 0) {
+    if (bobs.isEmpty()) {
       return false;
     }
-    Boolean b = Boolean.FALSE;
+
     try {
       BaseOBObject bob = bobs.get(bobs.size() - 1);
-      b = (Boolean) bob.get("obSelected");
+
+      if (!bob.getEntity().hasProperty("obSelected")) {
+        return false;
+      }
+      return (Boolean) bob.get("obSelected");
     } catch (Exception ex) {
       // Error retrieving obSelected property, do nothing: record not selected
+      return false;
     }
-    return b.booleanValue();
   }
 
   public void fetch(Map<String, String> parameters, QueryResultWriter writer) {
@@ -440,6 +446,7 @@
     final DataEntityQueryService queryService = OBProvider.getInstance().get(
         DataEntityQueryService.class);
 
+    boolean includeOrgFilter = includeOrgFilter(parameters);
     if (!forSubEntity && parameters.get(JsonConstants.DISTINCT_PARAMETER) != null) {
       // this is the main entity of a 'contains' (used in FK drop down lists), it will create also
       // info for subentity
@@ -556,7 +563,8 @@
       }
     } else {
       queryService.setEntityName(entityName);
-      queryService.setFilterOnReadableOrganizations(filterOnReadableOrganizations);
+      queryService.setFilterOnReadableOrganizations(filterOnReadableOrganizations
+          && includeOrgFilter);
       if (parameters.containsKey(JsonConstants.USE_ALIAS)) {
         queryService.setUseAlias();
       }
@@ -604,7 +612,7 @@
         if (key.equals(JsonConstants.IDENTIFIER)
             || key.equals(JsonConstants.WHERE_PARAMETER)
             || key.equals(JsonConstants.WHERE_AND_FILTER_CLAUSE)
-            || key.equals(JsonConstants.ORG_PARAMETER)
+            || (key.equals(JsonConstants.ORG_PARAMETER) && includeOrgFilter)
             || key.equals(JsonConstants.CALCULATE_ORGS)
             || key.equals(JsonConstants.TARGETRECORDID_PARAMETER)
             || (key.startsWith(DataEntityQueryService.PARAM_DELIMITER) && key
@@ -612,7 +620,6 @@
             || (key.equals(SelectorConstants.DS_REQUEST_SELECTOR_ID_PARAMETER))) {
           queryService.addFilter