Merged with pi MP24
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Thu, 27 Jun 2013 10:02:33 +0200
changeset 20947 e7d4140659d1
parent 20946 124db58c30d1 (current diff)
parent 20608 692d465ddec5 (diff)
child 20948 4dae42f37291
Merged with pi MP24
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js
modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js
src-db/database/model/functions/C_INVOICE_POST.xml
src-db/database/model/functions/C_ORDER_POST1.xml
src-db/database/model/functions/M_INOUT_POST.xml
src-db/database/model/functions/M_PRODUCTION_RUN.xml
src-db/database/model/triggers/M_PRODUCT_TRG.xml
src-db/database/model/views/M_PRODUCT_PRICE_WAREHOUSE_V.xml
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
src-db/database/sourcedata/AD_CALLOUT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MENU.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml
src-db/database/sourcedata/AD_PROCESS.xml
src-db/database/sourcedata/AD_REFERENCE.xml
src-db/database/sourcedata/AD_REF_LIST.xml
src-db/database/sourcedata/AD_REF_TABLE.xml
src-db/database/sourcedata/AD_TAB.xml
src-db/database/sourcedata/AD_TABLE.xml
src-db/database/sourcedata/AD_VAL_RULE.xml
src-db/database/sourcedata/OBUISEL_SELECTOR.xml
src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml
src/org/openbravo/erpCommon/businessUtility/InitialClientSetup.java
web/js/jscalendar/lang/calendar-al.js
--- a/.hgsigs	Wed Jun 26 17:09:49 2013 +0200
+++ b/.hgsigs	Thu Jun 27 10:02:33 2013 +0200
@@ -106,3 +106,9 @@
 cd9fe4727ba89b6fc108d9e7e48cc222c24016e4 0 iEYEABECAAYFAlEkZrgACgkQCX/oGf+2qkNMEgCfVeNFe/nvgxNXwEUvbbIp6tqdAJ0AoK+83WD/fS6bRKK2xEgc5gwYlFJP
 2eb40756a1ed20c690c9158cd84aa62ea34ac339 0 iEYEABECAAYFAlEjW+AACgkQCX/oGf+2qkNupQCgz0W/xoRPzBsfhdSFgcD+vJy9aPAAoNfJeFhJ+psPdkmsZmz8fYvRg8DT
 1983af93019a75c0f0b130181b3ed8bb7d83bd8c 0 iEYEABECAAYFAlE42u0ACgkQCX/oGf+2qkNZQgCeKbV0dJ/m8Mcri1w7Xw3bB2dzAU0An02XW44EzaErkug0oKK6bkYmDmRA
+2f9499693ed7c3ddec2c3ba8857c23fed83a7312 0 iEYEABECAAYFAlGTRMwACgkQCX/oGf+2qkNSggCeKaVwdDklBr+nNouJLIQmEY0veVMAoNLfU94cIPAUBl8L2+auknM1IuUx
+d7e04c9b010fd0b52464f9b846278b415ff066cc 0 iEYEABECAAYFAlFrxIQACgkQCX/oGf+2qkPu7ACgofS8PV7CLsmpDNO8nNMkrs++JIcAoL69XxrlYHRfCM6aue8q5srbLm/R
+bea15e1decb29501b4124110009787f2dca70cf9 0 iEYEABECAAYFAlFue8kACgkQCX/oGf+2qkMvfACgjbPubrgVAbVnotRRgGAgQancNqsAoMRke06L5J+RtPYdeU3wRSx2YNqt
+dc219eb12d7e3a434b4d3151a93597d5292f2c06 0 iEYEABECAAYFAlGCVCkACgkQCX/oGf+2qkPi6gCeJKtfZ58WQOqlRHoY0X3K+6yxpwcAoJr+iFJrxNhzylyJuAiZx1Ewsdti
+d6967f5f10c642017a6e2be5206cb4d44926cdc5 0 iEYEABECAAYFAlGbmiwACgkQCX/oGf+2qkMWbACgpTdvV7HBnS+rgaGKicLXOxWY3oMAniRBr+lgXOABzgOP4QsT6Yhww83h
+7c487ba0b222d5d9540b24223a71e62efaab1449 0 iEYEABECAAYFAlGaRDIACgkQCX/oGf+2qkMc2wCdFY+72j0R/gz/WVnIwnnPxJH1ljQAoJqjDgZUoszxKo/Gk567MXvsppVN
--- a/.hgtags	Wed Jun 26 17:09:49 2013 +0200
+++ b/.hgtags	Thu Jun 27 10:02:33 2013 +0200
@@ -117,3 +117,9 @@
 42352a2a7b5be48801784583817c082e2ec11af2 3.0MP19.4
 60f345bac02b65b2e09ad4e540c70875197ce76f 3.0MP20
 79ef7f4b625d71d1c8a6520648e528f9a722ab60 3.0MP21
+6a7b86469daac4468fd0897a233fbc401a34e1ab 3.0MP21.1
+383173cf8e316d135eb0d216ab091602955b1daf 3.0MP22
+ce76fa45acc0de59a2743e001aa3e00764b9b7b1 3.0MP22.1
+56826f5230e456121cf043d90513707beaf6b473 3.0MP22.2
+32eb242529bb23a5397ef58aab85d9e42965f08e 3.0MP22.3
+93ebf694603919f347a7bdbb5388045094da2492 3.0MP23
--- a/config/log4j.lcf.template	Wed Jun 26 17:09:49 2013 +0200
+++ b/config/log4j.lcf.template	Thu Jun 27 10:02:33 2013 +0200
@@ -10,7 +10,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) 2007-2009 Openbravo SLU
+# * All portions are Copyright (C) 2007-2013 Openbravo SLU
 # * All Rights Reserved. 
 # * Contributor(s):  ______________________________________.
 # ************************************************************************
--- a/lib/README	Wed Jun 26 17:09:49 2013 +0200
+++ b/lib/README	Thu Jun 27 10:02:33 2013 +0200
@@ -1,3 +1,3 @@
 When adding or removing libraries to Openbravo ERP please update this page
-with your changes:
+with your changes: 
 http://wiki.openbravo.com/wiki/Openbravo_Libraries
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/views/APRM_FINACC_TRANSACTION_V.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/views/APRM_FINACC_TRANSACTION_V.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW APRM_FINACC_TRANSACTION_V">
-    <view name="APRM_FINACC_TRANSACTION_V"><![CDATA[SELECT trx.fin_finacc_transaction_id AS aprm_finacc_transaction_v_id, trx.fin_finacc_transaction_id, trx.ad_client_id, trx.ad_org_id, trx.isactive, trx.created, trx.createdby, trx.updated, trx.updatedby, trx.fin_financial_account_id, trx.line, trx.description, trx.statementdate, trx.trxtype, trx.fin_payment_id, trx.c_glitem_id, trx.depositamt, trx.paymentamt, trx.c_currency_id, trx.fin_reconciliation_id, trx.status, trx.createdbyalgorithm, trx.posted, trx.dateacct, trx.processed, trx.processing, trx.user1_id, trx.user2_id, trx.c_activity_id, trx.c_campaign_id, trx.c_project_id, trx.foreign_currency_id, trx.foreign_amount, trx.em_aprm_modify, trx.foreign_convert_rate,  CASE trx.status WHEN 'RPPC' THEN 'Y' ELSE 'N' END AS cleared, COALESCE(trx.c_bpartner_id, p.c_bpartner_id) AS c_bpartner_id, trx.m_product_id, trx.c_salesregion_id, p.documentno AS paymentdocno, COALESCE(r.processed, 'N') AS reconciled, 'N' AS delete_btn, (SELECT ad_table.ad_table_id FROM ad_table WHERE lower(ad_table.tablename) = 'fin_finacc_transaction') AS forced_table_id, trx.c_costcenter_id FROM fin_finacc_transaction trx LEFT JOIN fin_payment p ON trx.fin_payment_id = p.fin_payment_id LEFT JOIN fin_reconciliation r ON trx.fin_reconciliation_id = r.fin_reconciliation_id]]></view>
+    <view name="APRM_FINACC_TRANSACTION_V"><![CDATA[SELECT trx.fin_finacc_transaction_id AS aprm_finacc_transaction_v_id, trx.fin_finacc_transaction_id, trx.ad_client_id, trx.ad_org_id, trx.isactive, trx.created, trx.createdby, trx.updated, trx.updatedby, trx.fin_financial_account_id, trx.line, trx.description, trx.statementdate, trx.trxtype, trx.fin_payment_id, trx.c_glitem_id, trx.depositamt, trx.paymentamt, trx.c_currency_id, trx.fin_reconciliation_id, trx.status, trx.createdbyalgorithm, trx.posted, trx.dateacct, trx.processed, trx.processing, trx.user1_id, trx.user2_id, trx.c_activity_id, trx.c_campaign_id, trx.c_project_id, trx.foreign_currency_id, trx.foreign_amount, trx.em_aprm_modify, trx.foreign_convert_rate,  CASE trx.status WHEN 'RPPC' THEN 'Y' ELSE 'N' END AS cleared, COALESCE(trx.c_bpartner_id, p.c_bpartner_id) AS c_bpartner_id, trx.m_product_id, trx.c_salesregion_id, p.documentno AS paymentdocno, COALESCE(r.processed, 'N') AS reconciled, to_char('N') AS delete_btn, (SELECT ad_table.ad_table_id FROM ad_table WHERE lower(ad_table.tablename) = 'fin_finacc_transaction') AS forced_table_id, trx.c_costcenter_id FROM fin_finacc_transaction trx LEFT JOIN fin_payment p ON trx.fin_payment_id = p.fin_payment_id LEFT JOIN fin_reconciliation r ON trx.fin_reconciliation_id = r.fin_reconciliation_id]]></view>
   </database>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -446,7 +446,7 @@
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <NAME><![CDATA[Fin_Financial_Account_ID]]></NAME>
+<!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <NAME><![CDATA[Financial Account]]></NAME>
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <DESCRIPTION><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></DESCRIPTION>
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <HELP><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></HELP>
 <!--07EC2EF3577B4AAC84EBABCC8DA7C292-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
@@ -7878,7 +7878,7 @@
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <AD_COLUMN_ID><![CDATA[7DC34559B3F2B45BE040007F0100784A]]></AD_COLUMN_ID>
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--7DFD1BBEC2F60C48E040007F01004674-->  <DISPLAYLOGIC><![CDATA[@Processed@='Y' & @Status@!'RPVOID']]></DISPLAYLOGIC>
+<!--7DFD1BBEC2F60C48E040007F01004674-->  <DISPLAYLOGIC><![CDATA[@Processed@='Y' & @Status@!'RPVOID' & @FIN_Rev_Payment_ID@ = '']]></DISPLAYLOGIC>
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--7DFD1BBEC2F60C48E040007F01004674-->  <SEQNO><![CDATA[130]]></SEQNO>
@@ -12457,7 +12457,7 @@
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <NAME><![CDATA[LastPaymentDate]]></NAME>
+<!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <NAME><![CDATA[Last Payment Date]]></NAME>
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <AD_TAB_ID><![CDATA[7A8D43541F8C49F1BD8A431A0041BF89]]></AD_TAB_ID>
 <!--A135CD50436C4E97808E6F7ABAC1E1E8-->  <AD_COLUMN_ID><![CDATA[AECA45F025F14E6DBA669E12DDA55D17]]></AD_COLUMN_ID>
@@ -20048,7 +20048,7 @@
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <AD_FIELD_ID><![CDATA[FE93D5F98B2A4BD8AD6F2467E6A06E47]]></AD_FIELD_ID>
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <ISACTIVE><![CDATA[N]]></ISACTIVE>
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <NAME><![CDATA[Modify]]></NAME>
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <DESCRIPTION><![CDATA[Process to modify transactions GL Item type once they have been created]]></DESCRIPTION>
 <!--FE93D5F98B2A4BD8AD6F2467E6A06E47-->  <HELP><![CDATA[Process to modify transactions GL Item type once they have been created]]></HELP>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -294,7 +294,7 @@
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <VALUE><![CDATA[APRM_PeriodNotAvailableClearedItem]]></VALUE>
-<!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <MSGTEXT><![CDATA[The period of the cleared item (%s) is not open or available.]]></MSGTEXT>
+<!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <MSGTEXT><![CDATA[The reconciliation cannot be completed because it contains one or more items in a closed period.<BR>The period of the cleared item (%s) is not open or available.]]></MSGTEXT>
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--48898A3B7F9141C0B9BFBDD9AE5FCF8F-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION><![CDATA[3.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--A918E3331C404B889D69AA9BFAFB23AC-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--89326AE95DAD449D85DFAB2C5B1C6683-->  <STARTVERSION><![CDATA[2.1.20523]]></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.20088]]></STARTVERSION>
+<!--B97FC854C6DD41E692161585645A900F-->  <STARTVERSION><![CDATA[3.0.20523]]></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_REFERENCE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -157,6 +157,18 @@
 <!--DB71FC312327430EAEACF42918405BF9-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--DB71FC312327430EAEACF42918405BF9--></AD_REFERENCE>
 
+<!--E1C0B1C7D7C84E85903409A39A53E855--><AD_REFERENCE>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <AD_REFERENCE_ID><![CDATA[E1C0B1C7D7C84E85903409A39A53E855]]></AD_REFERENCE_ID>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <NAME><![CDATA[FIN_Payment no combo]]></NAME>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <PARENTREFERENCE_ID><![CDATA[95E2A8B50A254B2AAE6774B8C2F28120]]></PARENTREFERENCE_ID>
+<!--E1C0B1C7D7C84E85903409A39A53E855-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--E1C0B1C7D7C84E85903409A39A53E855--></AD_REFERENCE>
+
 <!--E91B038ABF4F4A2280264C4A475852A4--><AD_REFERENCE>
 <!--E91B038ABF4F4A2280264C4A475852A4-->  <AD_REFERENCE_ID><![CDATA[E91B038ABF4F4A2280264C4A475852A4]]></AD_REFERENCE_ID>
 <!--E91B038ABF4F4A2280264C4A475852A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TAB.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TAB.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -55,7 +55,7 @@
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <UIPATTERN><![CDATA[SR]]></UIPATTERN>
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <HQLWHERECLAUSE><![CDATA[e.table.id = '30721072789F410E9606D2235CB2A226' and e.recordID = @FIN_Doubtful_Debt.id@]]></HQLWHERECLAUSE>
-<!--1EA4A3F31A27483A8C6E93176AE912D3-->  <HQLORDERBYCLAUSE><![CDATA[accountingSchema.name, accountingDate, debit desc, credit desc, value]]></HQLORDERBYCLAUSE>
+<!--1EA4A3F31A27483A8C6E93176AE912D3-->  <HQLORDERBYCLAUSE><![CDATA[accountingSchema.name, accountingDate, abs(debit) desc, credit desc, value]]></HQLORDERBYCLAUSE>
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <EM_OBUIAPP_CAN_ADD><![CDATA[N]]></EM_OBUIAPP_CAN_ADD>
 <!--1EA4A3F31A27483A8C6E93176AE912D3-->  <EM_OBUIAPP_CAN_DELETE><![CDATA[N]]></EM_OBUIAPP_CAN_DELETE>
@@ -85,7 +85,7 @@
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <UIPATTERN><![CDATA[RO]]></UIPATTERN>
-<!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <HQLORDERBYCLAUSE><![CDATA[-accountingDate,financialAccountTransaction,groupID,-sequenceNumber]]></HQLORDERBYCLAUSE>
+<!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <HQLORDERBYCLAUSE><![CDATA[accountingSchema.name, accountingDate, abs(debit) desc, credit desc, value]]></HQLORDERBYCLAUSE>
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <EM_OBUIAPP_CAN_ADD><![CDATA[N]]></EM_OBUIAPP_CAN_ADD>
 <!--2A9BA5FDA0F8470D881F8EA9DEDCC598-->  <EM_OBUIAPP_CAN_DELETE><![CDATA[N]]></EM_OBUIAPP_CAN_DELETE>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 <!--0DFF5BACFB964FDABAA5042C8809C813-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--0DFF5BACFB964FDABAA5042C8809C813-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--0DFF5BACFB964FDABAA5042C8809C813-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--0DFF5BACFB964FDABAA5042C8809C813-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--0DFF5BACFB964FDABAA5042C8809C813--></AD_TABLE>
 
 <!--1BAA61D216CB4A62838AA785658EE092--><AD_TABLE>
@@ -42,6 +43,7 @@
 <!--1BAA61D216CB4A62838AA785658EE092-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--1BAA61D216CB4A62838AA785658EE092-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--1BAA61D216CB4A62838AA785658EE092-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--1BAA61D216CB4A62838AA785658EE092-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--1BAA61D216CB4A62838AA785658EE092--></AD_TABLE>
 
 <!--5AAFAB80FB6740D2A6190CB3939D90EC--><AD_TABLE>
@@ -63,6 +65,7 @@
 <!--5AAFAB80FB6740D2A6190CB3939D90EC-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--5AAFAB80FB6740D2A6190CB3939D90EC-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--5AAFAB80FB6740D2A6190CB3939D90EC-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--5AAFAB80FB6740D2A6190CB3939D90EC-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--5AAFAB80FB6740D2A6190CB3939D90EC--></AD_TABLE>
 
 <!--DC814AB3BC84486CA5411131724BC95A--><AD_TABLE>
@@ -84,6 +87,7 @@
 <!--DC814AB3BC84486CA5411131724BC95A-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--DC814AB3BC84486CA5411131724BC95A-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--DC814AB3BC84486CA5411131724BC95A-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--DC814AB3BC84486CA5411131724BC95A-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--DC814AB3BC84486CA5411131724BC95A--></AD_TABLE>
 
 <!--FF8080812FFEC82D012FFECCE3400030--><AD_TABLE>
@@ -105,6 +109,7 @@
 <!--FF8080812FFEC82D012FFECCE3400030-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF8080812FFEC82D012FFECCE3400030-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF8080812FFEC82D012FFECCE3400030-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--FF8080812FFEC82D012FFECCE3400030-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF8080812FFEC82D012FFECCE3400030--></AD_TABLE>
 
 <!--FF80808130BB89090130BB8E3D7E0012--><AD_TABLE>
@@ -128,6 +133,7 @@
 <!--FF80808130BB89090130BB8E3D7E0012-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF80808130BB89090130BB8E3D7E0012-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF80808130BB89090130BB8E3D7E0012-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--FF80808130BB89090130BB8E3D7E0012-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF80808130BB89090130BB8E3D7E0012--></AD_TABLE>
 
 <!--FF808081331848750133184B38D20009--><AD_TABLE>
@@ -148,6 +154,7 @@
 <!--FF808081331848750133184B38D20009-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF808081331848750133184B38D20009-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF808081331848750133184B38D20009-->  <AD_PACKAGE_ID><![CDATA[AC33B2262748414A816510545755435A]]></AD_PACKAGE_ID>
+<!--FF808081331848750133184B38D20009-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF808081331848750133184B38D20009--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_VAL_RULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_VAL_RULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -51,7 +51,7 @@
 <!--575E470ABADB4C278132C957A78C47E3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--575E470ABADB4C278132C957A78C47E3-->  <NAME><![CDATA[Process Payment valid actions]]></NAME>
 <!--575E470ABADB4C278132C957A78C47E3-->  <TYPE><![CDATA[S]]></TYPE>
-<!--575E470ABADB4C278132C957A78C47E3-->  <CODE><![CDATA[((@EM_APRM_Process_Payment@ = 'P' AND AD_Ref_List.value='P') OR (@EM_APRM_Process_Payment@ in ('R','RE') AND AD_Ref_List.value IN ('RE','R')) OR (@EM_APRM_Process_Payment@ in ('R','RE') AND AD_Ref_List.value IN ('V') AND @Status@='RPAE') OR (@EM_APRM_Process_Payment@ is null)) AND AD_Ref_List.IsActive = 'Y']]></CODE>
+<!--575E470ABADB4C278132C957A78C47E3-->  <CODE><![CDATA[((@EM_APRM_Process_Payment@ = 'P' AND AD_Ref_List.value='P') OR (@EM_APRM_Process_Payment@ in ('R','RE') AND AD_Ref_List.value IN ('RE','R') AND NOT EXISTS (SELECT 1 FROM FIN_PAYMENT WHERE FIN_Rev_Payment_ID = @FIN_Payment_ID@)) OR (@EM_APRM_Process_Payment@ in ('R','RE') AND AD_Ref_List.value IN ('R') AND EXISTS (SELECT 1 FROM FIN_PAYMENT WHERE FIN_Rev_Payment_ID = @FIN_Payment_ID@)) OR (@EM_APRM_Process_Payment@ in ('R','RE') AND AD_Ref_List.value IN ('V') AND @Status@='RPAE') OR (@EM_APRM_Process_Payment@ is null)) AND AD_Ref_List.IsActive = 'Y']]></CODE>
 <!--575E470ABADB4C278132C957A78C47E3-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--575E470ABADB4C278132C957A78C47E3--></AD_VAL_RULE>
 
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -38,6 +38,21 @@
 <!--9FAD469CE4414A25974CF45C0AD22D35-->  <CUSTOM_QUERY><![CDATA[N]]></CUSTOM_QUERY>
 <!--9FAD469CE4414A25974CF45C0AD22D35--></OBUISEL_SELECTOR>
 
+<!--A021037EAFFA49D299E4B6886E6A811C--><OBUISEL_SELECTOR>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <OBUISEL_SELECTOR_ID><![CDATA[A021037EAFFA49D299E4B6886E6A811C]]></OBUISEL_SELECTOR_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <NAME><![CDATA[FIN_Payment no combo]]></NAME>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <AD_REFERENCE_ID><![CDATA[E1C0B1C7D7C84E85903409A39A53E855]]></AD_REFERENCE_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <AD_TABLE_ID><![CDATA[D1A97202E832470285C9B1EB026D54E2]]></AD_TABLE_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[substring]]></SUGGESTIONTEXTMATCHSTYLE>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <POPUPTEXTMATCHSTYLE><![CDATA[substring]]></POPUPTEXTMATCHSTYLE>
+<!--A021037EAFFA49D299E4B6886E6A811C-->  <CUSTOM_QUERY><![CDATA[N]]></CUSTOM_QUERY>
+<!--A021037EAFFA49D299E4B6886E6A811C--></OBUISEL_SELECTOR>
+
 <!--A98899B1C75A4F4EBD3414F1B654EFAB--><OBUISEL_SELECTOR>
 <!--A98899B1C75A4F4EBD3414F1B654EFAB-->  <OBUISEL_SELECTOR_ID><![CDATA[A98899B1C75A4F4EBD3414F1B654EFAB]]></OBUISEL_SELECTOR_ID>
 <!--A98899B1C75A4F4EBD3414F1B654EFAB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.html	Thu Jun 27 10:02:33 2013 +0200
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s): Enterprise Intelligence Systems (http://www.eintel.com.au).
  *************************************************************************
@@ -235,7 +235,7 @@
 }
 
 function validateDate(element){
-  if (isMulticurrencyTxn()) {
+  if (isMulticurrencyTxn() || element.name === "inpExpectedDateFrom" || element.name === "inpExpectedDateTo") {
     if(isValidDate(element.value, element.getAttribute("displayformat")))
       loadGridList();
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Thu Jun 27 10:02:33 2013 +0200
@@ -230,6 +230,15 @@
           // parameters.add(null);
           String strDocTypeId = (String) CallStoredProcedure.getInstance().call("AD_GET_DOCTYPE",
               parameters, null);
+          String strDocBaseType = parameters.get(2).toString();
+
+          if (!FIN_Utility.isPeriodOpen(vars.getClient(), strDocBaseType, strOrgId, strPaymentDate)) {
+            final OBError myMessage = Utility.translateError(this, vars, vars.getLanguage(),
+                Utility.messageBD(this, "PeriodNotAvailable", vars.getLanguage()));
+            vars.setMessage(strTabId, myMessage);
+            printPageClosePopUp(response, vars);
+            return;
+          }
 
           if (strPaymentDocumentNo.startsWith("<")) {
             // get DocumentNo
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.html	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.html	Thu Jun 27 10:02:33 2013 +0200
@@ -53,10 +53,6 @@
    // window.close();
     return true;
   }
-  function closeThisPage() {
-	submitCommandForm('CLOSE', true, frmMain, null);
-    return true;
-  }
 
   function onloadFunctions() {
   }
@@ -288,7 +284,7 @@
                 <td class="Button_CenterAlign_ContentCell">
                   <div>
                     <button type="button" id="buttonCancel" class="ButtonLink"
-                      onclick="closeThisPage();return false;"
+                      onclick="closePage();return false;"
                       onfocus="buttonEvent('onfocus', this); window.status='Cancel'; return true;"
                       onblur="buttonEvent('onblur', this);"
                       onkeyup="buttonEvent('onkeyup', this);"
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java	Thu Jun 27 10:02:33 2013 +0200
@@ -97,8 +97,6 @@
           IsIDFilter.instance);
       processAndClose(response, vars, strWindowId, executionProcess, payments,
           dao.getObject(Organization.class, strOrganizationId));
-    } else if (vars.commandIn("CLOSE")) {
-      printPageClosePopUp(response, vars);
     }
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Thu Jun 27 10:02:33 2013 +0200
@@ -40,6 +40,7 @@
 import org.openbravo.advpaymentmngt.dao.MatchTransactionDao;
 import org.openbravo.advpaymentmngt.dao.TransactionsDao;
 import org.openbravo.advpaymentmngt.process.FIN_AddPayment;
+import org.openbravo.advpaymentmngt.process.FIN_ReconciliationProcess;
 import org.openbravo.advpaymentmngt.process.FIN_TransactionProcess;
 import org.openbravo.advpaymentmngt.utility.FIN_MatchedTransaction;
 import org.openbravo.advpaymentmngt.utility.FIN_MatchingTransaction;
@@ -317,12 +318,21 @@
           .getBankStatementLineMaxDate(financialAccount));
       reconciliation.setTransactionDate(MatchTransactionDao
           .getBankStatementLineMaxDate(financialAccount));
-      reconciliation.setProcessed(process);
-      reconciliation.setDocumentStatus(process ? "CO" : "DR");
-      reconciliation.setAPRMProcessReconciliation(process ? "R" : "P");
-      reconciliation.setAprmProcessRec(process ? "R" : "P");
+      if (!process) {
+        reconciliation.setProcessed(false);
+        reconciliation.setDocumentStatus("DR");
+        reconciliation.setAPRMProcessReconciliation("P");
+        reconciliation.setAprmProcessRec("P");
+      }
       OBDal.getInstance().save(reconciliation);
       OBDal.getInstance().flush();
+      if (process) {
+        // Process Reconciliation
+        OBError myError = processReconciliation(this, "P", reconciliation);
+        if (myError != null && myError.getType().equalsIgnoreCase("error")) {
+          throw new OBException(myError.getMessage());
+        }
+      }
     } catch (Exception ex) {
       OBError menssage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
       vars.setMessage(strTabId, menssage);
@@ -1267,6 +1277,19 @@
     return false;
   }
 
+  private OBError processReconciliation(ConnectionProvider conn, String strAction,
+      FIN_Reconciliation reconciliation) throws Exception {
+    ProcessBundle pb = new ProcessBundle("FF8080812E2F8EAE012E2F94CF470014", vars).init(conn);
+    HashMap<String, Object> parameters = new HashMap<String, Object>();
+    parameters.put("action", strAction);
+    parameters.put("FIN_Reconciliation_ID", reconciliation.getId());
+    pb.setParams(parameters);
+    OBError myMessage = null;
+    new FIN_ReconciliationProcess().execute(pb);
+    myMessage = (OBError) pb.getResult();
+    return myMessage;
+  }
+
   public String getServletInfo() {
     return "This servlet match imported bank statement lines for a financial account";
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.html	Thu Jun 27 10:02:33 2013 +0200
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -51,6 +51,7 @@
 </script>
 
 <script language="JavaScript" type="text/javascript">
+var checksToEnable=[];
 function showWarning(){
     if(!document.frmMain.inpAfterDate.checked){
       showJSMessage('APRM_DateWillBeUpdated');
@@ -115,6 +116,7 @@
 }
 
 function hideClearedTransactions(isChecked) {
+  disable();
   var chk = document.frmMain.inpTransactionId;
   if (chk === undefined) {
     return true;
@@ -132,7 +134,13 @@
       }
     }
   }
-  return true;
+  try {
+	 var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/Reconciliation.html";
+	 var paramXMLReq = null;
+	 return submitXmlHttpRequest(callBackLineStatus, document.frmMain, "UPDATESTATUS", url, false, null, paramXMLReq);
+	 } catch (e) { 
+	  alert(e);
+	 }
 }
 
 function updateAll(mark) {
@@ -255,19 +263,17 @@
 <script language="JavaScript" type="text/javascript">
 
 function saveTransactionLineStatus(isChecked, transLineId) {
-  document.frmMain.inpCurrentTransIdSelected.value = transLineId;
-  document.frmMain.inpIsCurrentTransSelected.value = isChecked;
-  document.frmMain.inpClearAll.disabled = true;
-  document.getElementById('buttonSave').disabled = true;
-  document.getElementById('buttonProcess').disabled = true;
-  document.getElementById('buttonCancel').disabled = true;
-  try {
-    var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/Reconciliation.html";
-    var paramXMLReq = null;
-    return submitXmlHttpRequest(callBackLineStatus, document.frmMain, "UPDATESTATUS", url, false, null, paramXMLReq);
-  } catch (e) {
-    alert(e);
-  }
+	document.frmMain.inpCurrentTransIdSelected.value = transLineId;
+	document.frmMain.inpIsCurrentTransSelected.value = isChecked;
+	disable();  
+	try {
+	  var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/Reconciliation.html";
+	  var paramXMLReq = null;
+	  return submitXmlHttpRequest(callBackLineStatus, document.frmMain, "UPDATESTATUS", url, false, null, paramXMLReq);
+	  
+      } catch (e) { 
+	    alert(e);
+	  }	      
 }
 
 function callBackLineStatus(paramXMLParticular, XMLHttpRequestObj) {
@@ -276,10 +282,7 @@
     try {
       if (XMLHttpRequestObj.responseText) {
         strText = XMLHttpRequestObj.responseText;
-        document.frmMain.inpClearAll.disabled = false;
-        document.getElementById('buttonSave').disabled = false;
-        document.getElementById('buttonProcess').disabled = false;
-        document.getElementById('buttonCancel').disabled = false;
+        enable();
       } else {
       }
     } catch (e) {
@@ -289,6 +292,7 @@
 }
 
 function loadGrid() {
+  disable();
   try {
     var url = "../org.openbravo.advpaymentmngt.ad_actionbutton/Reconciliation.html";
     var paramXMLReq = null;
@@ -326,6 +330,7 @@
           document.frmMain.inpIsFirstLoad.value = "false";
         }
         updateWhenAjaxResponse();
+        enable();
       } else {
         document.getElementById('sectionGrid').innerHTML = '';
       }
@@ -334,6 +339,35 @@
   }
   return true;
 }
+
+function enable(){
+	  document.frmMain.inpClearAll.disabled = false;
+	  document.getElementById('buttonSave').disabled = false;
+	  document.getElementById('buttonProcess').disabled = false;
+	  document.getElementById('buttonCancel').disabled = false;
+	  document.getElementById('paramHideCleared').disabled = false;
+	  document.getElementById('paramAfterDate').disabled = false;
+	  for(var i=0; i<checksToEnable.length; i++){
+	     document.getElementById(checksToEnable[i]).disabled = false;
+	  }
+	}
+
+	function disable(){
+	    document.frmMain.inpClearAll.disabled = true;
+	  document.getElementById('buttonSave').disabled = true;
+	  document.getElementById('buttonProcess').disabled = true;
+	  document.getElementById('buttonCancel').disabled = true;
+	  document.getElementById('paramHideCleared').disabled = true;
+	  document.getElementById('paramAfterDate').disabled = true;
+	  var items = document.frmMain.getElementsByTagName("input");
+	  checksToEnable = [];
+	  for(var i=0; i<items.length; i++){
+	    if(items[i].name === 'inpTransactionId'){
+	        items[i].disabled=true;
+	        checksToEnable.push(items[i].id);
+	    }
+	  }
+	}
 </script>
 <script language="JavaScript" type="text/javascript">
   function onLoadDo(){
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Thu Jun 27 10:02:33 2013 +0200
@@ -114,8 +114,9 @@
 
     } else if (vars.commandIn("UPDATESTATUS")) {
       String strFinancialAccountId = vars.getStringParameter("inpFinFinancialAccountId", "");
-      String strSelectedTransId = vars.getStringParameter("inpCurrentTransIdSelected");
+      String strSelectedTransId = vars.getStringParameter("inpCurrentTransIdSelected", "");
       boolean isChecked = "true".equals(vars.getStringParameter("inpIsCurrentTransSelected"));
+
       updateTransactionStatus(response, strFinancialAccountId, strSelectedTransId, isChecked);
     }
 
@@ -126,30 +127,31 @@
 
     OBContext.setAdminMode();
     try {
-      FIN_FinaccTransaction trans = OBDal.getInstance().get(FIN_FinaccTransaction.class,
-          strSelectedTransId);
+      if (strSelectedTransId != "") {
+        FIN_FinaccTransaction trans = OBDal.getInstance().get(FIN_FinaccTransaction.class,
+            strSelectedTransId);
+        String newStatus = "RPPC";
+        if (!isChecked) {
+          newStatus = (trans.getPaymentAmount().compareTo(trans.getDepositAmount()) >= 0) ? "RDNC"
+              : "PWNC";
+          trans.setReconciliation(null);
+          if (trans.getFinPayment() != null) {
+            trans.getFinPayment().setStatus((trans.getFinPayment().isReceipt()) ? "RDNC" : "PWNC");
+          }
+        } else {
+          FIN_FinancialAccount account = OBDal.getInstance().get(FIN_FinancialAccount.class,
+              strFinancialAccountId);
+          FIN_Reconciliation reconciliation = TransactionsDao.getLastReconciliation(account, "N");
+          trans.setReconciliation(reconciliation);
+          if (trans.getFinPayment() != null) {
+            trans.getFinPayment().setStatus("RPPC");
+          }
+        }
 
-      String newStatus = "RPPC";
-      if (!isChecked) {
-        newStatus = (trans.getPaymentAmount().compareTo(trans.getDepositAmount()) >= 0) ? "RDNC"
-            : "PWNC";
-        trans.setReconciliation(null);
-        if (trans.getFinPayment() != null) {
-          trans.getFinPayment().setStatus((trans.getFinPayment().isReceipt()) ? "RDNC" : "PWNC");
-        }
-      } else {
-        FIN_FinancialAccount account = OBDal.getInstance().get(FIN_FinancialAccount.class,
-            strFinancialAccountId);
-        FIN_Reconciliation reconciliation = TransactionsDao.getLastReconciliation(account, "N");
-        trans.setReconciliation(reconciliation);
-        if (trans.getFinPayment() != null) {
-          trans.getFinPayment().setStatus("RPPC");
-        }
+        trans.setStatus(newStatus);
+        OBDal.getInstance().save(trans);
+        OBDal.getInstance().flush();
       }
-      trans.setStatus(newStatus);
-      OBDal.getInstance().save(trans);
-      OBDal.getInstance().flush();
-
       response.setContentType("text/html; charset=UTF-8");
       PrintWriter out = response.getWriter();
       out.println("");
@@ -468,6 +470,7 @@
     BigDecimal totalDeposit = new BigDecimal(strTotalDeposit);
 
     for (FieldProvider fp : data) {
+
       if (!map.containsKey(fp.getField("transactionId"))
           && !fp.getField("markSelectedId").isEmpty()) {
         BigDecimal payAmt = new BigDecimal(fp.getField("paymentAmount"));
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ReconciliationGrid.srpt	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ReconciliationGrid.srpt	Thu Jun 27 10:02:33 2013 +0200
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2011 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -28,6 +28,7 @@
     <td class="DataGrid_Body_Cell" title="zz" id="fieldDescription">xxDescription</td>
     <td class="DataGrid_Body_Cell_Amount" id="fieldPaymentAmount">xx150.00</td>
     <td class="DataGrid_Body_Cell_Amount" id="fieldDepositAmount">xx60.00</td>
-    <td class="DataGrid_Body_LineNoCell"><input type="checkbox" name="inpTransactionId" value="" id="fieldTransactionId" onclick="saveTransactionLineStatus(this.checked, this.value); updateAmounts(this.value, this.checked); unselectClearAll(this.checked); return true;"/></td>
+    <td class="DataGrid_Body_LineNoCell">
+    <input type="checkbox" name="inpTransactionId" value="" id="fieldTransactionId_xx" onclick="saveTransactionLineStatus(this.checked, 'xx'); updateAmounts(this.value, this.checked); unselectClearAll(this.checked); return true;"/></td>
   </tr>
-</span>
+</span>
\ No newline at end of file
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ReconciliationGrid.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ReconciliationGrid.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -42,6 +42,10 @@
     <FIELD id="fieldRecordDepositAmt" attribute="value" format="euroEdition">depositAmount</FIELD>
     <FIELD id="fieldRecordPaymentAmt" attribute="name" replace="xx">transactionId</FIELD>
     <FIELD id="fieldRecordDepositAmt" attribute="name" replace="xx">transactionId</FIELD>
+   
+    <FIELD id="fieldTransactionId_xx" attribute="value">transactionId</FIELD>
+    <FIELD id="fieldTransactionId_xx" attribute="id">transactionId</FIELD>
+    <FIELD id="fieldTransactionId_xx" attribute="onclick" replace="xx">transactionId</FIELD>
     
     <SECTION id="sectionLinesDetail"/>
   </structure>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/algorithm/StandardMatchingAlgorithm.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/algorithm/StandardMatchingAlgorithm.java	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 
 package org.openbravo.advpaymentmngt.algorithm;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -41,7 +42,22 @@
     Date transactionDate = (algorithm.isMatchtransactiondate()) ? line.getTransactionDate() : null;
     String reference = (algorithm.isMatchreference()) ? line.getReferenceNo() : "";
 
-    List<FIN_FinaccTransaction> transactions;
+    List<FIN_FinaccTransaction> transactions = new ArrayList<FIN_FinaccTransaction>();
+    if (line.getGLItem() != null) {
+      transactions = MatchTransactionDao.getMatchingGLItemTransaction(line.getBankStatement()
+          .getAccount().getId(), line.getGLItem(), line.getTransactionDate(),
+          (line.getCramount().subtract(line.getDramount())), excluded);
+      if (transactions.isEmpty()) {
+        transactions = MatchTransactionDao.getMatchingGLItemTransaction(line.getBankStatement()
+            .getAccount().getId(), line.getGLItem(), null,
+            (line.getCramount().subtract(line.getDramount())), excluded);
+        if (!transactions.isEmpty()) {
+          return new FIN_MatchedTransaction(transactions.get(0), FIN_MatchedTransaction.WEAK);
+        }
+      } else {
+        return new FIN_MatchedTransaction(transactions.get(0), FIN_MatchedTransaction.STRONG);
+      }
+    }
     if (algorithm.isMatchbpname()) {
       transactions = MatchTransactionDao.getMatchingFinancialTransaction(line.getBankStatement()
           .getAccount().getId(), transactionDate, reference,
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Thu Jun 27 10:02:33 2013 +0200
@@ -604,7 +604,6 @@
    *          accounting dimension
    * @param user2
    *          accounting dimension
-   * @return
    */
   public FIN_PaymentScheduleDetail getNewPaymentScheduleDetail(Organization organization,
       BigDecimal amount, BusinessPartner businessPartner, Product product, Project project,
@@ -640,7 +639,6 @@
    *          accounting dimension
    * @param salesRegion
    *          accounting dimension
-   * @return
    */
   public FIN_PaymentScheduleDetail getNewPaymentScheduleDetail(Organization organization,
       BigDecimal amount, BusinessPartner businessPartner, Product product, Project project,
@@ -800,6 +798,9 @@
     finTrans.setCurrency(account.getCurrency());
     finTrans.setAccount(account);
     finTrans.setLineNo(line);
+    if (payment != null) {
+      OBDal.getInstance().refresh(payment);
+    }
     finTrans.setFinPayment(payment);
     String truncateDescription = null;
     if (description != null) {
@@ -823,7 +824,6 @@
       finTrans.setForeignConversionRate(convertRate);
       finTrans.setForeignAmount(sourceAmount);
     }
-
     OBDal.getInstance().save(finTrans);
     OBDal.getInstance().flush();
 
@@ -1813,16 +1813,17 @@
         strInvoiceId).getFINPaymentScheduleList();
     OBCriteria<FIN_PaymentScheduleDetail> psdCriteria = OBDal.getInstance().createCriteria(
         FIN_PaymentScheduleDetail.class);
-    if (!paySchedList.isEmpty())
+    if (!paySchedList.isEmpty()) {
       psdCriteria.add(Restrictions.in(FIN_PaymentScheduleDetail.PROPERTY_INVOICEPAYMENTSCHEDULE,
           paySchedList));
-    for (FIN_PaymentScheduleDetail psd : psdCriteria.list()) {
-      if (psd.getPaymentDetails() != null) {
-        FIN_Payment payment = psd.getPaymentDetails().getFinPayment();
-        if ("RPAE".equals(payment.getStatus())
-            && hasNotDeferredExecutionProcess(payment.getAccount(), payment.getPaymentMethod(),
-                payment.isReceipt()))
-          payments.add(payment);
+      for (FIN_PaymentScheduleDetail psd : psdCriteria.list()) {
+        if (psd.getPaymentDetails() != null) {
+          FIN_Payment payment = psd.getPaymentDetails().getFinPayment();
+          if ("RPAE".equals(payment.getStatus())
+              && hasNotDeferredExecutionProcess(payment.getAccount(), payment.getPaymentMethod(),
+                  payment.isReceipt()))
+            payments.add(payment);
+        }
       }
     }
 
@@ -1907,11 +1908,6 @@
   /**
    * Returns the list of credit payments for the selected business partner that belongs to the legal
    * entity's natural tree of the given organization
-   * 
-   * @param org
-   * @param bp
-   * @param isReceipt
-   * @return
    */
   public List<FIN_Payment> getCustomerPaymentsWithCredit(Organization org, BusinessPartner bp,
       boolean isReceipt) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Thu Jun 27 10:02:33 2013 +0200
@@ -604,7 +604,7 @@
           return;
         }
         // Reverse Payment
-        if (FIN_Utility.isReversePayment(payment)) {
+        if (strAction.equals("RE") && FIN_Utility.isReversePayment(payment)) {
           msg.setType("Error");
           msg.setTitle(Utility.messageBD(conProvider, "Error", language));
           msg.setMessage(Utility.parseTranslation(conProvider, vars, language,
@@ -793,6 +793,10 @@
                   && BigDecimal.ZERO.compareTo(psd.getWriteoffAmount()) == 0) {
                 paymentDetail.getFINPaymentScheduleDetailList().remove(psd);
                 OBDal.getInstance().getSession().refresh(paymentDetail);
+                psd.getInvoicePaymentSchedule()
+                    .getFINPaymentScheduleDetailInvoicePaymentScheduleList().remove(psd);
+                psd.getOrderPaymentSchedule().getFINPaymentScheduleDetailOrderPaymentScheduleList()
+                    .remove(psd);
                 OBDal.getInstance().remove(psd);
               }
             }
@@ -1189,6 +1193,7 @@
       newConversionRateDoc.setRate(payment.getFinancialTransactionConvertRate());
       newConversionRateDoc.setForeignAmount(payment.getFinancialTransactionAmount());
       newConversionRateDoc.setPayment(payment);
+      newConversionRateDoc.setClient(payment.getClient());
       OBDal.getInstance().save(newConversionRateDoc);
       OBDal.getInstance().flush();
       return newConversionRateDoc;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java	Thu Jun 27 10:02:33 2013 +0200
@@ -29,10 +29,13 @@
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.ad_forms.AcctServer;
+import org.openbravo.erpCommon.utility.OBDateUtils;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.model.financialmgmt.payment.FIN_BankStatement;
 import org.openbravo.model.financialmgmt.payment.FIN_Reconciliation;
+import org.openbravo.model.financialmgmt.payment.FIN_ReconciliationLine_v;
 import org.openbravo.scheduling.ProcessBundle;
 
 public class FIN_ReconciliationProcess implements org.openbravo.scheduling.Process {
@@ -74,6 +77,26 @@
               "@APRM_ReconciliationNoLines@" + ": " + reconciliation.getDocumentNo()));
           bundle.setResult(msg);
           return;
+        } else {
+          for (FIN_ReconciliationLine_v recLine : reconciliation.getFINReconciliationLineVList()) {
+            boolean orgLegalWithAccounting = FIN_Utility.periodControlOpened(recLine
+                .getFinancialAccountTransaction().getReconciliation().TABLE_NAME, recLine
+                .getFinancialAccountTransaction().getReconciliation().getId(), recLine
+                .getFinancialAccountTransaction().getReconciliation().TABLE_NAME + "_ID", "LE");
+            if (!FIN_Utility.isPeriodOpen(recLine.getFinancialAccountTransaction().getClient()
+                .getId(), AcctServer.DOCTYPE_Reconciliation, recLine
+                .getFinancialAccountTransaction().getOrganization().getId(),
+                OBDateUtils.formatDate(recLine.getFinancialAccountTransaction().getDateAcct()))
+                && orgLegalWithAccounting) {
+              msg.setType("Error");
+              msg.setTitle(Utility.messageBD(conProvider, "Error", language));
+              msg.setMessage(String.format(Utility.parseTranslation(conProvider, vars, language,
+                  "@APRM_PeriodNotAvailableClearedItem@"), recLine.getIdentifier()));
+              bundle.setResult(msg);
+              OBDal.getInstance().rollbackAndClose();
+              return;
+            }
+          }
         }
         reconciliation.setProcessed(true);
         reconciliation.setAPRMProcessReconciliation("R");
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Thu Jun 27 10:02:33 2013 +0200
@@ -600,10 +600,6 @@
 
   /**
    * Returns the amount of days between two given dates
-   * 
-   * @param endDate
-   * @param beginDate
-   * @return
    */
   public static Long getDaysBetween(Date beginDate, Date endDate) {
     final TimeZone tz = TimeZone.getDefault();
@@ -887,8 +883,6 @@
    *          Currency to convert from
    * @param toCurrency
    *          Currency being converted to
-   * @param conversionDate
-   *          Date conversion is being performed
    * @param documentId
    *          DocumentId to find the value in table c_conversion_rate_document
    * @param entity
@@ -1016,8 +1010,6 @@
    * @param organization
    *          to get its configuration. In case no configuration is available, the invoice's
    *          document number is returned
-   * @param invoice
-   * @return
    */
   public static String getDesiredDocumentNo(final Organization organization, final Invoice invoice) {
     String invoiceDocNo;
@@ -1126,6 +1118,19 @@
     }
   }
 
+  /**
+   * Return true if the period is open for a client, document type, organization and accounting date
+   * 
+   * @param client
+   *          the client for which it wants to know if the period is open
+   * @param documentType
+   *          It is the docbasetype from the document type
+   * @param org
+   *          the Organization for which it wants to know if the period is open
+   * @param dateAcct
+   *          The accounting date from the document
+   * @return boolean
+   */
   public static boolean isPeriodOpen(String client, String documentType, String org, String dateAcct) {
     final Session session = OBDal.getInstance().getSession();
 
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/FIN_Utilities.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/FIN_Utilities.js	Thu Jun 27 10:02:33 2013 +0200
@@ -286,11 +286,17 @@
   var actualConverted = frm.inpActualConverted;
   var expectedPayment = frm.inpExpectedPayment;
   var actualPayment = frm.inpActualPayment;
+  var exchangeRateValue = exchangeRate.value;
 
   if (actualConverted && expectedConverted && exchangeRate) {
+    actualConverted.value = formattedNumberOpTemp(actualConverted.value, 'round', precision, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
     if (recalcExchangeRate) {
       if (actualConverted.value && actualPayment.value) {
         if (compare(actualPayment.value, '!=', 0)) {
+          var actualConvertedValue = OB.Utilities.Number.OBMaskedToJS(actualConverted.value, globalDecSeparator, globalGroupSeparator);
+          var actualPaymentValue = OB.Utilities.Number.OBMaskedToJS(actualPayment.value, globalDecSeparator, globalGroupSeparator);
+          exchangeRateValue = (actualConvertedValue / actualPaymentValue).toString();
+          exchangeRateValue = exchangeRateValue.replace('.', globalDecSeparator);
           exchangeRate.value = formattedNumberOpTemp(actualConverted.value, '/', actualPayment.value, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
         }
       } else {
@@ -298,13 +304,13 @@
       }
     } else {
       if (exchangeRate.value) {
-        actualConverted.value = formattedNumberOpTemp(actualPayment.value, '*', exchangeRate.value, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
+        actualConverted.value = formattedNumberOpTemp(actualPayment.value, '*', exchangeRateValue, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
       } else {
         actualConverted.value = applyFormat('0');
       }
     }
     if (exchangeRate.value && expectedPayment.value) {
-      expectedConverted.value = formattedNumberOpTemp(expectedPayment.value, '*', exchangeRate.value, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
+      expectedConverted.value = formattedNumberOpTemp(expectedPayment.value, '*', exchangeRateValue, roundedMask, globalDecSeparator, globalGroupSeparator, globalGroupInterval);
     } else {
       expectedConverted.value = applyFormat('0');
     }
--- a/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION><![CDATA[1.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--C70732EA90A14EC0916078B85CC33D2D-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--8BDE81545C1A43EAAC4BA3C5ED754DC8-->  <STARTVERSION><![CDATA[3.0.20523]]></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.client.application/src-db/database/sourcedata/AD_COLUMN.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_COLUMN.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -622,7 +622,7 @@
 <!--178D324AD10947149B7F79F140AA6832-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--178D324AD10947149B7F79F140AA6832-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
 <!--178D324AD10947149B7F79F140AA6832-->  <ISKEY><![CDATA[N]]></ISKEY>
-<!--178D324AD10947149B7F79F140AA6832-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--178D324AD10947149B7F79F140AA6832-->  <ISPARENT><![CDATA[Y]]></ISPARENT>
 <!--178D324AD10947149B7F79F140AA6832-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--178D324AD10947149B7F79F140AA6832-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
 <!--178D324AD10947149B7F79F140AA6832-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
@@ -1651,6 +1651,7 @@
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT MAX(AD_MODULE_ID) FROM AD_MODULE WHERE ISDEFAULT='Y']]></DEFAULTVALUE>
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--4B5BBF2C5F48450CBB41899F1FDDC0F6-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
@@ -2971,6 +2972,7 @@
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--8A30D34C4CCD489F8939C7567F408C0A-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT MAX(AD_MODULE_ID) FROM AD_MODULE WHERE ISDEFAULT='Y']]></DEFAULTVALUE>
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--8A30D34C4CCD489F8939C7567F408C0A-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
@@ -5132,6 +5134,7 @@
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--A890369E8CB240B3825A25E6F9C4A385-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT AD_MODULE_ID FROM AD_MENU WHERE AD_MENU_ID = @AD_MENU_ID@]]></DEFAULTVALUE>
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--A890369E8CB240B3825A25E6F9C4A385-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -96,6 +96,18 @@
 <!--04E5DFD5293748308CF3ED2848CE8AE4-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--04E5DFD5293748308CF3ED2848CE8AE4--></AD_MESSAGE>
 
+<!--050A887278BB4AF0A40D7FBEC4BFED0D--><AD_MESSAGE>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <AD_MESSAGE_ID><![CDATA[050A887278BB4AF0A40D7FBEC4BFED0D]]></AD_MESSAGE_ID>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <VALUE><![CDATA[OBUIAPP_WantToCloneRecord]]></VALUE>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <MSGTEXT><![CDATA[Do you want to clone the selected record?]]></MSGTEXT>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--050A887278BB4AF0A40D7FBEC4BFED0D--></AD_MESSAGE>
+
 <!--07272FCDEEA64054AF2F983D9814EE00--><AD_MESSAGE>
 <!--07272FCDEEA64054AF2F983D9814EE00-->  <AD_MESSAGE_ID><![CDATA[07272FCDEEA64054AF2F983D9814EE00]]></AD_MESSAGE_ID>
 <!--07272FCDEEA64054AF2F983D9814EE00-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -783,6 +795,18 @@
 <!--7410A9E707384D369419188644A31430-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--7410A9E707384D369419188644A31430--></AD_MESSAGE>
 
+<!--744877846A1D4E3EAD6F4BFF308C148D--><AD_MESSAGE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <AD_MESSAGE_ID><![CDATA[744877846A1D4E3EAD6F4BFF308C148D]]></AD_MESSAGE_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <VALUE><![CDATA[OBUIAPP_FillMandatoryFields]]></VALUE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <MSGTEXT><![CDATA[Few mandatory fields have not been filled. Refer lines]]></MSGTEXT>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--744877846A1D4E3EAD6F4BFF308C148D-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--744877846A1D4E3EAD6F4BFF308C148D--></AD_MESSAGE>
+
 <!--75E47FA30B8D438E9569B4C688E863EB--><AD_MESSAGE>
 <!--75E47FA30B8D438E9569B4C688E863EB-->  <AD_MESSAGE_ID><![CDATA[75E47FA30B8D438E9569B4C688E863EB]]></AD_MESSAGE_ID>
 <!--75E47FA30B8D438E9569B4C688E863EB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION><![CDATA[2.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--9BA0836A3CD74EE4AB48753A47211BCC-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--15D7CE8D95D043189162DBABA54A1F61-->  <STARTVERSION><![CDATA[2.1.20523]]></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.20088]]></STARTVERSION>
+<!--60A170212F36499D83B8AD38D01F46B3-->  <STARTVERSION><![CDATA[2.1.20523]]></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.20088]]></STARTVERSION>
+<!--824D60CB352E4099B1D8C903CA139DAE-->  <STARTVERSION><![CDATA[3.0.20523]]></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.20088]]></STARTVERSION>
+<!--E8FD820AFE3D4FE08C02FC47769026AD-->  <STARTVERSION><![CDATA[8.1.20523]]></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/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 <!--090A37D22E61FE94012E620CD15D0030-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--090A37D22E61FE94012E620CD15D0030-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--090A37D22E61FE94012E620CD15D0030-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--090A37D22E61FE94012E620CD15D0030-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--090A37D22E61FE94012E620CD15D0030--></AD_TABLE>
 
 <!--1A801FD9F44E4EFFA2EA928693A6BBCB--><AD_TABLE>
@@ -39,6 +40,7 @@
 <!--1A801FD9F44E4EFFA2EA928693A6BBCB-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--1A801FD9F44E4EFFA2EA928693A6BBCB-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--1A801FD9F44E4EFFA2EA928693A6BBCB-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--1A801FD9F44E4EFFA2EA928693A6BBCB-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--1A801FD9F44E4EFFA2EA928693A6BBCB--></AD_TABLE>
 
 <!--30123B1001FC4E82BB4CB9725E069B48--><AD_TABLE>
@@ -59,6 +61,7 @@
 <!--30123B1001FC4E82BB4CB9725E069B48-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--30123B1001FC4E82BB4CB9725E069B48-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--30123B1001FC4E82BB4CB9725E069B48-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--30123B1001FC4E82BB4CB9725E069B48-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--30123B1001FC4E82BB4CB9725E069B48--></AD_TABLE>
 
 <!--6EDC4A262444493BAE672E7E144A36F7--><AD_TABLE>
@@ -81,6 +84,7 @@
 <!--6EDC4A262444493BAE672E7E144A36F7-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--6EDC4A262444493BAE672E7E144A36F7-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--6EDC4A262444493BAE672E7E144A36F7-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--6EDC4A262444493BAE672E7E144A36F7-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--6EDC4A262444493BAE672E7E144A36F7--></AD_TABLE>
 
 <!--79127717F4514B459D9014C91E793CE9--><AD_TABLE>
@@ -105,6 +109,7 @@
 <!--79127717F4514B459D9014C91E793CE9-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
 <!--79127717F4514B459D9014C91E793CE9-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--79127717F4514B459D9014C91E793CE9-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--79127717F4514B459D9014C91E793CE9-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--79127717F4514B459D9014C91E793CE9--></AD_TABLE>
 
 <!--815D739C48414E01AF9F44EE3E8CCEBB--><AD_TABLE>
@@ -125,6 +130,7 @@
 <!--815D739C48414E01AF9F44EE3E8CCEBB-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--815D739C48414E01AF9F44EE3E8CCEBB-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--815D739C48414E01AF9F44EE3E8CCEBB-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--815D739C48414E01AF9F44EE3E8CCEBB-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--815D739C48414E01AF9F44EE3E8CCEBB--></AD_TABLE>
 
 <!--B733B9E74A0D4FE1A3EC2A100E0ADD47--><AD_TABLE>
@@ -147,6 +153,7 @@
 <!--B733B9E74A0D4FE1A3EC2A100E0ADD47-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--B733B9E74A0D4FE1A3EC2A100E0ADD47-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--B733B9E74A0D4FE1A3EC2A100E0ADD47-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--B733B9E74A0D4FE1A3EC2A100E0ADD47-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--B733B9E74A0D4FE1A3EC2A100E0ADD47--></AD_TABLE>
 
 <!--DEADAC2161894A56A041B81A74B02D9E--><AD_TABLE>
@@ -169,6 +176,7 @@
 <!--DEADAC2161894A56A041B81A74B02D9E-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--DEADAC2161894A56A041B81A74B02D9E-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--DEADAC2161894A56A041B81A74B02D9E-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--DEADAC2161894A56A041B81A74B02D9E-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--DEADAC2161894A56A041B81A74B02D9E--></AD_TABLE>
 
 <!--E6F29F8A30BC4603B1D1195051C4F3A6--><AD_TABLE>
@@ -191,6 +199,7 @@
 <!--E6F29F8A30BC4603B1D1195051C4F3A6-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--E6F29F8A30BC4603B1D1195051C4F3A6-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--E6F29F8A30BC4603B1D1195051C4F3A6-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--E6F29F8A30BC4603B1D1195051C4F3A6-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--E6F29F8A30BC4603B1D1195051C4F3A6--></AD_TABLE>
 
 <!--FF8081813157AED2013157B1F75F0007--><AD_TABLE>
@@ -212,6 +221,7 @@
 <!--FF8081813157AED2013157B1F75F0007-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF8081813157AED2013157B1F75F0007-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF8081813157AED2013157B1F75F0007-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--FF8081813157AED2013157B1F75F0007-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF8081813157AED2013157B1F75F0007--></AD_TABLE>
 
 <!--FF80818132D7FB620132D8129D1A0028--><AD_TABLE>
@@ -233,6 +243,7 @@
 <!--FF80818132D7FB620132D8129D1A0028-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF80818132D7FB620132D8129D1A0028-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF80818132D7FB620132D8129D1A0028-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--FF80818132D7FB620132D8129D1A0028-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF80818132D7FB620132D8129D1A0028--></AD_TABLE>
 
 <!--FF80818132D85DB50132D860924E0004--><AD_TABLE>
@@ -253,6 +264,7 @@
 <!--FF80818132D85DB50132D860924E0004-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF80818132D85DB50132D860924E0004-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF80818132D85DB50132D860924E0004-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--FF80818132D85DB50132D860924E0004-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF80818132D85DB50132D860924E0004--></AD_TABLE>
 
 <!--FF80818132F263D40132F26C10790010--><AD_TABLE>
@@ -273,6 +285,7 @@
 <!--FF80818132F263D40132F26C10790010-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF80818132F263D40132F26C10790010-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF80818132F263D40132F26C10790010-->  <AD_PACKAGE_ID><![CDATA[BA250A68426F4D71BACAE830EF4EC696]]></AD_PACKAGE_ID>
+<!--FF80818132F263D40132F26C10790010-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF80818132F263D40132F26C10790010--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -9,6 +9,7 @@
 <!--090A37D22E61FE94012E621729090048-->  <AD_TABLE_ID><![CDATA[090A37D22E61FE94012E620CD15D0030]]></AD_TABLE_ID>
 <!--090A37D22E61FE94012E621729090048-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
 <!--090A37D22E61FE94012E621729090048-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--090A37D22E61FE94012E621729090048-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
 <!--090A37D22E61FE94012E621729090048--></OBSERDS_DATASOURCE>
 
 <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--><OBSERDS_DATASOURCE>
@@ -21,6 +22,7 @@
 <!--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--></OBSERDS_DATASOURCE>
 
 <!--C17951F970E942FD9F3771B7BE91D049--><OBSERDS_DATASOURCE>
@@ -33,6 +35,7 @@
 <!--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--></OBSERDS_DATASOURCE>
 
 </data>
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -40,6 +40,7 @@
 import org.openbravo.erpCommon.utility.UsedByLink;
 import org.openbravo.model.ad.alert.AlertRecipient;
 import org.openbravo.model.ad.alert.AlertRule;
+import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.db.DalConnectionProvider;
 import org.openbravo.service.json.JsonConstants;
 
@@ -52,7 +53,7 @@
  * @see StaticResourceComponent
  */
 @ApplicationScoped
-public class AlertActionHandler extends BaseActionHandler {
+public class AlertActionHandler extends BaseActionHandler implements PortalAccessible {
   private static final Logger log4j = Logger.getLogger(AlertActionHandler.class);
 
   /*
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationConstants.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationConstants.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -60,6 +60,9 @@
   // Identifier of the key holding the value of the button clicked
   public static final String BUTTON_VALUE = "_buttonValue";
 
+  public static final String DATASOURCEBASEDTABLE = "Datasource";
+  public static final String TABLEBASEDTABLE = "Table";
+
   static {
     try {
       ACTION_RESULT_SUCCESS = new JSONObject("{result: 'success'}");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/GlobalMenu.java	Thu Jun 27 10:02:33 2013 +0200
@@ -0,0 +1,289 @@
+/*
+ *************************************************************************
+ * 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) 2013 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.client.application;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.hibernate.Query;
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.client.application.MenuManager.MenuEntryType;
+import org.openbravo.client.application.MenuManager.MenuOption;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.ad.access.Role;
+import org.openbravo.model.ad.domain.ModelImplementation;
+import org.openbravo.model.ad.domain.ModelImplementationMapping;
+import org.openbravo.model.ad.ui.Menu;
+import org.openbravo.model.ad.ui.Process;
+import org.openbravo.model.ad.ui.Tab;
+import org.openbravo.model.ad.utility.Tree;
+import org.openbravo.model.ad.utility.TreeNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ * Caches in memory generic global menus per language and tree to be consumed by {@link MenuManager}
+ * 
+ * @author alostale
+ * 
+ */
+@ApplicationScoped
+public class GlobalMenu {
+  private static final Logger log = LoggerFactory.getLogger(GlobalMenu.class);
+
+  private Map<String, List<MenuOption>> menuOptionsByLangAndTree = null;
+
+  private long cacheTimeStamp = 0;
+
+  /**
+   * Returns the menu for current role's tree and language looking in the application scoped cached
+   * ones. If it is not present there, it is generated and cached.
+   * 
+   */
+  synchronized List<MenuOption> getMenuOptions(String roleId, String language) {
+    long t = System.currentTimeMillis();
+
+    if (menuOptionsByLangAndTree == null) {
+      invalidateCache();
+    }
+
+    Role role = OBDal.getInstance().get(Role.class, roleId);
+    final Tree tree;
+    if (role.getPrimaryTreeMenu() != null) {
+      tree = role.getPrimaryTreeMenu();
+    } else {
+      tree = OBDal.getInstance().get(Tree.class, "10");
+    }
+
+    String menuKey = language + tree.getId();
+    if (menuOptionsByLangAndTree.get(menuKey) == null) {
+      menuOptionsByLangAndTree.put(menuKey, createInitialMenuList(tree, language));
+      log.info("Generating menu took " + (System.currentTimeMillis() - t));
+      t = System.currentTimeMillis();
+    } else {
+      log.debug("Using cached menu for tree and language");
+    }
+
+    ArrayList<MenuOption> newOptions = new ArrayList<MenuOption>();
+    final Map<String, MenuOption> menuOptionsByMenuId = new HashMap<String, MenuOption>();
+    for (MenuOption option : menuOptionsByLangAndTree.get(menuKey)) {
+      final MenuOption clonedMenuOption = new MenuOption(option);
+
+      if (clonedMenuOption.getMenu() != null) {
+        menuOptionsByMenuId.put(clonedMenuOption.getMenu().getId(), clonedMenuOption);
+      }
+      newOptions.add(clonedMenuOption);
+    }
+
+    // Tree is generated in the cloned instances to refer to itself and not to the pristine one
+    for (MenuOption menuOption : newOptions) {
+      menuOption.setParentMenuOption(menuOptionsByMenuId);
+    }
+
+    log.debug("Getting a copy of globally cached menu took {} ms", System.currentTimeMillis());
+    return newOptions;
+  }
+
+  private List<MenuOption> createInitialMenuList(Tree tree, String language) {
+    List<MenuOption> menuOptions = new ArrayList<MenuOption>();
+    OBCriteria<TreeNode> treeNodes = OBDal.getInstance().createCriteria(TreeNode.class);
+    treeNodes.add(Restrictions.eq(TreeNode.PROPERTY_TREE, tree));
+    treeNodes.setFilterOnActive(false);
+
+    // Cache in DAL session all menu entries in a single query, so no need to query one by one
+    // afterwards
+    final String menuHql = "select m from ADMenu m left join fetch m.aDMenuTrlList where m.module.enabled=true";
+    final Query menuQry = OBDal.getInstance().getSession().createQuery(menuHql);
+    @SuppressWarnings("unchecked")
+    List<Menu> menus = (List<Menu>) menuQry.list();
+
+    List<TreeNode> nodes = treeNodes.list();
+
+    for (TreeNode treeNode : nodes) {
+      boolean addOption = treeNode.isActive();
+
+      if (!addOption) {
+        Menu menuEntry = OBDal.getInstance().get(Menu.class, treeNode.getNode());
+        if (menuEntry != null) {
+          addOption = menuEntry.isSummaryLevel();
+        }
+      }
+
+      if (addOption) {
+        final MenuOption menuOption = new MenuOption();
+        menuOption.setTreeNode(treeNode);
+        menuOption.setDbId(treeNode.getId());
+        Menu menuEntry = OBDal.getInstance().get(Menu.class, treeNode.getNode());
+        if (menuEntry != null && !menuEntry.isActive()) {
+          menuOption.setVisible(false);
+        }
+        menuOptions.add(menuOption);
+      }
+    }
+
+    linkMenus(menus, menuOptions, language);
+
+    // sort them by sequencenumber of the treenode
+    Collections.sort(menuOptions, new MenuSequenceComparator());
+
+    return menuOptions;
+  }
+
+  /**
+   * Each menu option is configured with additional paramters
+   * 
+   */
+  private void linkMenus(List<Menu> menus, List<MenuOption> menuOptions, String language) {
+    final Map<String, MenuOption> menuOptionsByNodeId = new HashMap<String, MenuOption>();
+    for (MenuOption menuOption : menuOptions) {
+      menuOptionsByNodeId.put(menuOption.getTreeNode().getNode(), menuOption);
+    }
+
+    for (Menu menu : menus) {
+      final MenuOption foundOption = menuOptionsByNodeId.get(menu.getId());
+      if (menu.isActive() || menu.isSummaryLevel()) {
+        if (foundOption != null) {
+          foundOption.setMenu(menu, language);
+          if (menu.getURL() != null) {
+            foundOption.setType(MenuEntryType.External);
+            foundOption.setId(menu.getURL());
+          } else if (menu.getObuiappView() != null && menu.getObuiappView().isActive()) {
+            foundOption.setType(MenuEntryType.View);
+            foundOption.setId(menu.getObuiappView().getName());
+            foundOption.setObjectId(menu.getObuiappView().getId());
+          } else if (menu.getSpecialForm() != null && menu.getSpecialForm().isActive()) {
+            boolean found = false;
+            for (ModelImplementation mi : menu.getSpecialForm().getADModelImplementationList()) {
+              if (found) {
+                break;
+              }
+              for (ModelImplementationMapping mim : mi.getADModelImplementationMappingList()) {
+                if (mim.isDefault()) {
+                  found = true;
+                  foundOption.setType(MenuEntryType.Form);
+                  foundOption.setForm(menu.getSpecialForm());
+                  foundOption.setId(mim.getMappingName());
+                  foundOption.setObjectId(menu.getSpecialForm().getId());
+                  break;
+                }
+              }
+            }
+          } else if (menu.getProcess() != null && menu.getProcess().isActive()) {
+            Process process = menu.getProcess();
+            boolean found = false;
+
+            for (ModelImplementation mi : process.getADModelImplementationList()) {
+              if (found) {
+                break;
+              }
+              for (ModelImplementationMapping mim : mi.getADModelImplementationMappingList()) {
+                if (mim.isDefault()) {
+                  found = true;
+                  foundOption.setId(mim.getMappingName());
+                  foundOption.setObjectId(process.getId());
+                  if (process.getUIPattern().equals("Standard")) {
+                    foundOption.setType(MenuEntryType.Process);
+                  } else if (process.isReport() || process.isJasperReport()) {
+                    foundOption.setType(MenuEntryType.Report);
+                    foundOption.setReport(true);
+                  } else {
+                    foundOption.setType(MenuEntryType.ProcessManual);
+                  }
+                  break;
+                }
+              }
+            }
+            if (!found && "P".equals(menu.getAction())) {
+              foundOption.setType(MenuEntryType.Process);
+              foundOption.setObjectId(process.getId());
+              if (process.isExternalService() != null && process.isExternalService()
+                  && "PS".equals(process.getServiceType())) {
+                foundOption.setId("/utility/OpenPentaho.html?inpadProcessId=" + process.getId());
+              } else if ("S".equals(process.getUIPattern()) && !process.isJasperReport()
+                  && process.getProcedure() == null) {
+                // see the MenuData.isGenericJavaProcess method
+                foundOption.setId("/ad_actionButton/ActionButtonJava_Responser.html");
+              } else {
+                foundOption.setId("/ad_actionButton/ActionButton_Responser.html");
+              }
+            }
+          } else if (menu.getOBUIAPPProcessDefinition() != null
+              && menu.getOBUIAPPProcessDefinition().isActive()) {
+            foundOption.setType(MenuEntryType.ProcessDefinition);
+            foundOption.setObjectId(menu.getOBUIAPPProcessDefinition().getId());
+          } else if (menu.getWindow() != null && menu.getWindow().isActive()) {
+            boolean found = false;
+            for (Tab tab : menu.getWindow().getADTabList()) {
+              if (tab.getTabLevel() == 0) {
+                found = true;
+                foundOption.setType(MenuEntryType.Window);
+                foundOption.setId(tab.getId());
+                foundOption.setObjectId(menu.getWindow().getId());
+                foundOption.setTab(tab);
+                break;
+              }
+            }
+            if (!found) {
+              log.warn("Not found tab with level 0 for window {}", menu.getWindow());
+            }
+          }
+        }
+      }
+    }
+  }
+
+  /**
+   * Sorts menu based on its nodes sequence
+   * 
+   */
+  private static class MenuSequenceComparator implements Comparator<MenuOption> {
+    @Override
+    public int compare(MenuOption o1, MenuOption o2) {
+      TreeNode tn1 = o1.getTreeNode();
+      TreeNode tn2 = o2.getTreeNode();
+      return (int) (tn1.getSequenceNumber() - tn2.getSequenceNumber());
+    }
+  }
+
+  /**
+   * Invalidates menu cache. To be invoked when the menu changes.
+   */
+  public void invalidateCache() {
+    log.info("Invalidating menu cache");
+    menuOptionsByLangAndTree = new HashMap<String, List<MenuOption>>();
+    cacheTimeStamp = System.currentTimeMillis();
+  }
+
+  /**
+   * Whenever the cache is regenerated time stamp is changed to check differences
+   * 
+   */
+  public long getCacheTimeStamp() {
+    return cacheTimeStamp;
+  }
+}
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/HeartBeatPopupActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/HeartBeatPopupActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -43,6 +43,7 @@
 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;
 
 /**
@@ -52,7 +53,7 @@
  * @see StaticResourceComponent
  */
 @ApplicationScoped
-public class HeartBeatPopupActionHandler extends BaseActionHandler {
+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";
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/LogOutActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/LogOutActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -25,9 +25,10 @@
 
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.client.kernel.BaseKernelServlet.KernelHttpServletResponse;
 import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.client.kernel.StaticResourceComponent;
-import org.openbravo.client.kernel.BaseKernelServlet.KernelHttpServletResponse;
+import org.openbravo.portal.PortalAccessible;
 
 /**
  * Is responsible for logging out from the application.
@@ -36,7 +37,7 @@
  * @see StaticResourceComponent
  */
 @ApplicationScoped
-public class LogOutActionHandler extends BaseActionHandler {
+public class LogOutActionHandler extends BaseActionHandler implements PortalAccessible {
 
   /*
    * (non-Javadoc)
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/MenuManager.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -22,68 +22,79 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import javax.enterprise.context.SessionScoped;
+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.DalUtil;
 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.domain.ModelImplementationMapping;
 import org.openbravo.model.ad.ui.Form;
 import org.openbravo.model.ad.ui.Menu;
 import org.openbravo.model.ad.ui.MenuTrl;
 import org.openbravo.model.ad.ui.Tab;
-import org.openbravo.model.ad.ui.Window;
-import org.openbravo.model.ad.utility.Tree;
 import org.openbravo.model.ad.utility.TreeNode;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * Reads the menu from the database and caches it in memory for easy consumption by components.
+ * 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
  * 
  * @author mtaal
  */
 @SessionScoped
 public class MenuManager implements Serializable {
-
+  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
   };
 
+  /**
+   * Points to globally cached generic menu
+   */
+  @Inject
+  private GlobalMenu globalMenuOptions;
+
   private MenuOption cachedMenu;
   private List<MenuOption> selectableMenuOptions;
   private String roleId;
   private List<MenuOption> menuOptions;
 
+  private long cacheTimeStamp = 0;
+
   public synchronized MenuOption getMenu() {
+    long t = System.currentTimeMillis();
     if (cachedMenu == null || roleId == null
-        || !roleId.equals(OBContext.getOBContext().getRole().getId())) {
+        || !roleId.equals(OBContext.getOBContext().getRole().getId())
+        || cacheTimeStamp != globalMenuOptions.getCacheTimeStamp()) {
 
       // 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());
+        cacheTimeStamp = globalMenuOptions.getCacheTimeStamp();
 
-        createInitialMenuList();
-
+        // configure global menu with role permissions
         linkWindows();
         linkProcesses();
         linkForms();
         linkProcessDefinition();
+        linkViewDefinition();
 
         removeInvisibleNodes();
         removeInaccessibleNodes();
@@ -107,256 +118,124 @@
       } finally {
         OBContext.restorePreviousMode();
       }
+    } else {
+      log.debug("Cached menu");
     }
+    log.debug("getMenu took {} ms", System.currentTimeMillis() - t);
     return cachedMenu;
   }
 
   @SuppressWarnings("unchecked")
-  private void linkMenus() {
-    final String menuHql = "select m from ADMenu m left join fetch m.aDMenuTrlList where m.module.enabled=true";
-    final Query menuQry = OBDal.getInstance().getSession().createQuery(menuHql);
-    final Map<String, MenuOption> menuOptionsByNodeId = new HashMap<String, MenuOption>();
-    for (MenuOption menuOption : menuOptions) {
-      menuOptionsByNodeId.put(menuOption.getTreeNode().getNode(), menuOption);
-    }
-    for (Menu menu : (List<Menu>) menuQry.list()) {
-      final MenuOption foundOption = menuOptionsByNodeId.get(menu.getId());
-      if (menu.isActive() || menu.isSummaryLevel()) {
-        if (foundOption != null) {
-          foundOption.setMenu(menu);
-          if (menu.getURL() != null) {
-            foundOption.setType(MenuEntryType.External);
-            foundOption.setId(menu.getURL());
-          }
-          if (menu.getObuiappView() != null && menu.getObuiappView().isActive()
-              && isValidForCurrentUserRole(menu.getObuiappView())) {
-            foundOption.setType(MenuEntryType.View);
-            foundOption.setId(menu.getObuiappView().getName());
-          }
-        }
+  private void linkForms() {
+    final String formsHql = "select fa.specialForm.id " + //
+        " from ADFormAccess fa " + //
+        "where fa.role.id=:roleId";
+
+    final Query formsQry = OBDal.getInstance().getSession().createQuery(formsHql);
+    formsQry.setParameter("roleId", OBContext.getOBContext().getRole().getId());
+
+    for (String formId : (List<String>) formsQry.list()) {
+      MenuOption option = getMenuOptionByType(MenuEntryType.Form, formId);
+      if (option != null) {
+        // allow access if not running in a webcontainer as then the config file can not be checked
+        boolean hasAccess = !SessionFactoryController.isRunningInWebContainer()
+            || ActivationKey.getInstance().hasLicenseAccess("X", formId) == FeatureRestriction.NO_RESTRICTION;
+        option.setAccessGranted(hasAccess);
       }
     }
   }
 
-  private boolean isValidForCurrentUserRole(OBUIAPPViewImplementation view) {
-    for (ViewRoleAccess access : view.getObuiappViewRoleAccessList()) {
-      final String accessRoleId = (String) DalUtil.getId(access.getRole());
-      if (access.isActive() && roleId.equals(accessRoleId)) {
-        return true;
-      }
-    }
-    return false;
-  }
+  @SuppressWarnings("unchecked")
+  private void linkProcesses() {
+    final String allowedProcessHql = "select pa.process.id " + //
+        " from ADProcessAccess pa " + //
+        "where pa.role = :role";
 
-  private void linkForms() {
-    final String formsHql = "select f, amim from ADForm f, ADModelImplementation ami, ADModelImplementationMapping amim, ADFormAccess afa "
-        + "where afa.role.id=:roleId and f.active = true and afa.specialForm = f and ami.specialForm=f and amim.modelObject=ami and amim.default=true";
-    final Query formsQry = OBDal.getInstance().getSession().createQuery(formsHql);
-    formsQry.setParameter("roleId", OBContext.getOBContext().getRole().getId());
-    // force a load
-    final List<?> list = formsQry.list();
+    final Query allowedProcessQry = OBDal.getInstance().getSession().createQuery(allowedProcessHql);
+    allowedProcessQry.setParameter("role", OBContext.getOBContext().getRole());
 
-    final Map<String, MenuOption> menuOptionsByFormId = new HashMap<String, MenuOption>();
-    for (MenuOption menuOption : menuOptions) {
-      if (menuOption.getMenu() != null && menuOption.getMenu().getSpecialForm() != null) {
+    for (String processId : (List<String>) allowedProcessQry.list()) {
+      MenuOption option = getMenuOptionByType(MenuEntryType.Process, processId);
+      if (option != null) {
         // allow access if not running in a webcontainer as then the config file can not be checked
         boolean hasAccess = !SessionFactoryController.isRunningInWebContainer()
-            || ActivationKey.getInstance().hasLicenseAccess("X",
-                menuOption.getMenu().getSpecialForm().getId()) == FeatureRestriction.NO_RESTRICTION;
-        if (hasAccess) {
-          menuOptionsByFormId.put(menuOption.getMenu().getSpecialForm().getId(), menuOption);
-        }
-      }
-    }
-
-    for (Object object : list) {
-      final Object[] values = (Object[]) object;
-      final Form form = (Form) values[0];
-      final ModelImplementationMapping mim = (ModelImplementationMapping) values[1];
-      final MenuOption menuOption = menuOptionsByFormId.get(form.getId());
-      if (menuOption != null) {
-        menuOption.setType(MenuEntryType.Form);
-        menuOption.setId(mim.getMappingName());
-        menuOption.setForm(form);
-      }
-    }
-  }
-
-  private void linkProcesses() {
-
-    // collect the valid tabs/windows
-    final String allowedProcessHql = "select p from ADProcess p, ADProcessAccess apa "
-        + "where apa.role.id=:roleId and p.active = true and apa.process = p";
-    final Query allowedProcessQry = OBDal.getInstance().getSession().createQuery(allowedProcessHql);
-    allowedProcessQry.setParameter("roleId", OBContext.getOBContext().getRole().getId());
-    final Map<String, org.openbravo.model.ad.ui.Process> allowedProcesses = new HashMap<String, org.openbravo.model.ad.ui.Process>();
-    for (Object processObj : allowedProcessQry.list()) {
-      // allow access if not running in a web container
-      boolean hasAccess = !SessionFactoryController.isRunningInWebContainer()
-          || ActivationKey.getInstance().hasLicenseAccess("P",
-              ((org.openbravo.model.ad.ui.Process) processObj).getId()) == FeatureRestriction.NO_RESTRICTION;
-      if (hasAccess) {
-        allowedProcesses.put(((org.openbravo.model.ad.ui.Process) processObj).getId(),
-            (org.openbravo.model.ad.ui.Process) processObj);
-      }
-    }
-
-    final String processHql = "select p, amim from ADProcess p, ADModelImplementation ami, ADModelImplementationMapping amim, ADProcessAccess apa "
-        + "where apa.role.id=:roleId and p.active = true and apa.process = p and ami.process=p and ami.default=true and amim.modelObject=ami and amim.default=true";
-    final Query processQry = OBDal.getInstance().getSession().createQuery(processHql);
-    processQry.setParameter("roleId", OBContext.getOBContext().getRole().getId());
-    // force a load
-    final List<?> list = processQry.list();
-
-    final Map<String, MenuOption> menuOptionsByProcessId = new HashMap<String, MenuOption>();
-    for (MenuOption menuOption : menuOptions) {
-      if (menuOption.getMenu() != null && menuOption.getMenu().getProcess() != null
-          && allowedProcesses.containsKey(menuOption.getMenu().getProcess().getId())) {
-        menuOptionsByProcessId.put(menuOption.getMenu().getProcess().getId(), menuOption);
-      }
-    }
-
-    for (Object object : list) {
-      final Object[] values = (Object[]) object;
-      final org.openbravo.model.ad.ui.Process process = (org.openbravo.model.ad.ui.Process) values[0];
-      final ModelImplementationMapping mim = (ModelImplementationMapping) values[1];
-      final MenuOption menuOption = menuOptionsByProcessId.get(process.getId());
-      if (menuOption != null) {
-        if (process.getUIPattern().equals("Standard")) {
-          menuOption.setType(MenuEntryType.Process);
-        } else if (process.isReport() || process.isJasperReport()) {
-          menuOption.setType(MenuEntryType.Report);
-          menuOption.setReport(true);
-        } else {
-          menuOption.setType(MenuEntryType.ProcessManual);
-        }
-        menuOption.setId(mim.getMappingName());
-      }
-    }
-
-    // note this logic is based on the VerticalMenu.getUrlString method:
-    // } else if (action.equals("P")) {
-    // if (isExternalService.equals("Y") && externalType.equals("PS"))
-    // strResultado.append("/utility/OpenPentaho.html?inpadProcessId=").append(adProcessId);
-    // else {
-    // try {
-    // if (MenuData.isGenericJavaProcess(this, adProcessId))
-    // strResultado.append(
-    // "/ad_actionButton/ActionButtonJava_Responser.html?inpadProcessId=").append(
-    // adProcessId);
-    // else
-    // strResultado.append("/ad_actionButton/ActionButton_Responser.html?inpadProcessId=")
-    // .append(adProcessId);
-    // } catch (final Exception e) {
-    // e.printStackTrace();
-    // strResultado.append("/ad_actionButton/ActionButton_Responser.html?inpadProcessId=")
-    // .append(adProcessId);
-    // }
-    // }
-
-    for (String processId : menuOptionsByProcessId.keySet()) {
-      final MenuOption menuOption = menuOptionsByProcessId.get(processId);
-      final org.openbravo.model.ad.ui.Process process = allowedProcesses.get(processId);
-
-      if (menuOption.getId() == null && menuOption.getMenu() != null
-          && menuOption.getMenu().getAction().equals("P")) {
-        if (process.isExternalService() != null && process.isExternalService()
-            && "PS".equals(process.getServiceType())) {
-          menuOption.setType(MenuEntryType.Process);
-          menuOption.setId("/utility/OpenPentaho.html?inpadProcessId=" + processId);
-        } else if ("S".equals(process.getUIPattern()) && !process.isJasperReport()
-            && process.getProcedure() == null) {
-          // see the MenuData.isGenericJavaProcess method
-          menuOption.setType(MenuEntryType.Process);
-          menuOption.setId("/ad_actionButton/ActionButtonJava_Responser.html");
-        } else {
-          menuOption.setType(MenuEntryType.Process);
-          menuOption.setId("/ad_actionButton/ActionButton_Responser.html");
-        }
+            || ActivationKey.getInstance().hasLicenseAccess("P", processId) == FeatureRestriction.NO_RESTRICTION;
+        option.setAccessGranted(hasAccess);
       }
     }
   }
 
   @SuppressWarnings("unchecked")
   private void linkProcessDefinition() {
-    String processHql = "select p " + //
-        " from OBUIAPP_Process p, OBUIAPP_Process_Access pa " + //
-        "where pa.obuiappProcess = p " + //
-        "  and p.active = true " + //
-        "  and pa.active = true " + //
-        "  and pa.role = :role";
+    final String processHql = "select pa.obuiappProcess.id " + //
+        " from OBUIAPP_Process_Access pa " + //
+        "where pa.role = :role" + //
+        "  and pa.active = true ";
     final Query processQry = OBDal.getInstance().getSession().createQuery(processHql);
     processQry.setParameter("role", OBContext.getOBContext().getRole());
-    final List<?> list = processQry.list();
-    // force load
 
-    final Map<String, MenuOption> menuOptionsProcessId = new HashMap<String, MenuOption>();
-    for (MenuOption menuOption : menuOptions) {
-      if (menuOption.getMenu() != null
-          && menuOption.getMenu().getOBUIAPPProcessDefinition() != null) {
-        menuOptionsProcessId.put(menuOption.getMenu().getOBUIAPPProcessDefinition().getId(),
-            menuOption);
+    for (String processId : (List<String>) processQry.list()) {
+      MenuOption option = getMenuOptionByType(MenuEntryType.ProcessDefinition, processId);
+      if (option != null) {
+        option.setAccessGranted(true);
       }
     }
+  }
 
-    for (org.openbravo.client.application.Process process : (List<org.openbravo.client.application.Process>) list) {
-      MenuOption option = menuOptionsProcessId.get(process.getId());
+  @SuppressWarnings("unchecked")
+  private void linkViewDefinition() {
+    final String processHql = "select va.viewImplementation.id " + //
+        " from obuiapp_ViewRoleAccess va " + //
+        "where va.role = :role" + //
+        "  and va.active = true ";
+    final Query processQry = OBDal.getInstance().getSession().createQuery(processHql);
+    processQry.setParameter("role", OBContext.getOBContext().getRole());
+
+    for (String processId : (List<String>) processQry.list()) {
+      MenuOption option = getMenuOptionByType(MenuEntryType.View, processId);
       if (option != null) {
-        option.setType(MenuEntryType.ProcessDefinition);
+        option.setAccessGranted(true);
       }
     }
   }
 
   @SuppressWarnings("unchecked")
   private void linkWindows() {
-    // collect the valid tabs/windows
-    final String tabsHql = "select t from ADTab t join fetch t.window w join fetch t.table, ADWindowAccess awa "
-        + "where awa.role.id=:roleId and t.active = true and w.active = true and w = awa.window and t.tabLevel = 0";
-    final Query tabsQry = OBDal.getInstance().getSession().createQuery(tabsHql);
-    tabsQry.setParameter("roleId", OBContext.getOBContext().getRole().getId());
-    // force a load
-    final List<?> list = tabsQry.list();
+    final String windowsHql = "select wa.window.id " + //
+        " from ADWindowAccess wa " + //
+        "where wa.role = :role" + //
+        "  and wa.active = true ";
+    final Query windowsQry = OBDal.getInstance().getSession().createQuery(windowsHql);
+    windowsQry.setParameter("role", OBContext.getOBContext().getRole());
 
-    final Map<String, List<MenuOption>> menuOptionsByWindowId = new HashMap<String, List<MenuOption>>();
-    for (MenuOption menuOption : menuOptions) {
-      if (menuOption.getMenu() != null && menuOption.getMenu().getWindow() != null) {
-        // allow access if not running in a web container
+    for (String windowId : (List<String>) windowsQry.list()) {
+      MenuOption option = getMenuOptionByType(MenuEntryType.Window, windowId);
+      if (option != null) {
         boolean hasAccess = !SessionFactoryController.isRunningInWebContainer()
-            || ActivationKey.getInstance().hasLicenseAccess("MW",
-                menuOption.getMenu().getWindow().getId()) == FeatureRestriction.NO_RESTRICTION;
-        if (hasAccess) {
-          final String windowId = menuOption.getMenu().getWindow().getId();
-          if (menuOptionsByWindowId.containsKey(windowId)) {
-            menuOptionsByWindowId.get(windowId).add(menuOption);
-          } else {
-            List<MenuOption> option = new ArrayList<MenuOption>();
-            option.add(menuOption);
-            menuOptionsByWindowId.put(windowId, option);
-          }
-        }
-        // make sure that the important parts are read into mem
-        for (Tab windowTab : menuOption.getMenu().getWindow().getADTabList()) {
-          Hibernate.initialize(windowTab);
-          Hibernate.initialize(windowTab.getTable());
-        }
-      }
-    }
-
-    for (Tab tab : (List<Tab>) list) {
-      final Window window = tab.getWindow();
-      final List<MenuOption> options = menuOptionsByWindowId.get(window.getId());
-      if (options != null) {
-        for (MenuOption menuOption : options) {
-          menuOption.setType(MenuEntryType.Window);
-          menuOption.setId(tab.getId());
-          menuOption.setTab(tab);
-        }
+            || ActivationKey.getInstance().hasLicenseAccess("MW", windowId) == FeatureRestriction.NO_RESTRICTION;
+        option.setAccessGranted(hasAccess);
       }
     }
   }
 
+  private MenuOption getMenuOptionByType(MenuEntryType type, String objectId) {
+    for (MenuOption option : menuOptions) {
+      if (option.getType() == type && objectId.equals(option.objectId)) {
+        return option;
+      }
+
+      // Process is special case, there are several types of processes
+      if (type == MenuEntryType.Process && objectId.equals(option.objectId)) {
+        if (option.getType() == MenuEntryType.Process || option.getType() == MenuEntryType.Report
+            || option.getType() == MenuEntryType.ProcessManual) {
+          return option;
+        }
+      }
+    }
+    return null;
+  }
+
   private void removeInvisibleNodes() {
-
     final List<MenuOption> toRemove = new ArrayList<MenuOption>();
     for (MenuOption menuOption : menuOptions) {
       if (!menuOption.isVisible()) {
@@ -386,60 +265,6 @@
     menuOptions.removeAll(toRemove);
   }
 
-  private void createInitialMenuList() {
-    Role role = OBDal.getInstance().get(Role.class, roleId);
-    final Tree tree;
-    if (role.getPrimaryTreeMenu() != null) {
-      tree = role.getPrimaryTreeMenu();
-    } else {
-      tree = OBDal.getInstance().get(Tree.class, "10");
-    }
-    menuOptions = new ArrayList<MenuOption>();
-    OBCriteria<TreeNode> treeNodes = OBDal.getInstance().createCriteria(TreeNode.class);
-    treeNodes.add(Restrictions.eq(TreeNode.PROPERTY_TREE, tree));
-    treeNodes.setFilterOnActive(false);
-
-    final Map<String, MenuOption> menuOptionsByMenuId = new HashMap<String, MenuOption>();
-    for (TreeNode treeNode : treeNodes.list()) {
-      boolean addOption = treeNode.isActive();
-      boolean inactiveSummary = false;
-
-      if (!addOption) {
-        Menu menuEntry = OBDal.getInstance().get(Menu.class, treeNode.getNode());
-        if (menuEntry != null) {
-          addOption = menuEntry.isSummaryLevel();
-          inactiveSummary = true;
-        }
-      }
-
-      if (addOption) {
-        final MenuOption menuOption = new MenuOption();
-        menuOption.setTreeNode(treeNode);
-        menuOption.setDbId(treeNode.getId());
-        Menu menuEntry = OBDal.getInstance().get(Menu.class, treeNode.getNode());
-        if (menuEntry != null && !menuEntry.isActive()) {
-          menuOption.setVisible(false);
-        }
-        menuOptions.add(menuOption);
-      }
-    }
-    linkMenus();
-
-    for (MenuOption menuOption : menuOptions) {
-      if (menuOption.getMenu() != null) {
-        menuOptionsByMenuId.put(menuOption.getMenu().getId(), menuOption);
-      }
-    }
-
-    // sort them by sequencenumber of the treenode
-    Collections.sort(menuOptions, new MenuSequenceComparator());
-
-    // now put the menuOptions in a tree structure
-    for (MenuOption menuOption : menuOptions) {
-      menuOption.setParentMenuOption(menuOptionsByMenuId);
-    }
-  }
-
   public static class MenuOption implements Serializable {
     private static final long serialVersionUID = 1L;
     private TreeNode treeNode;
@@ -455,6 +280,28 @@
     private List<MenuOption> children = new ArrayList<MenuOption>();
     private Boolean visible = null;
     private boolean showInClassicMode = false;
+    private String objectId;
+
+    private boolean accessGranted = false;
+
+    public MenuOption() {
+      // Default constructor, just sets all the defaults
+    }
+
+    public MenuOption(MenuOption option) {
+      this();
+      this.treeNode = option.treeNode;
+      this.label = option.label;
+      this.type = option.type;
+      this.id = option.id;
+      this.dbId = option.dbId;
+      this.menu = option.menu;
+      this.tab = option.tab;
+      this.form = option.form;
+      this.isReport = option.isReport;
+      this.showInClassicMode = option.showInClassicMode;
+      this.objectId = option.objectId;
+    }
 
     public boolean isSingleRecord() {
       return getTab() != null && getTab().getUIPattern().equals("SR");
@@ -508,8 +355,10 @@
         visible = localVisible;
       } else if (type == MenuEntryType.Summary) {
         visible = false;
+      } else if (type == MenuEntryType.External) {
+        visible = true;
       } else {
-        visible = true;
+        visible = accessGranted;
       }
       return visible;
     }
@@ -587,6 +436,10 @@
       this.form = form;
     }
 
+    public void setParentMenuOption(MenuOption parentMenuOption) {
+      this.parentMenuOption = parentMenuOption;
+    }
+
     public void setParentMenuOption(Map<String, MenuOption> menuOptionsByMenuId) {
       if (treeNode.getReportSet() != null) {
         parentMenuOption = menuOptionsByMenuId.get(treeNode.getReportSet());
@@ -600,9 +453,15 @@
       return menu;
     }
 
+    /**
+     * @deprecated Use instead setMenu(Menu menu, String userLanguageId)
+     */
     public void setMenu(Menu menu) {
+      setMenu(menu, OBContext.getOBContext().getLanguage().getId());
+    }
+
+    public void setMenu(Menu menu, String userLanguageId) {
       this.menu = menu;
-      final String userLanguageId = OBContext.getOBContext().getLanguage().getId();
       for (MenuTrl menuTrl : menu.getADMenuTrlList()) {
         final String trlLanguageId = (String) DalUtil.getId(menuTrl.getLanguage());
         if (trlLanguageId.equals(userLanguageId)) {
@@ -686,6 +545,14 @@
     public void setDbId(String dbId) {
       this.dbId = dbId;
     }
+
+    public void setAccessGranted(boolean accessGranted) {
+      this.accessGranted = accessGranted;
+    }
+
+    public void setObjectId(String objectId) {
+      this.objectId = objectId;
+    }
   }
 
   private static class MenuComparator implements Comparator<MenuOption> {
@@ -694,18 +561,6 @@
     public int compare(MenuOption o1, MenuOption o2) {
       return o1.getLabel().compareTo(o2.getLabel());
     }
-
-  }
-
-  private static class MenuSequenceComparator implements Comparator<MenuOption> {
-
-    @Override
-    public int compare(MenuOption o1, MenuOption o2) {
-      TreeNode tn1 = o1.getTreeNode();
-      TreeNode tn2 = o2.getTreeNode();
-      return (int) (tn1.getSequenceNumber() - tn2.getSequenceNumber());
-    }
-
   }
 
   public List<MenuOption> getSelectableMenuOptions() {
@@ -714,4 +569,13 @@
 
     return selectableMenuOptions;
   }
+
+  /**
+   * Sets globalMenuOptions. This method is intended to be used only when running out of a context;
+   * 
+   * @param globalMenuOptions
+   */
+  public void setGlobalMenuOptions(GlobalMenu globalMenuOptions) {
+    this.globalMenuOptions = globalMenuOptions;
+  }
 }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ParametersActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ParametersActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -32,6 +32,7 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
 import org.openbravo.erpCommon.utility.OBError;
+import org.openbravo.portal.PortalAccessible;
 
 /**
  * Responsible of retrieving/storing Parameter values
@@ -39,7 +40,7 @@
  * @author iperdomo
  */
 @ApplicationScoped
-public class ParametersActionHandler extends BaseActionHandler {
+public class ParametersActionHandler extends BaseActionHandler implements PortalAccessible {
   private static Logger log = Logger.getLogger(ParametersActionHandler.class);
 
   @Override
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/StorePropertyActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/StorePropertyActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -34,6 +34,7 @@
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.ad.ui.Window;
 import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.portal.PortalAccessible;
 
 /**
  * Is responsible for storing a preference.
@@ -42,7 +43,7 @@
  * @see StaticResourceComponent
  */
 @ApplicationScoped
-public class StorePropertyActionHandler extends BaseActionHandler {
+public class StorePropertyActionHandler extends BaseActionHandler implements PortalAccessible {
   private static final Logger log = Logger.getLogger(StorePropertyActionHandler.class);
 
   protected JSONObject execute(Map<String, Object> parameters, String data) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/WindowSettingsActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -137,15 +137,20 @@
       } catch (PropertyException e) {
         // do nothing, property is not set so securedProcess is false
       }
-
       if (securedProcess) {
-        OBQuery<Field> q = OBDal.getInstance().createQuery(
-            Field.class,
-            " as f where  tab.window = :window " + "and ( (column.oBUIAPPProcess is not null"
-                + " and not exists (select 1 from " + " OBUIAPP_Process_Access a"
-                + " where a.obuiappProcess = f.column.oBUIAPPProcess"
-                + " and a.role.id = :role and a.active=true))" + "or (column.process is not null))"
-                + " order by f.tab");
+        OBQuery<Field> q = OBDal
+            .getInstance()
+            .createQuery(
+                Field.class,
+                " as f where  tab.window = :window "
+                    + "and ( (column.oBUIAPPProcess is not null"
+                    + " and not exists (select 1 from "
+                    + " OBUIAPP_Process_Access a"
+                    + " where a.obuiappProcess = f.column.oBUIAPPProcess"
+                    + " and a.role.id = :role and a.active=true))"
+                    + "or (column.process is not null and "
+                    + " not exists (select 1 from ADProcessAccess a where a.process = f.column.process and "
+                    + " a.role.id = :role and a.active=true)))" + " order by f.tab");
 
         q.setNamedParameter("window", window);
         q.setNamedParameter("role", OBContext.getOBContext().getRole().getId());
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  Mallikarjun M
  ************************************************************************
@@ -20,6 +20,7 @@
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -28,8 +29,10 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
+import org.openbravo.model.ad.access.User;
 import org.openbravo.model.common.order.Order;
 import org.openbravo.model.common.order.OrderLine;
 import org.openbravo.model.pricing.pricelist.PriceListVersion;
@@ -52,7 +55,8 @@
     final DataToJsonConverter jsonConverter = new DataToJsonConverter();
     JSONObject json = null;
     try {
-      String orderId = (String) parameters.get("orderId");
+      String orderId = (String) parameters.get("recordId");
+      User currentUser = OBContext.getOBContext().getUser();
       Order objOrder = OBDal.getInstance().get(Order.class, orderId);
       Order objCloneOrder = (Order) DalUtil.copy(objOrder, false);
       BigDecimal bLineNetAmt = getLineNetAmt(orderId);
@@ -64,6 +68,11 @@
       objCloneOrder.setSalesTransaction(true);
       objCloneOrder.setDocumentNo(null);
       objCloneOrder.setSalesTransaction(objOrder.isSalesTransaction());
+      objCloneOrder.setCreationDate(new Date());
+      objCloneOrder.setUpdated(new Date());
+      objCloneOrder.setCreatedBy(currentUser);
+      objCloneOrder.setUpdatedBy(currentUser);
+
       // save the cloned order object
       OBDal.getInstance().save(objCloneOrder);
 
@@ -84,6 +93,10 @@
             || !bdPriceList.equals(BigDecimal.ZERO.setScale(bdPriceList.scale()))) {
           objCloneOrdLine.setListPrice(bdPriceList);
         }
+        objCloneOrdLine.setCreationDate(new Date());
+        objCloneOrdLine.setUpdated(new Date());
+        objCloneOrdLine.setCreatedBy(currentUser);
+        objCloneOrdLine.setUpdatedBy(currentUser);
         objCloneOrder.getOrderLineList().add(objCloneOrdLine);
         objCloneOrdLine.setSalesOrder(objCloneOrder);
       }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/AcctSchemaEventHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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 Openbravo SLU
+ * All portions are Copyright (C) 2012-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -55,7 +55,8 @@
     return entities;
   }
 
-  public void onUpdate(@Observes EntityUpdateEvent event) {
+  public void onUpdate(@Observes
+  EntityUpdateEvent event) {
     if (!isValidEvent(event)) {
       return;
     }
@@ -152,21 +153,25 @@
     elementValueQry.setFetchSize(1000);
 
     ScrollableResults elementvalues = elementValueQry.scroll(ScrollMode.FORWARD_ONLY);
-    // TODO: Review with Martin to see if flush is permitted in handlers
-    // int i = 0;
-    while (elementvalues.next()) {
-      ElementValue elementValue = (ElementValue) elementvalues.get(0);
-      boolean isCredit = getAccountSign(elementValue.getAccountType(), assetPositive,
-          liabilityPositive, ownersEquityPositive, expensePositive, revenuePositive);
-      if (!ACCOUNTTYPE_MEMO.equals(elementValue.getAccountType())) {
-        elementValue.setAccountSign(isCredit ? ACCOUNTSIGN_CREDIT : ACCOUNTSIGN_DEBIT);
+    try {
+      // TODO: Review with Martin to see if flush is permitted in handlers
+      // int i = 0;
+      while (elementvalues.next()) {
+        ElementValue elementValue = (ElementValue) elementvalues.get(0);
+        boolean isCredit = getAccountSign(elementValue.getAccountType(), assetPositive,
+            liabilityPositive, ownersEquityPositive, expensePositive, revenuePositive);
+        if (!ACCOUNTTYPE_MEMO.equals(elementValue.getAccountType())) {
+          elementValue.setAccountSign(isCredit ? ACCOUNTSIGN_CREDIT : ACCOUNTSIGN_DEBIT);
+        }
+        // if ((i % 100) == 0) {
+        // OBDal.getInstance().flush();
+        // OBDal.getInstance().getSession().clear();
+        // element = OBDal.getInstance().get(Element.class, element.getId());
+        // }
+        // i++;
       }
-      // if ((i % 100) == 0) {
-      // OBDal.getInstance().flush();
-      // OBDal.getInstance().getSession().clear();
-      // element = OBDal.getInstance().get(Element.class, element.getId());
-      // }
-      // i++;
+    } finally {
+      elementvalues.close();
     }
   }
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/ElementValueEventHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -193,7 +193,7 @@
     obc.setFilterOnReadableClients(false);
     obc.setFilterOnReadableOrganization(false);
     List<TreeNode> nodes = obc.list();
-    if (nodes.size() > 0) {
+    if (nodes.size() > 0 && obc.list().get(0).getSequenceNumber() != null) {
       return obc.list().get(0).getSequenceNumber() + 10l;
     } else {
       return 10l;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/MenuCacheHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -0,0 +1,104 @@
+/*
+ *************************************************************************
+ * 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) 2013 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.client.application.event;
+
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+
+import org.openbravo.base.model.Entity;
+import org.openbravo.base.model.ModelProvider;
+import org.openbravo.client.application.GlobalMenu;
+import org.openbravo.client.kernel.event.EntityDeleteEvent;
+import org.openbravo.client.kernel.event.EntityNewEvent;
+import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
+import org.openbravo.client.kernel.event.EntityUpdateEvent;
+
+/**
+ * EntityPersistenceEventObserver to listen to modifications in entities that are used to compose
+ * the menu. In case they are modified cached global menu is invalidated to generate it again.
+ * 
+ * @see GlobalMenu
+ * 
+ * @author alostale
+ * 
+ */
+public class MenuCacheHandler extends EntityPersistenceEventObserver {
+  @Inject
+  private GlobalMenu menu;
+
+  private static final String MENU_TABLE_ID = "116";
+  private static final String TREENODE_TABLE_ID = "289";
+
+  private static final String WINDOW_TABLE_ID = "105";
+  private static final String VIEWDEFINITION_TABLE_ID = "79127717F4514B459D9014C91E793CE9";
+  private static final String FORM_TABLE_ID = "376";
+  private static final String PROCESS_TABLE_ID = "284";
+  private static final String PROCESSDEFINITION_TABLE_ID = "FF80818132D7FB620132D8129D1A0028";
+
+  private static final String WINDOW_ACCESS_TABLE_ID = "201";
+  private static final String VIEWDEFINITION_ACCESS_TABLE_ID = "E6F29F8A30BC4603B1D1195051C4F3A6";
+  private static final String FORM_ACCESS_TABLE_ID = "378";
+  private static final String PROCESS_ACCESS_TABLE_ID = "197";
+  private static final String PROCESSDEFINITION_ACCESS_TABLE_ID = "FF80818132D85DB50132D860924E0004";
+
+  private static Entity[] entities = {
+      ModelProvider.getInstance().getEntityByTableId(MENU_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(TREENODE_TABLE_ID),
+
+      ModelProvider.getInstance().getEntityByTableId(WINDOW_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(VIEWDEFINITION_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(FORM_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(PROCESS_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(PROCESSDEFINITION_TABLE_ID),
+
+      ModelProvider.getInstance().getEntityByTableId(WINDOW_ACCESS_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(VIEWDEFINITION_ACCESS_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(FORM_ACCESS_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(PROCESS_ACCESS_TABLE_ID),
+      ModelProvider.getInstance().getEntityByTableId(PROCESSDEFINITION_ACCESS_TABLE_ID) };
+
+  public void onNew(@Observes EntityNewEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    menu.invalidateCache();
+  }
+
+  public void onUpdate(@Observes EntityUpdateEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    menu.invalidateCache();
+  }
+
+  public void onDelete(@Observes EntityDeleteEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    menu.invalidateCache();
+  }
+
+  @Override
+  protected Entity[] getObservedEntities() {
+
+    return entities;
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableEventHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -0,0 +1,80 @@
+/*
+ *************************************************************************
+ * 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) 2013 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.client.application.event;
+
+import javax.enterprise.event.Observes;
+
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.model.Entity;
+import org.openbravo.base.model.ModelProvider;
+import org.openbravo.base.model.Property;
+import org.openbravo.client.kernel.event.EntityNewEvent;
+import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
+import org.openbravo.client.kernel.event.EntityUpdateEvent;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.ad.datamodel.Table;
+import org.openbravo.service.db.DalConnectionProvider;
+
+/**
+ * Checks that the java class name in table definition does not contain spaces
+ * 
+ * @author Shankar
+ */
+public class TableEventHandler extends EntityPersistenceEventObserver {
+  private static Entity[] entities = { ModelProvider.getInstance().getEntity(Table.ENTITY_NAME) };
+
+  public void onUpdate(@Observes
+  EntityUpdateEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    Property javaClass = entities[0].getProperty(Table.PROPERTY_JAVACLASSNAME);
+    String javaClassName = (String) event.getCurrentState(javaClass);
+    checkJavaClassName(javaClassName);
+
+  }
+
+  public void onNew(@Observes
+  EntityNewEvent event) {
+    if (!isValidEvent(event)) {
+      return;
+    }
+    Property javaClass = entities[0].getProperty(Table.PROPERTY_JAVACLASSNAME);
+    String javaClassName = (String) event.getCurrentState(javaClass);
+    checkJavaClassName(javaClassName);
+  }
+
+  @Override
+  protected Entity[] getObservedEntities() {
+    // TODO Auto-generated method stub
+    return entities;
+  }
+
+  private Boolean checkJavaClassName(String javaClassName) {
+    if (javaClassName != null && javaClassName.contains(" ")) {
+      String language = OBContext.getOBContext().getLanguage().getLanguage();
+      ConnectionProvider conn = new DalConnectionProvider(false);
+      throw new OBException(Utility.messageBD(conn, "JavaClassShouldNotContainSpaces", language));
+    }
+    return true;
+  }
+}
\ No newline at end of file
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/navigationbarcomponents/UserInfoWidgetActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -57,6 +57,7 @@
 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;
@@ -70,7 +71,7 @@
  * @see StaticResourceComponent
  */
 @ApplicationScoped
-public class UserInfoWidgetActionHandler extends BaseActionHandler {
+public class UserInfoWidgetActionHandler extends BaseActionHandler implements PortalAccessible {
 
   /*
    * (non-Javadoc)
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/process/BaseProcessActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/process/BaseProcessActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -35,6 +35,7 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.database.SessionInfo;
 import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
 import org.openbravo.erpCommon.utility.PropertyException;
@@ -84,6 +85,11 @@
         }
       }
 
+      // Set information for audit trail
+      SessionInfo.setProcessType("PD");
+      SessionInfo.setProcessId(processId);
+      SessionInfo.setDBSessionInfo(OBDal.getInstance().getConnection(false));
+
       return doExecute(parameters, content);
 
     } catch (Exception e) {
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl	Thu Jun 27 10:02:33 2013 +0200
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2011 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -24,15 +24,24 @@
   <#if data.whereClause != "">
   whereClause: '${data.whereClause?js_string}',
   </#if>
+  <#if data.whereClauseSQL != "">
+  sqlWhereClause: '${data.whereClauseSQL?js_string}',
+  </#if>  
   <#if data.orderByClause != "">
   orderByClause: '${data.orderByClause?js_string}',
   </#if>
+  <#if data.orderByClauseSQL != "">
+  sqlOrderByClause: '${data.orderByClauseSQL?js_string}',
+  </#if>
   <#if data.sortField != "">
   sortField: '${data.sortField?js_string}',
   </#if>
   <#if data.filterClause != "">
   filterClause: '${data.filterClause?js_string}',
   </#if>
+  <#if data.filterClauseSQL != "">
+  sqlFilterClause: '${data.filterClauseSQL?js_string}',
+  </#if>
   <#if data.filterName != "">
   filterName: '${data.filterName?js_string}',
   </#if>
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-view-tab.js.ftl	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-view-tab.js.ftl	Thu Jun 27 10:02:33 2013 +0200
@@ -57,12 +57,14 @@
 <@compress single_line=true>
       inpTabId: '${tabComponent.tabId}',
       inpwindowId: '${tabComponent.windowId}',
-      inpTableId: '${tabComponent.tableId?js_string}',
-      inpkeyColumnId: '${tabComponent.keyProperty.columnId?js_string}',
-      keyProperty: '${tabComponent.keyProperty.name?js_string}',
-      inpKeyName: '${tabComponent.keyInpName?js_string}',
-      keyColumnName: '${tabComponent.keyColumnName?js_string}',
-      keyPropertyType: '${tabComponent.keyPropertyType?js_string}'      
+      inpTableId: '${tabComponent.tableId?js_string}'
+      <#if !tabComponent.dataSourceTable>
+        , inpkeyColumnId: '${tabComponent.keyProperty.columnId?js_string}',
+        keyProperty: '${tabComponent.keyProperty.name?js_string}',
+        inpKeyName: '${tabComponent.keyInpName?js_string}',
+        keyColumnName: '${tabComponent.keyColumnName?js_string}',
+        keyPropertyType: '${tabComponent.keyPropertyType?js_string}'
+      </#if>
 </@compress>
     },
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl	Thu Jun 27 10:02:33 2013 +0200
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -59,12 +59,14 @@
 <@compress single_line=true>
       inpTabId: '${tabComponent.tabId}',
       inpwindowId: '${tabComponent.windowId}',
-      inpTableId: '${tabComponent.tableId?js_string}',
-      inpkeyColumnId: '${tabComponent.keyColumnName?js_string}',
-      keyProperty: '${tabComponent.keyProperty.name?js_string}',
-      inpKeyName: '${tabComponent.keyInpName?js_string}',
-      keyColumnName: '${tabComponent.keyColumnName?js_string}',
-      keyPropertyType: '${tabComponent.keyPropertyType?js_string}'      
+      inpTableId: '${tabComponent.tableId?js_string}'
+      <#if !tabComponent.dataSourceTable>
+        ,inpkeyColumnId: '${tabComponent.keyColumnName?js_string}',
+        keyProperty: '${tabComponent.keyProperty.name?js_string}',
+        inpKeyName: '${tabComponent.keyInpName?js_string}',
+        keyColumnName: '${tabComponent.keyColumnName?js_string}',
+        keyPropertyType: '${tabComponent.keyPropertyType?js_string}'
+      </#if>
 </@compress>
     },
      
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -49,6 +49,7 @@
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.base.structure.ClientEnabled;
 import org.openbravo.base.structure.OrganizationEnabled;
+import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.client.application.DynamicExpressionParser;
 import org.openbravo.client.application.Note;
 import org.openbravo.client.application.window.servlet.CalloutHttpServletResponse;
@@ -138,6 +139,9 @@
       List<String> jsExcuteCode = new ArrayList<String>();
       Map<String, Object> hiddenInputs = new HashMap<String, Object>();
 
+      boolean dataSourceBasedTable = ApplicationConstants.DATASOURCEBASEDTABLE.equals(tab
+          .getTable().getDataOriginType());
+
       log.debug("Form Initialization Component Execution. Tab Name: " + tab.getWindow().getName()
           + "." + tab.getName() + " Tab Id:" + tab.getId());
       log.debug("Execution mode: " + mode);
@@ -147,7 +151,10 @@
       if (changedColumn != null) {
         log.debug("Changed field: " + changedColumn);
       }
-      if (rowId != null && !rowId.equals("null")) {
+
+      // If the table is based in a datasource there is no BaseOBObject associated to it, don't try
+      // to retrieve the row
+      if (!dataSourceBasedTable && rowId != null && !rowId.equals("null")) {
         row = OBDal.getInstance().get(tab.getTable().getName(), rowId);
       }
       JSONObject jsContent = new JSONObject();
@@ -162,43 +169,48 @@
       if (jsContent.has("_visibleProperties")) {
         visibleProperties = convertJSONArray(jsContent.getJSONArray("_visibleProperties"));
       }
-      // create the row from the json content then
-      if (row == null) {
-        final JsonToDataConverter fromJsonConverter = OBProvider.getInstance().get(
-            JsonToDataConverter.class);
 
-        // create a new json object using property names:
-        final JSONObject convertedJson = new JSONObject();
-        final Entity entity = ModelProvider.getInstance().getEntityByTableName(
-            tab.getTable().getDBTableName());
-        for (Property property : entity.getProperties()) {
-          if (property.getColumnName() != null) {
-            final String inpName = "inp" + Sqlc.TransformaNombreColumna(property.getColumnName());
-            if (jsContent.has(inpName)) {
-              final UIDefinition uiDef = UIDefinitionController.getInstance().getUIDefinition(
-                  property.getColumnId());
-              Object jsonValue = jsContent.get(inpName);
-              if (jsonValue instanceof String) {
-                jsonValue = uiDef.createFromClassicString((String) jsonValue);
-              }
-              convertedJson.put(property.getName(), jsonValue);
-              if (property.isId()) {
-                setSessionValue(tab.getWindow().getId() + "|" + property.getColumnName(), jsonValue);
+      // If the table is based in a datasource, don't try to create a BaseOBObject
+      if (!dataSourceBasedTable) {
+        // create the row from the json content then
+        if (row == null) {
+          final JsonToDataConverter fromJsonConverter = OBProvider.getInstance().get(
+              JsonToDataConverter.class);
+
+          // create a new json object using property names:
+          final JSONObject convertedJson = new JSONObject();
+          final Entity entity = ModelProvider.getInstance().getEntityByTableName(
+              tab.getTable().getDBTableName());
+          for (Property property : entity.getProperties()) {
+            if (property.getColumnName() != null) {
+              final String inpName = "inp" + Sqlc.TransformaNombreColumna(property.getColumnName());
+              if (jsContent.has(inpName)) {
+                final UIDefinition uiDef = UIDefinitionController.getInstance().getUIDefinition(
+                    property.getColumnId());
+                Object jsonValue = jsContent.get(inpName);
+                if (jsonValue instanceof String) {
+                  jsonValue = uiDef.createFromClassicString((String) jsonValue);
+                }
+                convertedJson.put(property.getName(), jsonValue);
+                if (property.isId()) {
+                  setSessionValue(tab.getWindow().getId() + "|" + property.getColumnName(),
+                      jsonValue);
+                }
               }
             }
           }
-        }
-        // remove the id as it must be a new record
-        convertedJson.remove("id");
-        convertedJson.put(JsonConstants.ENTITYNAME, entity.getName());
-        row = fromJsonConverter.toBaseOBObject(convertedJson);
-        row.setNewOBObject(true);
-      } else {
-        final Entity entity = ModelProvider.getInstance().getEntityByTableName(
-            tab.getTable().getDBTableName());
-        for (Property property : entity.getProperties()) {
-          if (property.isId()) {
-            setSessionValue(tab.getWindow().getId() + "|" + property.getColumnName(), row.getId());
+          // remove the id as it must be a new record
+          convertedJson.remove("id");
+          convertedJson.put(JsonConstants.ENTITYNAME, entity.getName());
+          row = fromJsonConverter.toBaseOBObject(convertedJson);
+          row.setNewOBObject(true);
+        } else {
+          final Entity entity = ModelProvider.getInstance().getEntityByTableName(
+              tab.getTable().getDBTableName());
+          for (Property property : entity.getProperties()) {
+            if (property.isId()) {
+              setSessionValue(tab.getWindow().getId() + "|" + property.getColumnName(), row.getId());
+            }
           }
         }
       }
@@ -206,7 +218,11 @@
       // First the parent record is retrieved and the session variables for the parent records are
       // set
       long t1 = System.currentTimeMillis();
-      parentRecord = setSessionVariablesInParent(mode, tab, row, parentId);
+      // If the table is based in a datasource, don't try to retrieve the parent record (the row is
+      // null because datasource based tables do not have BaseOBObjects)
+      if (!dataSourceBasedTable) {
+        parentRecord = setSessionVariablesInParent(mode, tab, row, parentId);
+      }
 
       // We also need to set the current record values in the request
       long t2 = System.currentTimeMillis();
@@ -790,8 +806,13 @@
 
   private void setValuesInRequest(String mode, Tab tab, BaseOBObject row, JSONObject jsContent) {
 
+    boolean dataSourceBasedTable = ApplicationConstants.DATASOURCEBASEDTABLE.equals(tab.getTable()
+        .getDataOriginType());
+
     List<Field> fields = getADFieldList(tab.getId());
-    if (mode.equals("EDIT")) {
+    // If the table is based on a datasource it is not possible to initialize the values from the
+    // database
+    if (mode.equals("EDIT") && !dataSourceBasedTable) {
       // In EDIT mode we initialize them from the database
       for (Field field : fields) {
         if (field.getColumn() == null) {
@@ -1056,7 +1077,7 @@
         }
       }
     } catch (Exception e) {
-      log.error("Couldn't get the value for column " + columnName);
+      log.error("Couldn't get the value for column " + columnName, e);
     }
   }
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ImagesActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/ImagesActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -33,6 +33,7 @@
 import org.openbravo.model.ad.datamodel.Table;
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.ad.utility.Image;
+import org.openbravo.portal.PortalAccessible;
 
 /**
  * This ActionHandler implements the DELETE and GETSIZE actions which are used by the ImageBLOB
@@ -46,7 +47,7 @@
  * MIME type if it hasn't yet been computed
  * 
  */
-public class ImagesActionHandler extends BaseActionHandler {
+public class ImagesActionHandler extends BaseActionHandler implements PortalAccessible {
 
   private static final Logger log = Logger.getLogger(ImagesActionHandler.class);
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewFieldHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -67,7 +67,6 @@
   private static final String IMAGEBLOB_AD_REFERENCE_ID = "4AA6C3BE9D3B4D84A3B80489505A23E5";
 
   private static final String AUDIT_GROUP_ID = "1000100001";
-  private static final String MORE_INFO_GROUP_ID = "402880E72F1C15A5012F1C7AA98B00E8";
 
   private Tab tab;
   private List<String> statusBarFields;
@@ -1564,11 +1563,7 @@
     }
 
     public void setFieldGroup(FieldGroup fieldGroup) {
-      if (AUDIT_GROUP_ID.equals(fieldGroup.getId())
-          || MORE_INFO_GROUP_ID.equals(fieldGroup.getId())) {
-        expanded = false;
-      }
-
+      expanded = (fieldGroup.isCollapsed() == null) ? true : !fieldGroup.isCollapsed();
       this.fieldGroup = fieldGroup;
     }
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -83,11 +83,24 @@
     return "";
   }
 
+  public String getWhereClauseSQL() {
+    if (tab.getSQLWhereClause() != null) {
+      return tab.getSQLWhereClause();
+    }
+    return "";
+  }
+
   public String getOrderByClause() {
     if (tab.getHqlorderbyclause() != null) {
       return tab.getHqlorderbyclause();
     }
+    return "";
+  }
 
+  public String getOrderByClauseSQL() {
+    if (tab.getSQLOrderByClause() != null) {
+      return tab.getSQLOrderByClause();
+    }
     return "";
   }
 
@@ -140,6 +153,13 @@
     return addTransactionalFilter("");
   }
 
+  public String getFilterClauseSQL() {
+    if (tab.getFilterClause() != null) {
+      return tab.getFilterClause();
+    }
+    return "";
+  }
+
   public String getFilterName() {
     String filterName = "";
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewTab.java	Thu Jun 27 10:02:33 2013 +0200
@@ -31,6 +31,7 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -46,6 +47,7 @@
 import org.openbravo.client.kernel.reference.UIDefinitionController;
 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.data.Sqlc;
 import org.openbravo.erpCommon.obps.ActivationKey;
@@ -282,6 +284,15 @@
     // force a load all the columns of the table
     getTab().getTable().getADColumnList().size();
 
+    // check at least one field is visible in grid view, does not stop the execution
+    OBCriteria<Field> fieldCriteria = OBDal.getInstance().createCriteria(Field.class);
+    fieldCriteria.add(Restrictions.eq(Field.PROPERTY_TAB, getTab()));
+    fieldCriteria.add(Restrictions.eq(Field.PROPERTY_SHOWINGRIDVIEW, true));
+    if (fieldCriteria.count() == 0) {
+      log.error("No Fields are visible in grid view for Tab " + tab.getWindow().getName() + " - "
+          + tab.getName());
+    }
+
     final OBViewGridComponent viewGridComponent = createComponent(OBViewGridComponent.class);
     viewGridComponent.setParameters(getParameters());
     viewGridComponent.setTab(tab);
@@ -403,7 +414,13 @@
   }
 
   public String getDataSourceId() {
-    return tab.getTable().getName();
+    String dataSourceId = null;
+    if (ApplicationConstants.TABLEBASEDTABLE.equals(tab.getTable().getDataOriginType())) {
+      dataSourceId = tab.getTable().getName();
+    } else {
+      dataSourceId = tab.getTable().getObserdsDatasource().getId();
+    }
+    return dataSourceId;
   }
 
   public String getSelectionFunction() {
@@ -438,6 +455,14 @@
     throw new IllegalStateException("Entity " + getEntityName() + " does not have an id property");
   }
 
+  public boolean isDataSourceTable() {
+    if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(this.tab.getTable().getDataOriginType())) {
+      return true;
+    } else {
+      return false;
+    }
+  }
+
   public String getKeyPropertyType() {
     return UIDefinitionController.getInstance().getUIDefinition(getKeyProperty().getColumnId())
         .getName();
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js	Thu Jun 27 10:02:33 2013 +0200
@@ -126,6 +126,14 @@
     this.Super('initWidget', arguments);
   },
 
+  destroy: function () {
+    if (this.contextMenu) {
+      this.contextMenu.destroy();
+      this.contextMenu = null;
+    }
+    this.Super('destroy', arguments);
+  },
+
   setDataSource: function (ds) {
     this.Super('setDataSource', [ds, this.gridFields]);
     // Some properties need to be set when the datasource is loaded to avoid errors when form is
@@ -173,6 +181,36 @@
     requestProperties.params[OB.Constants.WHERE_PARAMETER] = this.getFilterClause();
   },
 
+  getAlertsWithFilterClause: function (alertRule) {
+    var filterClause, alerts = alertRule.alerts.split(','),
+        alertsNum = alerts.length,
+        i, chunksOfAlerts = [],
+        j, chunkSize = 1000;
+    filterClause = ' and (e.alertRule.id != \'' + alertRule.alertRuleId + '\'';
+
+    if (alertsNum <= chunkSize) {
+      filterClause += ' or e.id in (' + alertRule.alerts + '))';
+      return filterClause;
+    }
+
+    // there are more than 1000 alerts to include in the where clause, Oracle doesn't
+    // support it, so let's split them in chunks with <=1000 elements each
+    for (i = 0; i < alertsNum; i += chunkSize) {
+      chunksOfAlerts.push(alerts.slice(i, i + chunkSize));
+    }
+
+    for (i = 0; i < chunksOfAlerts.length; i++) {
+      filterClause += ' or e.id in (';
+      for (j = 0; j < chunksOfAlerts[i].length; j++) {
+        filterClause += j > 0 ? ',' : '';
+        filterClause += chunksOfAlerts[i][j];
+      }
+      filterClause += ')';
+    }
+    filterClause += ')';
+    return filterClause;
+  },
+
   getFilterClause: function () {
     var i, filterClause = '',
         alertRuleIds = '',
@@ -188,8 +226,7 @@
       // alerts are of a different alertRule or only the alerts predefined
       // this only happens if the alertRule has an SQL filter expression defined
       if (OB.AlertManagement.alertRules[i].alerts) {
-        filterClause += ' and (e.alertRule.id != \'' + OB.AlertManagement.alertRules[i].alertRuleId + '\'';
-        filterClause += ' or e.id in (' + OB.AlertManagement.alertRules[i].alerts + '))';
+        filterClause += this.getAlertsWithFilterClause(OB.AlertManagement.alertRules[i]);
       }
     }
     if (alertRuleIds !== '') {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-management-view.js	Thu Jun 27 10:02:33 2013 +0200
@@ -195,6 +195,52 @@
     this.sectionStack.addSection(this.sections.Solved);
   },
 
+  destroy: function () {
+    if (this.grids) {
+      if (this.grids.New) {
+        this.grids.New.destroy();
+        this.grids.New = null;
+      }
+      if (this.grids.Acknowledged) {
+        this.grids.Acknowledged.destroy();
+        this.grids.Acknowledged = null;
+      }
+      if (this.grids.Suppressed) {
+        this.grids.Suppressed.destroy();
+        this.grids.Suppressed = null;
+      }
+      if (this.grids.Solved) {
+        this.grids.Solved.destroy();
+        this.grids.Solved = null;
+      }
+    }
+    if (this.NewAcknowledged) {
+      this.NewAcknowledged.destroy();
+      this.NewAcknowledged = null;
+    }
+    if (this.NewSuppressed) {
+      this.NewSuppressed.destroy();
+      this.NewSuppressed = null;
+    }
+    if (this.AcknowledgedNew) {
+      this.AcknowledgedNew.destroy();
+      this.AcknowledgedNew = null;
+    }
+    if (this.AcknowledgedSuppressed) {
+      this.AcknowledgedSuppressed.destroy();
+      this.AcknowledgedSuppressed = null;
+    }
+    if (this.SuppressedNew) {
+      this.SuppressedNew.destroy();
+      this.SuppressedNew = null;
+    }
+    if (this.SuppressedAcknowledged) {
+      this.SuppressedAcknowledged.destroy();
+      this.SuppressedAcknowledged = null;
+    }
+    this.Super('destroy', arguments);
+  },
+
   moveToStatus: function (alertIDs, oldStatus, newStatus) {
     var post = {
       'eventType': 'moveToStatus',
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js	Thu Jun 27 10:02:33 2013 +0200
@@ -350,17 +350,11 @@
   },
 
   getCriteria: function (criteria) {
-    var startTime, endTime, legend, i, orPart = {
+    var startTime, endTime, legend, i, startDateCriteria, middleDateCriteria, endDateCriteria, dateCriteriaOrPart, orPart = {
       operator: 'or',
       criteria: []
     };
 
-    if (this.month === 0) {
-      startTime = new Date(this.year - 1, 11, 23, 0, 0, 0);
-    } else {
-      startTime = new Date(this.year, this.month - 1, 23, 0, 0, 0);
-    }
-
     if (!criteria || !criteria.operator) {
       criteria = {
         _constructor: "AdvancedCriteria",
@@ -369,22 +363,77 @@
     }
     criteria.criteria = criteria.criteria || [];
 
+    if (this.month === 0) {
+      startTime = new Date(this.year - 1, 11, 23, 0, 0, 0);
+    } else {
+      startTime = new Date(this.year, this.month - 1, 23, 0, 0, 0);
+    }
+
     // add the date criteria
     if (this.month === 11) {
       endTime = new Date(this.year + 1, 0, 7, 0, 0, 0);
     } else {
       endTime = new Date(this.year, this.month + 1, 7, 0, 0, 0);
     }
-    criteria.criteria.push({
+
+    // To set an 'OR' logic for the following three cases. If at least one of them match, the event will be shown.
+    dateCriteriaOrPart = {
+      operator: 'or',
+      criteria: []
+    };
+
+    // To show events that starts in the current month
+    startDateCriteria = {
+      operator: "and",
+      criteria: []
+    };
+    startDateCriteria.criteria.push({
       fieldName: this.startDateField,
       operator: 'greaterOrEqual',
       value: startTime
     });
-    criteria.criteria.push({
-      fieldName: this.endDateField,
+    startDateCriteria.criteria.push({
+      fieldName: this.startDateField,
       operator: 'lessThan',
       value: endTime
     });
+    dateCriteriaOrPart.criteria.push(startDateCriteria);
+
+    // To show events that starts before current month and ends after current month
+    middleDateCriteria = {
+      operator: "and",
+      criteria: []
+    };
+    middleDateCriteria.criteria.push({
+      fieldName: this.startDateField,
+      operator: 'lessThan',
+      value: startTime
+    });
+    middleDateCriteria.criteria.push({
+      fieldName: this.endDateField,
+      operator: 'greaterThan',
+      value: endTime
+    });
+    dateCriteriaOrPart.criteria.push(middleDateCriteria);
+
+    // To show events that ends in the current month
+    endDateCriteria = {
+      operator: "and",
+      criteria: []
+    };
+    endDateCriteria.criteria.push({
+      fieldName: this.endDateField,
+      operator: 'greaterThan',
+      value: startTime
+    });
+    endDateCriteria.criteria.push({
+      fieldName: this.endDateField,
+      operator: 'lessOrEqual',
+      value: endTime
+    });
+    dateCriteriaOrPart.criteria.push(endDateCriteria);
+
+    criteria.criteria.push(dateCriteriaOrPart);
 
     if (this.multiCalendar) {
       legend = this.multiCalendar.leftControls.getLegendValueMap();
@@ -459,10 +508,10 @@
         if (!calendar.isInitialScrollAlreadyBeenSet && tabNum <= 1) {
           calendar.isInitialScrollAlreadyBeenSet = true;
           // Timeout to allow new selected tab grid be fully loaded
-          if (calendar.initialScrollTo) {
+          if (calendar.initialScrollTime) {
             setTimeout(function () {
               try {
-                calendar.scrollToTime(calendar.initialScrollTo);
+                calendar.scrollToTime(calendar.initialScrollTime);
               } catch (e) {}
             }, 100);
           }
@@ -471,10 +520,10 @@
       };
     }
     // Timeout to allow the tab grid be fully loaded
-    if (calendar.initialScrollTo) {
+    if (calendar.initialScrollTime) {
       setTimeout(function () {
         try {
-          calendar.scrollToTime(calendar.initialScrollTo);
+          calendar.scrollToTime(calendar.initialScrollTime);
         } catch (e) {}
       }, 100);
     }
@@ -486,7 +535,13 @@
   },
 
   filterData: function (criteria) {
-    return this.Super('filterData', [this.getCriteria(criteria)]);
+    var newCriteria, ret;
+    newCriteria = this.getCriteria(criteria);
+    ret = this.Super('filterData', [newCriteria]);
+    if (this.doPreFilterData) {
+      this.doPreFilterData(newCriteria);
+    }
+    return ret;
   },
 
   // read the dates for the current month
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js	Thu Jun 27 10:02:33 2013 +0200
@@ -594,6 +594,9 @@
         }
       }
     }
+    if (typeof this.calendarProps.customParseCalendarData === 'function') {
+      calendarData = this.calendarProps.customParseCalendarData(calendarData);
+    }
 
     return calendarData;
   },
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-date.js	Thu Jun 27 10:02:33 2013 +0200
@@ -153,6 +153,18 @@
         break;
       }
     }
+
+    if (partIndex === 0 && parts[partIndex] !== '') {
+      // Only one or two digits have been entered, they represent the number of days
+      if (this.dateParts[1] === 'D') {
+        parts[1] = parts[0];
+        parts[0] = '';
+      } else if (this.dateParts[2] === 'D') {
+        parts[2] = parts[0];
+        parts[0] = '';
+      }
+    }
+
     for (i = 0; i < 3; i++) {
       if ((parts[i] === '0' || parts[i] === '00') && (this.dateParts[i] === 'D' || this.dateParts[i] === 'M')) {
         return str;
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js	Thu Jun 27 10:02:33 2013 +0200
@@ -58,8 +58,8 @@
 
     // the data from the datasource will contain the id and the identifier
     // the value for the filter and the display are the same: the identifier
-    this.displayField = OB.Constants.IDENTIFIER;
-    this.valueField = OB.Constants.IDENTIFIER;
+    this.displayField = this.criteriaDisplayField || OB.Constants.IDENTIFIER;
+    this.valueField = this.criteriaDisplayField || OB.Constants.IDENTIFIER;
 
     this.pickListProperties = {
 
@@ -82,12 +82,12 @@
         var i, values = this.formItem.getValue();
         if (values.length) {
           for (i = 0; i < values.length; i++) {
-            if (record[OB.Constants.IDENTIFIER] === values[i]) {
+            if (record[me.displayField] === values[i]) {
               return true;
             }
           }
         }
-        return record[OB.Constants.IDENTIFIER] === values;
+        return record[me.displayField] === values;
       },
 
       // override data arrived to prevent the first entry from being
@@ -109,7 +109,7 @@
           }
           for (rowNum = startRow; rowNum < (endRow + 1); rowNum++) {
             record = this.getRecord(rowNum);
-            if (record && values.contains(record[OB.Constants.IDENTIFIER])) {
+            if (record && values.contains(record[me.displayField])) {
               this.selectRecord(record, true);
             }
           }
@@ -122,11 +122,7 @@
       requestProperties: {
         params: {
           // distinct forces the distinct query on the server side
-          _distinct: gridField.valueField || gridField.name,
-          // identifier is not listed here as it is always send, actually
-          // the id is also always send, but setting _selectedProperties
-          // prevents other fields from coming over
-          _selectedProperties: 'id'
+          _distinct: gridField.valueField || gridField.name
         }
       },
       fields: this.pickListFields
@@ -240,7 +236,7 @@
   },
 
   canEditCriterion: function (criterion) {
-    return criterion && criterion.fieldName === this.name;
+    return criterion && (criterion.fieldName === this.name || criterion.fieldName === this.criteriaField);
   },
 
   getCriterion: function (textMatchStyle) {
@@ -273,10 +269,26 @@
 
   setCriterion: function (criterion) {
     var i, value, values = [],
+        operator, operators, valueSet = false,
         criteria = criterion ? criterion.criteria : null;
     if (criteria && criteria.length && criterion.operator === 'or') {
       for (i = 0; i < criteria.length; i++) {
-        values.push(criteria[i].value);
+        operators = isc.DataSource.getSearchOperators();
+        //handles case where column filter symbols are removed. Refer Issue https://issues.openbravo.com/view.php?id=23925
+        if (criteria[i].operator !== "iContains" && criteria[i].operator !== "contains" && criteria[i].operator !== "regexp") {
+          for (operator in operators) {
+            if (operators.hasOwnProperty(operator)) {
+              if (operators[operator].ID === criteria[i].operator && operators[operator].symbol && criteria[i].value && criteria[i].value.indexOf(operators[operator].symbol) === -1) {
+                values.push(operators[operator].symbol + criteria[i].value);
+                valueSet = true;
+              }
+            }
+          }
+        }
+        if (valueSet === false) {
+          values.push(criteria[i].value);
+        }
+        valueSet = false;
       }
       this.setValue(values);
     } else {
@@ -291,7 +303,7 @@
   // see also the setValuesAsCriteria in ob-grid-js which again translates
   // back
   getCriteriaFieldName: function () {
-    return this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER;
+    return this.criteriaField || this.name + OB.Constants.FIELDSEPARATOR + OB.Constants.IDENTIFIER;
   },
 
   // solve a small bug in the value expressions
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk.js	Thu Jun 27 10:02:33 2013 +0200
@@ -40,5 +40,12 @@
       form.grid.setEditValue(form.grid.getEditRow(), identifierFieldName, display);
     }
     return this.Super('changed', arguments);
+  },
+
+  setValue: function (val) {
+    if (this._clearingValue) {
+      this._editorEnterValue = null;
+    }
+    this.Super('setValue', arguments);
   }
 });
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-minidaterange.js	Thu Jun 27 10:02:33 2013 +0200
@@ -657,4 +657,4 @@
   formatDate: function (dt) {
     return OB.Utilities.Date.JSToOB(dt, OB.Format.date);
   }
-});
+});
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -429,7 +429,20 @@
   },
 
   blur: function () {
-    var value;
+    var value, roundedValue, textRoundedValue;
+
+    // Make sure the number is rounded using the number of decimal digits specified in the number typeInstance
+    if (isc.isA.String(this.getValue())) {
+        value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(), this.typeInstance.maskNumeric, this.typeInstance.decSeparator, this.typeInstance.groupSeparator);
+        this.setValue(OB.Utilities.Number.OBMaskedToJS(value, this.typeInstance.decSeparator, this.typeInstance.groupSeparator));
+        if (this.form.setTextualValue) {
+            this.form.setTextualValue(this.name, value, this.typeInstance);
+        }
+    }
+
+    if (this.grid && this.grid.isEditing && this.grid.isEditing()) {
+      this.grid.setEditValue(this.grid.getEditRow(), this.name, this.getValue(), true, true);
+    }
 
     if (this.form && this.form._isRedrawing) {
       return;
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-notes.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form-notes.js	Thu Jun 27 10:02:33 2013 +0200
@@ -222,6 +222,13 @@
           }
           return this.Super('change', arguments);
         },
+        isDisabled: function () {
+          this.Super('isDisabled', arguments);
+          if (OB.PropertyStore.get("DisableNotesForReadOnlyTabs", this.windowId) === 'Y' && this.layout.getForm().view.readOnly === true) {
+            this.readOnly = true;
+            this.canEdit = false;
+          }
+        },
         validators: [{
           type: 'required'
         }]
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js	Thu Jun 27 10:02:33 2013 +0200
@@ -455,7 +455,7 @@
       initWidget: function () {
         this.recordEditor.sourceWidget.filterImage = this;
         this.recordEditor.filterImage = this;
-        if (this.recordEditor.sourceWidget.filterClause) {
+        if (this.recordEditor.sourceWidget.filterClause || this.recordEditor.sourceWidget.sqlFilterClause) {
           this.prompt = OB.I18N.getLabel('OBUIAPP_GridFilterImplicitToolTip');
           this.visibility = 'inherit';
         }
@@ -509,6 +509,7 @@
         fld, length;
     if (!keepFilterClause) {
       delete this.filterClause;
+      delete this.sqlFilterClause;
     }
     this.forceRefresh = true;
     if (this.filterEditor) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js	Thu Jun 27 10:02:33 2013 +0200
@@ -1348,9 +1348,8 @@
     OB.KeyboardManager.Shortcuts.set('ViewGrid_CancelEditing', ['OBViewGrid.body', 'OBViewGrid.editForm'], ksAction_CancelEditing);
 
     ksAction_DeleteSelectedRecords = function () {
-      var isDeletingEnabled = !me.view.toolBar.getLeftMember(isc.OBToolbar.TYPE_DELETE).disabled;
-      if (me.getSelectedRecords().length > 0 && isDeletingEnabled) {
-        me.view.deleteSelectedRows();
+      var isRecordDeleted = me.deleteSelectedRowsByToolbarIcon();
+      if (isRecordDeleted) {
         return false; // To avoid keyboard shortcut propagation
       } else {
         return true;
@@ -2178,14 +2177,43 @@
         title: OB.I18N.getLabel('OBUIAPP_Delete'),
         keyTitle: OB.KeyboardManager.Shortcuts.getProperty('keyComb.text', 'ToolBar_Eliminate', 'id'),
         click: function () {
-          grid.view.deleteSelectedRows();
+          grid.deleteSelectedRowsByToolbarIcon();
         }
       });
     }
-
     return menuItems;
   },
 
+  deleteSelectedRowsByToolbarIcon: function () {
+    // The deleteSelectedRows action trigger should be the same than the toolbar button, so if this last one is overwritten,
+    // this delete rows logic should perform the same action than the toolbar button.
+    var grid = this,
+        isToolbarButtonFound = false,
+        toolbarButton, i;
+    if (grid.getSelectedRecords().length < 1) {
+      return false;
+    }
+    if (grid.view.toolBar && grid.view.toolBar.leftMembers && isc.OBToolbar.TYPE_DELETE) {
+      for (i = 0; i < grid.view.toolBar.leftMembers.length; i++) {
+        if (grid.view.toolBar.leftMembers[i].buttonType === isc.OBToolbar.TYPE_DELETE) {
+          isToolbarButtonFound = true;
+          toolbarButton = grid.view.toolBar.leftMembers[i];
+          if (!toolbarButton.disabled) {
+            toolbarButton.action();
+            return true;
+          }
+          break;
+        }
+      }
+    }
+    // But if the toolbar button is not found, do the default action
+    if (!isToolbarButtonFound) {
+      grid.view.deleteSelectedRows();
+      return true;
+    }
+    return false;
+  },
+
   // +++++++++++++++++++++++++++++ Record Selection Handling +++++++++++++++++++++++
   updateSelectedCountDisplay: function () {
     var selection = this.getSelection(),
@@ -2990,10 +3018,7 @@
       }
     };
 
-    if (ficCallDone) {
-      // reset the new values as this can have changed because of a fic call
-      newValues = this.getEditValues(rowNum);
-    } else {
+    if (!ficCallDone) {
       var editForm = this.getEditForm(),
           focusItem = editForm.getFocusItem();
       if (focusItem && !focusItem.hasPickList) {
@@ -3009,6 +3034,9 @@
         }
       }
     }
+    // reset the new values as this can have changed because of a fic call or in the blur event of the focused item
+    newValues = this.getEditValues(rowNum);
+
     previousExplicitOffline = isc.Offline.explicitOffline;
     isc.Offline.explicitOffline = false;
     this.Super('saveEditedValues', [rowNum, colNum, newValues, oldValues, editValuesID, editCompletionEvent, saveCallback]);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js	Thu Jun 27 10:02:33 2013 +0200
@@ -250,7 +250,7 @@
       length = this.iconToolbarButtons.length;
       for (i = 0; i < length; i++) {
         // note create a somewhat unique id by concatenating the tabid and the index
-        OB.ToolbarRegistry.registerButton(this.tabId + '_' + i, isc.OBToolbarIconButton, this.iconToolbarButtons[i], 200 + (i * 10), this.tabId);
+        OB.ToolbarRegistry.registerButton(this.tabId + '_' + i, isc.OBToolbarIconButton, this.iconToolbarButtons[i], 200 + (i * 10), this.tabId, null, false);
       }
     }
 
@@ -1618,7 +1618,9 @@
       if (me.viewGrid.data) {
         var recordIndex = me.viewGrid.getRecordIndex(me.viewGrid.getSelectedRecord());
         data = OB.Utilities.Date.convertUTCTimeToLocalTime(data, me.viewGrid.completeFields);
-        me.viewGrid.data.updateCacheData(data, req);
+        if (me.viewGrid.data.updateCacheData) {
+          me.viewGrid.data.updateCacheData(data, req);
+        }
         me.viewGrid.selectRecord(me.viewGrid.getRecord(recordIndex));
         me.viewGrid.refreshRow(recordIndex);
         me.viewGrid.redraw();
@@ -1994,7 +1996,7 @@
         }
         // Prevents the proper id from being overwritten with the dummy id
         // See issue https://issues.openbravo.com/view.php?id=22625
-        if (this.viewGrid.getEditValues(rowNum)[OB.Constants.ID].indexOf('_') === 0 && this.viewGrid.getRecord(rowNum)[OB.Constants.ID].indexOf('_') !== 0) {
+        if (this.viewGrid.getEditValues(rowNum)[OB.Constants.ID] && this.viewGrid.getEditValues(rowNum)[OB.Constants.ID].indexOf('_') === 0 && this.viewGrid.getRecord(rowNum)[OB.Constants.ID].indexOf('_') !== 0) {
           record[OB.Constants.ID] = this.viewGrid.getRecord(rowNum)[OB.Constants.ID];
         }
       } else {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-help-about-widget.js	Thu Jun 27 10:02:33 2013 +0200
@@ -34,6 +34,10 @@
 
   // Set to empty to prevent an icon from being displayed on the button.
   src: '',
+  aboutLink: null,
+  helpLink: null,
+  dummyFirstField: null,
+  dummyLastField: null,
 
   showTitle: true,
 
@@ -64,25 +68,20 @@
   beforeShow: function () {
     // determine if the help should be displayed or not
     var tabPane = null,
-        aboutLink = null,
-        helpLink = null,
-        helpView = null,
-        dummyFirstField = null,
-        dummyLastField = null;
-
-    dummyFirstField = isc.OBFocusButton.create({
+        helpView = null;
+    this.dummyFirstField = isc.OBFocusButton.create({
       getFocusTarget: function () {
         return isc.OBQuickRun.currentQuickRun.members[0].members[isc.OBQuickRun.currentQuickRun.members[0].getMembers().length - 2];
       }
     });
 
-    dummyLastField = isc.OBFocusButton.create({
+    this.dummyLastField = isc.OBFocusButton.create({
       getFocusTarget: function () {
         return isc.OBQuickRun.currentQuickRun.members[0].members[1];
       }
     });
 
-    aboutLink = isc.OBHelpAboutLinkButton.create({
+    this.aboutLink = isc.OBHelpAboutLinkButton.create({
       name: 'aboutLink',
       title: OB.I18N.getLabel('UINAVBA_About'),
       keyPress: function () {
@@ -100,7 +99,7 @@
       }
     });
 
-    helpLink = isc.OBHelpAboutLinkButton.create({
+    this.helpLink = isc.OBHelpAboutLinkButton.create({
       name: 'helpLink',
       title: OB.I18N.getLabel('UINAVBA_Help'),
       keyPress: function () {
@@ -129,19 +128,41 @@
       this.members[0].destroyAndRemoveMembers(this.members[0].getMembers().duplicate());
     }
     if (!tabPane) {
-      this.members[0].addMembers([aboutLink]);
+      this.members[0].addMembers([this.aboutLink]);
     } else {
       helpView = tabPane.getHelpView();
       if (!helpView) {
-        this.members[0].addMembers([aboutLink]);
+        this.members[0].addMembers([this.aboutLink]);
       } else {
-        this.members[0].addMembers([helpLink, aboutLink]);
+        this.members[0].addMembers([this.helpLink, this.aboutLink]);
       }
     }
-    this.members[0].addMembers(dummyFirstField, 0);
-    this.members[0].addMembers(dummyLastField, this.members[0].getMembers().length);
-    OB.TestRegistry.register('org.openbravo.client.application.HelpAbout.HelpLink', helpLink);
-    OB.TestRegistry.register('org.openbravo.client.application.HelpAbout.AboutLink', aboutLink);
+    this.members[0].addMembers(this.dummyFirstField, 0);
+    this.members[0].addMembers(this.dummyLastField, this.members[0].getMembers().length);
+    OB.TestRegistry.register('org.openbravo.client.application.HelpAbout.HelpLink', this.helpLink);
+    OB.TestRegistry.register('org.openbravo.client.application.HelpAbout.AboutLink', this.aboutLink);
+  },
+
+  doHide: function () {
+    if (this.aboutLink) {
+      this.aboutLink.destroy();
+      this.aboutLink = null;
+      this.members[0].destroyAndRemoveMembers(this.aboutLink);
+    }
+    if (this.helpLink) {
+      this.helpLink.destroy();
+      this.helpLink = null;
+      this.members[0].destroyAndRemoveMembers(this.helpLink);
+    }
+    if (this.dummyFirstField) {
+      this.dummyFirstField.destroy();
+      this.dummyFirstField = null;
+    }
+    if (this.dummyLastField) {
+      this.dummyLastField.destroy();
+      this.dummyLastField = null;
+    }
+    this.Super('doHide', arguments);
   },
 
   members: [isc.VLayout.create({
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/navbar/ob-quick-launch.js	Thu Jun 27 10:02:33 2013 +0200
@@ -120,6 +120,9 @@
         OB.Utilities.openDirectTab(params.tabId, params.recordId, params.command);
       }
     }
+    if (this.members[1].getMembers()) {
+      this.members[1].destroyAndRemoveMembers(this.members[1].getMembers().duplicate());
+    }
 
     this.Super('doHide', arguments);
   },
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views-toolbar.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s): ___________
  ************************************************************************
@@ -228,6 +228,6 @@
     keyboardShortcutId: 'ToolBar_ManageViews'
   };
 
-  OB.ToolbarRegistry.registerButton(manageViewButtonProperties.buttonType, isc.OBToolbarIconButton, manageViewButtonProperties, 320, null);
+  OB.ToolbarRegistry.registerButton(manageViewButtonProperties.buttonType, isc.OBToolbarIconButton, manageViewButtonProperties, 320, null, null, false);
 
 }());
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-manage-views.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s): ___________
  ************************************************************************
@@ -161,6 +161,8 @@
       }
 
       if (viewTabDefinition.grid) {
+        //clear grouping, will be applied later
+        view.viewGrid.clearGroupBy();
         view.viewGrid.setViewState(viewTabDefinition.grid);
         view.viewGrid.refreshContents();
       }
@@ -300,6 +302,9 @@
         views = standardWindow.getClass().personalization.views;
       }
       views.push(newView);
+      if (newView.viewDefinition && newView.viewDefinition.isDefault) {
+        OB.PropertyStore.set('OBUIAPP_DefaultSavedView', data.personalizationId, standardWindow.windowId);
+      }
 
       // sort the viewdefinitions
       views.sort(function (v1, v2) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/personalization/ob-personalize-form-toolbar-button.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s): ___________
  ************************************************************************
@@ -71,7 +71,7 @@
     keyboardShortcutId: 'ToolBar_Personalization'
   };
 
-  OB.ToolbarRegistry.registerButton(personalizationButtonProperties.buttonType, isc.OBToolbarIconButton, personalizationButtonProperties, 310, null);
+  OB.ToolbarRegistry.registerButton(personalizationButtonProperties.buttonType, isc.OBToolbarIconButton, personalizationButtonProperties, 310, null, null, false);
 
   // and register the toolbar button the window personalization tab  
   windowPersonalizationTabButtonProperties = {
@@ -147,6 +147,6 @@
   };
 
   // register only for the window personalization tab
-  OB.ToolbarRegistry.registerButton(windowPersonalizationTabButtonProperties.buttonType, isc.OBToolbarIconButton, windowPersonalizationTabButtonProperties, 320, 'FF8081813157AED2013157BF6D810023');
+  OB.ToolbarRegistry.registerButton(windowPersonalizationTabButtonProperties.buttonType, isc.OBToolbarIconButton, windowPersonalizationTabButtonProperties, 320, 'FF8081813157AED2013157BF6D810023', null, false);
 
 }());
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-view.js	Thu Jun 27 10:02:33 2013 +0200
@@ -56,15 +56,43 @@
     // Buttons
 
     function actionClick() {
+      var hasErrors = false,
+          grid, fields, selection, len, allRows, lineNumbers, i, j, record, undef;
       view.messageBar.hide();
-      if (view.validate()) {
-        view.doProcess(this._buttonValue);
+      if (view.grid && view.grid.viewGrid) {
+        grid = view.grid.viewGrid;
+        fields = grid.getFields();
+        selection = grid.getSelectedRecords() || [];
+        len = selection.length;
+        allRows = grid.data.allRows || grid.data.localData || grid.data;
+        for (i = 0; i < len; i++) {
+          record = grid.getEditedRecord(grid.getRecordIndex(selection[i]));
+          for (j = 0; j < fields.length; j++) {
+            if (fields[j].required) {
+              if (record[fields[j].name] === null || record[fields[j] === undef]) {
+                hasErrors = true;
+                if (lineNumbers === undef) {
+                  lineNumbers = grid.getRecordIndex(selection[i]).toString();
+                } else {
+                  lineNumbers = lineNumbers + "," + grid.getRecordIndex(selection[i]).toString();
+                }
+              }
+            }
+          }
+        }
+      }
+      if (!hasErrors) {
+        if (view.validate()) {
+          view.doProcess(this._buttonValue);
+        } else {
+          // If the messageBar is visible, it means that it has been set due to a custom validation inside view.validate()
+          // so we don't want to overwrite it with the generic OBUIAPP_ErrorInFields message
+          if (!view.messageBar.isVisible()) {
+            view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
+          }
+        }
       } else {
-        // If the messageBar is visible, it means that it has been set due to a custom validation inside view.validate()
-        // so we don't want to overwrite it with the generic OBUIAPP_ErrorInFields message
-        if (!view.messageBar.isVisible()) {
-          view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('OBUIAPP_ErrorInFields'));
-        }
+        view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('OBUIAPP_FillMandatoryFields') + " " + lineNumbers);
       }
     }
 
@@ -255,13 +283,21 @@
     if (message) {
       if (this.popup) {
         if (!retryExecution) {
-          this.buttonOwnerView.messageBar.setMessage(message.severity, message.text);
+          if (message.title) {
+            this.buttonOwnerView.messageBar.setMessage(message.severity, message.title, message.text);
+          } else {
+            this.buttonOwnerView.messageBar.setMessage(message.severity, message.text);
+          }
         } else {
           // Popup has no message bar, showing the message in a warn popup
           isc.warn(message.text);
         }
       } else {
-        this.messageBar.setMessage(message.severity, message.text);
+        if (message.title) {
+          this.messageBar.setMessage(message.severity, message.title, message.text);
+        } else {
+          this.messageBar.setMessage(message.severity, message.text);
+        }
       }
     }
 
@@ -393,10 +429,12 @@
       }
 
       len = (allRows && allRows.length) || 0;
-
-      for (i = 0; i < len; i++) {
-        tmp = isc.addProperties({}, allRows[i], grid.getEditedRecord(grid.getRecordIndex(allRows[i])));
-        allProperties._allRows.push(tmp);
+      // Only send _allRows if all rows are cached
+      if (len <= grid.data.cachedRows) {
+        for (i = 0; i < len; i++) {
+          tmp = isc.addProperties({}, allRows[i], grid.getEditedRecord(grid.getRecordIndex(allRows[i])));
+          allProperties._allRows.push(tmp);
+        }
       }
     }
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js	Thu Jun 27 10:02:33 2013 +0200
@@ -105,12 +105,14 @@
 
     // required to show the funnel icon and to work
     this.filterClause = this.gridProperties.filterClause;
-    if (this.filterClause && this.gridProperties.filterName) {
+    this.sqlFilterClause = this.gridProperties.sqlFilterClause;
+    if ((this.filterClause || this.sqlFilterClause) && this.gridProperties.filterName) {
       this.view.messageBar.setMessage(isc.OBMessageBar.TYPE_INFO, '<div><div class="' + OB.Styles.MessageBar.leftMsgContainerStyle + '">' + this.gridProperties.filterName + '<br/>' + OB.I18N.getLabel('OBUIAPP_ClearFilters') + '</div></div>', ' ');
       this.view.messageBar.hasFilterMessage = true;
     }
 
     this.orderByClause = this.gridProperties.orderByClause;
+    this.sqlOrderByClause = this.gridProperties.sqlOrderByClause;
 
     this.checkboxFieldProperties = isc.addProperties({}, this.checkboxFieldProperties | {}, {
       canFilter: true,
@@ -224,6 +226,21 @@
     this.Super('selectionUpdated', arguments);
   },
 
+  cellEditEnd: function (editCompletionEvent, newValue, ficCallDone, autoSaveDone) {
+    var rowNum = this.getEditRow(),
+        colNum = this.getEditCol(),
+        editField = this.getEditField(colNum),
+        undef;
+    if (editField.required) {
+      if (newValue === null || newValue === undef) {
+        this.setFieldError(rowNum, editField.name, "Invalid Value");
+      } else {
+        this.clearFieldError(rowNum, editField.name);
+      }
+    }
+    this.Super('cellEditEnd', arguments);
+  },
+
   handleFilterEditorSubmit: function (criteria, context) {
     var ids = [],
         crit = {},
@@ -395,6 +412,10 @@
       params[OB.Constants.ORDERBY_PARAMETER] = this.orderByClause;
     }
 
+    if (this.sqlOrderByClause) {
+      params[OB.Constants.SQL_ORDERBY_PARAMETER] = this.sqlOrderByClause;
+    }
+
     if (this.filterClause) {
       if (props.whereClause) {
         params[OB.Constants.WHERE_PARAMETER] = ' ((' + props.whereClause + ') and (' + this.filterClause + ")) ";
@@ -407,6 +428,18 @@
       params[OB.Constants.WHERE_PARAMETER] = null;
     }
 
+    if (this.sqlFilterClause) {
+      if (props.sqlWhereClause) {
+        params[OB.Constants.SQL_WHERE_PARAMETER] = ' ((' + props.sqlWhereClause + ') and (' + this.sqlFilterClause + ")) ";
+      } else {
+        params[OB.Constants.SQL_WHERE_PARAMETER] = this.sqlFilterClause;
+      }
+    } else if (props.sqlWhereClause) {
+      params[OB.Constants.SQL_WHERE_PARAMETER] = props.sqlWhereClause;
+    } else {
+      params[OB.Constants.SQL_WHERE_PARAMETER] = null;
+    }
+
     return params;
   },
 
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js	Thu Jun 27 10:02:33 2013 +0200
@@ -11,45 +11,11 @@
  * 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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):   Sreedhar Sirigiri (TDS), Mallikarjun M (TDS)
  ************************************************************************
  */
 
-// Registers a button to clone an order
-// put within a function to hide local vars etc.
-(function () {
-  var cloneButtonProps = isc.addProperties({}, isc.OBToolbar.CLONE_BUTTON_PROPERTIES);
-
-  cloneButtonProps.action = function () {
-    var view = this.view,
-        callback;
-
-    callback = function (ok) {
-      var requestParams;
-
-      if (ok) {
-        requestParams = {
-          orderId: view.viewGrid.getSelectedRecord().id
-        };
-        OB.RemoteCallManager.call('org.openbravo.client.application.businesslogic.CloneOrderActionHandler', {}, requestParams, function (rpcResponse, data, rpcRequest) {
-
-          var recordIndex = view.viewGrid.getRecordIndex(view.viewGrid.getSelectedRecord()) + 1;
-          // takes care of transforming dates etc.
-          data = view.viewGrid.getDataSource().recordsFromObjects(data)[0];
-          view.viewGrid.addToCacheData(data, recordIndex);
-          view.viewGrid.scrollToRow(recordIndex);
-          view.viewGrid.markForRedraw();
-          var visibleRows = view.viewGrid.body.getVisibleRows();
-          view.editRecord(view.viewGrid.getRecord(recordIndex), false);
-        });
-      }
-    };
-    isc.ask(OB.I18N.getLabel('OBUIAPP_WantToCloneOrder'), callback);
-  };
-
-  // register the button for the sales order tab
-  OB.ToolbarRegistry.registerButton(cloneButtonProps.buttonType, isc.OBToolbarIconButton, cloneButtonProps, 100, ['186', '294']);
-
-}());
\ No newline at end of file
+// Create a button to clone a sales order ('Sales Order' tab)
+OB.ToolbarUtils.createCloneButton('org.openbravo.client.application.businesslogic.CloneOrderActionHandler', null, ['186', '294'], OB.I18N.getLabel('OBUIAPP_WantToCloneOrder'));
\ No newline at end of file
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):   Sreedhar Sirigiri (TDS), Mallikarjun M (TDS)
  ************************************************************************
@@ -38,6 +38,7 @@
     },
     disabled: true,
     buttonType: 'save',
+    sortPosition: 30,
     prompt: OB.I18N.getLabel('OBUIAPP_SaveRow'),
     updateState: function () {
       var view = this.view,
@@ -78,6 +79,7 @@
     },
 
     buttonType: 'savecloseX',
+    sortPosition: 40,
     prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON'),
     updateState: function () {
       var view = this.view,
@@ -116,6 +118,7 @@
       }
     },
     buttonType: 'newRow',
+    sortPosition: 20,
     prompt: OB.I18N.getLabel('OBUIAPP_NewRow'),
     updateState: function () {
       var view = this.view,
@@ -130,6 +133,7 @@
       this.view.newDocument();
     },
     buttonType: 'newDoc',
+    sortPosition: 10,
     prompt: OB.I18N.getLabel('OBUIAPP_NewDoc'),
     updateState: function () {
       var view = this.view,
@@ -149,6 +153,7 @@
     },
     disabled: true,
     buttonType: 'eliminate',
+    sortPosition: 60,
     prompt: OB.I18N.getLabel('OBUIAPP_DeleteRow'),
     updateState: function () {
       var view = this.view,
@@ -186,6 +191,7 @@
     },
     disabled: false,
     buttonType: 'refresh',
+    sortPosition: 70,
     prompt: OB.I18N.getLabel('OBUIAPP_RefreshData'),
     updateState: function () {
       this.setDisabled(!this.view.hasNotChanged());
@@ -202,6 +208,7 @@
     },
     disabled: true,
     buttonType: 'undo',
+    sortPosition: 50,
     prompt: OB.I18N.getLabel('OBUIAPP_CancelEdit'),
     updateState: function () {
       if (this.view.isShowingForm) {
@@ -231,6 +238,7 @@
     },
     disabled: false,
     buttonType: 'export',
+    sortPosition: 80,
     prompt: OB.I18N.getLabel('OBUIAPP_ExportGrid'),
     updateState: function () {
       this.setDisabled(this.view.isShowingForm || this.view.viewGrid.getTotalRows() === 0 || OB.PropertyStore.get("ExportToCsv", this.view.standardWindow.windowId) === 'N');
@@ -334,6 +342,7 @@
     },
     disabled: false,
     buttonType: 'attach',
+    sortPosition: 90,
     updateState: function () {
       var selectedRows = this.view.viewGrid.getSelectedRecords();
       var attachmentExists = this.view.attachmentExists;
@@ -419,6 +428,7 @@
     },
     disabled: false,
     buttonType: 'link',
+    sortPosition: 300,
     prompt: OB.I18N.getLabel('OBUIAPP_GetDirectLink'),
     updateState: function () {},
     keyboardShortcutId: 'ToolBar_Link'
@@ -462,6 +472,13 @@
         if (view.isShowingForm && form.isNew) {
           disabled = true;
         }
+        /*
+         * Fixes Issue 0023270. The Business partner print button provides statistics about the
+         * business partner transactions in a pop up and so handling multiple records are not allowed.
+         */
+        if (view.tabId === '220' && selectedRecords.length > 1) {
+          disabled = true;
+        }
         this.setDisabled(disabled);
       },
       keyboardShortcutId: 'ToolBar_Print'
@@ -490,22 +507,26 @@
 
   CLONE_BUTTON_PROPERTIES: {
     action: function () {
-      alert('this method must be overridden when registering the button');
+      alert('This method must be overridden when registering the button');
     },
     disabled: false,
     buttonType: 'clone',
+    sortPosition: 100,
     prompt: OB.I18N.getLabel('OBUIAPP_CloneData'),
     updateState: function () {
       var view = this.view,
           form = view.viewForm,
           grid = view.viewGrid,
           selectedRecords = grid.getSelectedRecords();
+
       if (selectedRecords && selectedRecords.length > 1) {
         this.setDisabled(true);
       } else if (view.isShowingForm && form.isNew) {
         this.setDisabled(true);
       } else if (view.isEditingGrid && grid.getEditForm().isNew) {
         this.setDisabled(true);
+      } else if (form.hasChanged || (view.isEditingGrid && grid.getEditForm().hasChanged)) {
+        this.setDisabled(true);
       } else {
         this.setDisabled(selectedRecords.length === 0);
       }
@@ -1667,17 +1688,88 @@
   view.setContextInfo(view.getContextInfo(true, true, true, true), openPopupTree, true);
 };
 
+
+// ** {{{ OB.ToolbarUtils.createCloneButton(/*String*/ actionHandler, /*Object*/ requestParams, /*Array[String]*/ tabIds, /*String*/ askMsg, /*Integer*/ sortOrder, /*Boolean*/ editRecordAfterClone, /*String*/ buttonId, /*Boolean*/ overwriteIfExists, /*Array[String]*/ tabIdsToAvoid}}} **
+// Automatically set up a clone button for the provided tabs
+// Parameters:
+// * {{{actionHandler}}}:  action handler which processes and returns the cloned record
+// * {{{requestParams}}}: (Optional) aditional parameters to send to the action handler
+// * {{{tabIds}}}: (Optional, all tabs will be included by default) array of tabIds where this button will be shown
+// * {{{askMsg}}}: (Optional, 'OBUIAPP_WantToCloneRecord' by default) Text that will be displayed when the button be pressed.
+// * {{{sortOrder}}}: (Optional, 'CLONE_BUTTON_PROPERTIES.sortPosition' by default) Position in the toolbar of the clone button.
+// * {{{editRecordAfterClone}}}: (Optional, true by default) If the form edit view (of the cloned record) should be opened after clone it.
+// * {{{buttonId}}}: (Optional, random by default) Don't set it unless you plan to do advanced coding with this button (as, for example, overwrite it later in another place).
+// * {{{overwriteIfExists}}}: (Optional, false by default) To be able to overwrite a particular existing clone button. The buttonId should match with the overwritten one.
+// * {{{tabIdsToAvoid}}}: (Optional, no tabs to avoid by default) array of tabIds where this button should not be shown
+OB.ToolbarUtils.createCloneButton = function (actionHandler, requestParams, tabIds, askMsg, sortOrder, editRecordAfterClone, buttonId, overwriteIfExists, tabIdsToAvoid) {
+  var cloneButtonProps = isc.addProperties({}, isc.OBToolbar.CLONE_BUTTON_PROPERTIES);
+
+  if (!askMsg) {
+    askMsg = OB.I18N.getLabel('OBUIAPP_WantToCloneRecord');
+  }
+  if (!sortOrder) {
+    sortOrder = isc.OBToolbar.CLONE_BUTTON_PROPERTIES.sortPosition;
+  }
+  if (editRecordAfterClone !== false) {
+    editRecordAfterClone = true;
+  }
+  if (!buttonId) {
+    buttonId = cloneButtonProps.buttonType + '_' + OB.Utilities.generateRandomString(8);
+  }
+  if (overwriteIfExists !== true) {
+    overwriteIfExists = false;
+  }
+
+  cloneButtonProps.action = function () {
+    var view = this.view,
+        callback;
+
+    callback = function (ok) {
+      if (!requestParams) {
+        requestParams = {};
+      }
+      requestParams.recordId = view.viewGrid.getSelectedRecord().id;
+      requestParams.tabId = view.tabId;
+      requestParams.windowId = view.windowId;
+
+      if (ok) {
+        OB.RemoteCallManager.call(actionHandler, {}, requestParams, function (rpcResponse, data, rpcRequest) {
+          var recordIndex = view.viewGrid.getRecordIndex(view.viewGrid.getSelectedRecord()) + 1,
+              recordsData = view.viewGrid.getDataSource().recordsFromObjects(data)[0];
+          view.viewGrid.addToCacheData(recordsData, recordIndex);
+          view.viewGrid.scrollToRow(recordIndex);
+          view.viewGrid.markForRedraw();
+          if (view.viewGrid.getEditRow()) {
+            view.viewGrid.endEditing();
+          }
+          view.viewGrid.doSelectSingleRecord(recordIndex);
+          if (editRecordAfterClone) {
+            view.editRecord(view.viewGrid.getRecord(recordIndex), false);
+          }
+        });
+      }
+    };
+    isc.ask(askMsg, callback);
+  };
+
+  OB.ToolbarRegistry.registerButton(buttonId, isc.OBToolbarIconButton, cloneButtonProps, sortOrder, tabIds, tabIdsToAvoid, overwriteIfExists);
+};
+
 OB.ToolbarRegistry = {
   buttonDefinitions: [],
 
   // note tabIds is an array of strings, but maybe null/undefined
-  registerButton: function (buttonId, clazz, properties, sortOrder, tabIds) {
+  registerButton: function (buttonId, clazz, properties, sortOrder, tabIds, tabIdsToAvoid, overwriteIfExists) {
     var length;
 
     if (tabIds && !isc.isA.Array(tabIds)) {
       tabIds = [tabIds];
     }
 
+    if (tabIdsToAvoid && !isc.isA.Array(tabIdsToAvoid)) {
+      tabIdsToAvoid = [tabIdsToAvoid];
+    }
+
     // declare the vars and the object which will be stored
     var i, index = 0,
         buttonDef;
@@ -1687,14 +1779,20 @@
       clazz: clazz,
       properties: properties,
       sortOrder: sortOrder,
-      tabIds: tabIds
+      tabIds: tabIds,
+      tabIdsToAvoid: tabIdsToAvoid
     };
 
-    // already registered, bail
+    // already registered button handling
     length = this.buttonDefinitions.length;
     for (i = 0; i < length; i++) {
       if (this.buttonDefinitions[i].buttonId === buttonId) {
-        return;
+        if (overwriteIfExists) {
+          this.buttonDefinitions.splice(i, 1);
+          break;
+        } else {
+          return;
+        }
       }
     }
 
@@ -1721,10 +1819,11 @@
     //  btnDefinitionClass.create(btnDefinitionProperties);
     var result = [],
         j, resultIndex = 0,
-        i, validTabId, tabIds, length = this.buttonDefinitions.length,
-        tabIdsLength;
+        i, validTabId, tabIds, tabIdsToAvoid, length = this.buttonDefinitions.length,
+        tabIdsLength, tabIdsToAvoidLength;
     for (i = 0; i < length; i++) {
       tabIds = this.buttonDefinitions[i].tabIds;
+      tabIdsToAvoid = this.buttonDefinitions[i].tabIdsToAvoid;
       validTabId = !tabIds;
       if (tabIds) {
         tabIdsLength = tabIds.length;
@@ -1736,6 +1835,15 @@
         }
       }
       if (validTabId) {
+        tabIdsToAvoidLength = (tabIdsToAvoid && isc.isA.Array(tabIdsToAvoid) && tabIdsToAvoid.length ? tabIdsToAvoid.length : 0);
+        for (j = 0; j < tabIdsToAvoidLength; j++) {
+          if (tabIdsToAvoid[j] === tabId) {
+            validTabId = false;
+            break;
+          }
+        }
+      }
+      if (validTabId) {
         result[resultIndex++] = this.buttonDefinitions[i].clazz.create(isc.clone(this.buttonDefinitions[i].properties));
       }
     }
@@ -1744,15 +1852,15 @@
 };
 
 //These are the icon toolbar buttons shown in all the tabs 
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES, 10, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES, 20, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.SAVE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.SAVE_BUTTON_PROPERTIES, 30, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES, 40, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.UNDO_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.UNDO_BUTTON_PROPERTIES, 50, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.DELETE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.DELETE_BUTTON_PROPERTIES, 60, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.REFRESH_BUTTON_PROPERTIES, 70, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.EXPORT_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.EXPORT_BUTTON_PROPERTIES, 80, null);
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES, 90, null);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES, isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES, isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.SAVE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.SAVE_BUTTON_PROPERTIES, isc.OBToolbar.SAVE_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES, isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.UNDO_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.UNDO_BUTTON_PROPERTIES, isc.OBToolbar.UNDO_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.DELETE_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.DELETE_BUTTON_PROPERTIES, isc.OBToolbar.DELETE_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.REFRESH_BUTTON_PROPERTIES, isc.OBToolbar.REFRESH_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.EXPORT_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.EXPORT_BUTTON_PROPERTIES, isc.OBToolbar.EXPORT_BUTTON_PROPERTIES.sortPosition, null, null, false);
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES, isc.OBToolbar.ATTACHMENTS_BUTTON_PROPERTIES.sortPosition, null, null, false);
 
 //and add the direct link at the end
-OB.ToolbarRegistry.registerButton(isc.OBToolbar.LINK_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.LINK_BUTTON_PROPERTIES, 300, null);
\ No newline at end of file
+OB.ToolbarRegistry.registerButton(isc.OBToolbar.LINK_BUTTON_PROPERTIES.buttonType, isc.OBToolbarIconButton, isc.OBToolbar.LINK_BUTTON_PROPERTIES, isc.OBToolbar.LINK_BUTTON_PROPERTIES.sortPosition, null, null, false);
\ No newline at end of file
--- a/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION><![CDATA[1.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--D393BE6F22BB44B7B728259B34FC795A-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--DCE798FBC5B648F7A3C81A6941720A57-->  <STARTVERSION><![CDATA[2.1.20523]]></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_COLUMN.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_COLUMN.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -410,6 +410,7 @@
 <!--3522895CB833445F968B548E8333EF47-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--3522895CB833445F968B548E8333EF47-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--3522895CB833445F968B548E8333EF47-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--3522895CB833445F968B548E8333EF47-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT AD_MODULE_ID FROM AD_REFERENCE WHERE AD_REFERENCE_ID = @AD_Reference_ID@]]></DEFAULTVALUE>
 <!--3522895CB833445F968B548E8333EF47-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--3522895CB833445F968B548E8333EF47-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--3522895CB833445F968B548E8333EF47-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
@@ -1656,6 +1657,7 @@
 <!--E93424C6AA924F878AAC210F9824433D-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--E93424C6AA924F878AAC210F9824433D-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--E93424C6AA924F878AAC210F9824433D-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--E93424C6AA924F878AAC210F9824433D-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT MAX(AD_MODULE_ID) FROM AD_MODULE WHERE ISDEFAULT='Y']]></DEFAULTVALUE>
 <!--E93424C6AA924F878AAC210F9824433D-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--E93424C6AA924F878AAC210F9824433D-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--E93424C6AA924F878AAC210F9824433D-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
--- a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION><![CDATA[2.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--4B828F4D03264080AA1D2057B13F613C-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--26B041893E844A53AFA58BC326C4F0D7-->  <STARTVERSION><![CDATA[3.0.20523]]></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.20088]]></STARTVERSION>
+<!--3AB045DA35ED4CA58EF7EB5BF04CDE3F-->  <STARTVERSION><![CDATA[1.1.20523]]></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.20088]]></STARTVERSION>
+<!--D7BA4BB0844942C58DC46B9E23CF8E67-->  <STARTVERSION><![CDATA[2.0.20523]]></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-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 <!--0B4D8D299242448DA1EA797FAA617297-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
 <!--0B4D8D299242448DA1EA797FAA617297-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--0B4D8D299242448DA1EA797FAA617297-->  <AD_PACKAGE_ID><![CDATA[08DD12A80BB942E79C0F3BD94FD3A249]]></AD_PACKAGE_ID>
+<!--0B4D8D299242448DA1EA797FAA617297-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--0B4D8D299242448DA1EA797FAA617297--></AD_TABLE>
 
 <!--457C2166008B451093B2DA54A0F7E2EC--><AD_TABLE>
@@ -42,6 +43,7 @@
 <!--457C2166008B451093B2DA54A0F7E2EC-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--457C2166008B451093B2DA54A0F7E2EC-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--457C2166008B451093B2DA54A0F7E2EC-->  <AD_PACKAGE_ID><![CDATA[08DD12A80BB942E79C0F3BD94FD3A249]]></AD_PACKAGE_ID>
+<!--457C2166008B451093B2DA54A0F7E2EC-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--457C2166008B451093B2DA54A0F7E2EC--></AD_TABLE>
 
 <!--558721361A024C3D8156095BD7C2716D--><AD_TABLE>
@@ -62,6 +64,7 @@
 <!--558721361A024C3D8156095BD7C2716D-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--558721361A024C3D8156095BD7C2716D-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--558721361A024C3D8156095BD7C2716D-->  <AD_PACKAGE_ID><![CDATA[08DD12A80BB942E79C0F3BD94FD3A249]]></AD_PACKAGE_ID>
+<!--558721361A024C3D8156095BD7C2716D-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--558721361A024C3D8156095BD7C2716D--></AD_TABLE>
 
 <!--AB51D583178F4F4EB6B8DB44C64654BE--><AD_TABLE>
@@ -85,6 +88,7 @@
 <!--AB51D583178F4F4EB6B8DB44C64654BE-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--AB51D583178F4F4EB6B8DB44C64654BE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--AB51D583178F4F4EB6B8DB44C64654BE-->  <AD_PACKAGE_ID><![CDATA[08DD12A80BB942E79C0F3BD94FD3A249]]></AD_PACKAGE_ID>
+<!--AB51D583178F4F4EB6B8DB44C64654BE-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--AB51D583178F4F4EB6B8DB44C64654BE--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelServlet.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelServlet.java	Thu Jun 27 10:02:33 2013 +0200
@@ -37,9 +37,11 @@
 import org.apache.log4j.Logger;
 import org.openbravo.base.ConfigParameters;
 import org.openbravo.base.HttpBaseUtils;
+import org.openbravo.base.exception.OBSecurityException;
 import org.openbravo.base.util.OBClassLoader;
 import org.openbravo.base.weld.WeldUtils;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.web.WebServiceUtil;
 
 /**
@@ -256,6 +258,17 @@
       final Class<ActionHandler> actionHandlerClass = (Class<ActionHandler>) OBClassLoader
           .getInstance().loadClass(action);
       final ActionHandler actionHandler = weldUtils.getInstance(actionHandlerClass);
+
+      if (OBContext.getOBContext() != null && OBContext.getOBContext().isPortalRole()) {
+        if (!(actionHandler instanceof PortalAccessible)) {
+          log4j.error("Portal user " + OBContext.getOBContext().getUser() + " with role "
+              + OBContext.getOBContext().getRole()
+              + " is trying to access to non granted action handler " + request.getRequestURL()
+              + "?" + request.getQueryString());
+          throw new OBSecurityException("Portal role has no access to this handler");
+        }
+      }
+
       actionHandler.execute();
     } catch (Exception e) {
       log4j.error("Error executing action " + action + " error: " + e.getMessage(), e);
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -33,6 +33,7 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
 import org.openbravo.base.structure.BaseOBObject;
+import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
@@ -387,12 +388,20 @@
     List<Tab> tabsOfWindow = tab.getWindow().getADTabList();
     ArrayList<Entity> entities = new ArrayList<Entity>();
     HashMap<Entity, Tab> tabOfEntity = new HashMap<Entity, Tab>();
-    Entity theEntity = ModelProvider.getInstance().getEntityByTableName(
-        tab.getTable().getDBTableName());
+    Entity theEntity = null;
+    if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(tab.getTable().getDataOriginType())) {
+      theEntity = ModelProvider.getInstance().getEntityByTableId(tab.getTable().getId());
+    } else {
+      theEntity = ModelProvider.getInstance().getEntityByTableName(tab.getTable().getDBTableName());
+    }
 
     for (Tab aTab : tabsOfWindow) {
-      Entity entity = ModelProvider.getInstance().getEntityByTableName(
-          aTab.getTable().getDBTableName());
+      Entity entity = null;
+      if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(aTab.getTable().getDataOriginType())) {
+        entity = ModelProvider.getInstance().getEntityByTableId(tab.getTable().getId());
+      } else {
+        entity = ModelProvider.getInstance().getEntityByTableName(aTab.getTable().getDBTableName());
+      }
       entities.add(entity);
       tabOfEntity.put(entity, aTab);
     }
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java	Thu Jun 27 10:02:33 2013 +0200
@@ -118,6 +118,9 @@
     if (value == null) {
       return "";
     }
+    if (value instanceof String) {
+      return (String) value;
+    }
     return getClassicFormat().format(value);
   }
 
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKComboUIDefinition.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKComboUIDefinition.java	Thu Jun 27 10:02:33 2013 +0200
@@ -68,6 +68,7 @@
               referencedTable.getDisplayedColumn());
           if (prop != null && referencedProp != null) {
             criteriaField = ", criteriaField: " + "'" + prop.getName() + DalUtil.FIELDSEPARATOR
+                + referencedProp.getName() + "', criteriaDisplayField: '"
                 + referencedProp.getName() + "'";
           }
         }
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/NumberUIDefinition.java	Thu Jun 27 10:02:33 2013 +0200
@@ -175,6 +175,11 @@
     if (value == null) {
       return "";
     }
+
+    if (value instanceof String) {
+      return (String) value;
+    }
+
     final String valueStr = value.toString();
     VariablesSecureApp variables = RequestContext.get().getVariablesSecureApp();
     // only replace the decimal symbol
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/TimeUIDefinition.java	Thu Jun 27 10:02:33 2013 +0200
@@ -58,6 +58,11 @@
     if (value == null || value == "") {
       return "";
     }
+
+    if (value instanceof String) {
+      return (String) value;
+    }
+
     String timestamp = value.toString();
     timestamp = timestamp.substring(timestamp.indexOf(" ") + 1);
     StringBuffer convertedValue = convertUtcToLocalTime(timestamp);
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinitionController.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -143,7 +143,10 @@
         }
       }
 
-      for (Table table : ModelProvider.getInstance().getTables()) {
+      List<Table> tableList = ModelProvider.getInstance().getTables();
+      tableList.addAll(ModelProvider.getInstance().getDataSourceBasedTables());
+
+      for (Table table : tableList) {
         List<Column> cols = table.getColumns();
         for (Column column : cols) {
           String referenceId;
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-js.ftl	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2009-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -61,9 +61,12 @@
         ID : 'id',
         FIELDSEPARATOR : '$',
         WHERE_PARAMETER : '_where',
+        SQL_WHERE_PARAMETER : '_sqlWhere',
         ORG_PARAMETER : '_org',
         ORDERBY_PARAMETER : '_orderBy',
+        SQL_ORDERBY_PARAMETER : '_sqlOrderBy',
         FILTER_PARAMETER : '_filter',
+        SQL_FILTER_PARAMETER : '_sqlFilter',
         SORTBY_PARAMETER : '_sortBy',
         OR_EXPRESSION: '_OrExpression',
         TEXT_MATCH_PARAMETER_OVERRIDE: '_textMatchStyleOverride',
--- a/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION><![CDATA[2.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--2758CD25B2704AF6BBAD10365FC82C06-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--15F51F03882F444CAB6593B4566DC929-->  <STARTVERSION><![CDATA[2.1.20523]]></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.20088]]></STARTVERSION>
+<!--E71B28FC949D481D9F59C17D01E46EF9-->  <STARTVERSION><![CDATA[3.0.20523]]></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-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 <!--09C543CF4D854CB4A706E8EF1591F042-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--09C543CF4D854CB4A706E8EF1591F042-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--09C543CF4D854CB4A706E8EF1591F042-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--09C543CF4D854CB4A706E8EF1591F042-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--09C543CF4D854CB4A706E8EF1591F042--></AD_TABLE>
 
 <!--3E14194316E64F89970960B9350907B3--><AD_TABLE>
@@ -40,6 +41,7 @@
 <!--3E14194316E64F89970960B9350907B3-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--3E14194316E64F89970960B9350907B3-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--3E14194316E64F89970960B9350907B3-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--3E14194316E64F89970960B9350907B3-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--3E14194316E64F89970960B9350907B3--></AD_TABLE>
 
 <!--568FD0BE075149A98601DE94E571AABD--><AD_TABLE>
@@ -60,6 +62,7 @@
 <!--568FD0BE075149A98601DE94E571AABD-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--568FD0BE075149A98601DE94E571AABD-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--568FD0BE075149A98601DE94E571AABD-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--568FD0BE075149A98601DE94E571AABD-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--568FD0BE075149A98601DE94E571AABD--></AD_TABLE>
 
 <!--5F20F3D554CA408891C1BA6545114D4D--><AD_TABLE>
@@ -81,6 +84,7 @@
 <!--5F20F3D554CA408891C1BA6545114D4D-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--5F20F3D554CA408891C1BA6545114D4D-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--5F20F3D554CA408891C1BA6545114D4D-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--5F20F3D554CA408891C1BA6545114D4D-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--5F20F3D554CA408891C1BA6545114D4D--></AD_TABLE>
 
 <!--74AEBEAB2C284163BCA76CF1E96DBC2C--><AD_TABLE>
@@ -101,6 +105,7 @@
 <!--74AEBEAB2C284163BCA76CF1E96DBC2C-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--74AEBEAB2C284163BCA76CF1E96DBC2C-->  <DEVELOPMENTSTATUS><![CDATA[DP]]></DEVELOPMENTSTATUS>
 <!--74AEBEAB2C284163BCA76CF1E96DBC2C-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--74AEBEAB2C284163BCA76CF1E96DBC2C-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--74AEBEAB2C284163BCA76CF1E96DBC2C--></AD_TABLE>
 
 <!--CF1D8385DC364B97B6A1BA2EE76C8DA1--><AD_TABLE>
@@ -122,6 +127,7 @@
 <!--CF1D8385DC364B97B6A1BA2EE76C8DA1-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--CF1D8385DC364B97B6A1BA2EE76C8DA1-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--CF1D8385DC364B97B6A1BA2EE76C8DA1-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--CF1D8385DC364B97B6A1BA2EE76C8DA1-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--CF1D8385DC364B97B6A1BA2EE76C8DA1--></AD_TABLE>
 
 <!--D1829E5F3A8441BF85DDBC06D49C1074--><AD_TABLE>
@@ -143,6 +149,7 @@
 <!--D1829E5F3A8441BF85DDBC06D49C1074-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--D1829E5F3A8441BF85DDBC06D49C1074-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--D1829E5F3A8441BF85DDBC06D49C1074-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--D1829E5F3A8441BF85DDBC06D49C1074-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--D1829E5F3A8441BF85DDBC06D49C1074--></AD_TABLE>
 
 <!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8--><AD_TABLE>
@@ -164,6 +171,7 @@
 <!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--E1C20B5D1AEB45FEB3D0E4B6C3F8B1A8--></AD_TABLE>
 
 <!--FF808181314242630131424606130001--><AD_TABLE>
@@ -184,6 +192,7 @@
 <!--FF808181314242630131424606130001-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF808181314242630131424606130001-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF808181314242630131424606130001-->  <AD_PACKAGE_ID><![CDATA[AC67D238397F4F9DA5AE76030C99C05F]]></AD_PACKAGE_ID>
+<!--FF808181314242630131424606130001-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF808181314242630131424606130001--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/MyOpenbravoActionHandler.java	Thu Jun 27 10:02:33 2013 +0200
@@ -49,10 +49,11 @@
 import org.openbravo.model.ad.access.User;
 import org.openbravo.model.ad.system.Client;
 import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.db.DalConnectionProvider;
 
 @ApplicationScoped
-public class MyOpenbravoActionHandler extends BaseActionHandler {
+public class MyOpenbravoActionHandler extends BaseActionHandler implements PortalAccessible {
   private static final Logger log = Logger.getLogger(MyOpenbravoActionHandler.class);
   private static final String WIDGET_MOVED = "WIDGET_MOVED";
   private static final String WIDGET_ADDED = "WIDGET_ADDED";
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Thu Jun 27 10:02:33 2013 +0200
@@ -436,7 +436,7 @@
 
   setRecentList: function (layout) {
     var recentList, newRecent, handleClickFunction, recentIndex = 0,
-        recent, lbl, newIcon, entryLayout, icon;
+        recent, lbl, newIcon, entryLayout, icon, destroyFunction;
 
     // start with a fresh content
     layout.destroyAndRemoveMembers(layout.members);
@@ -453,6 +453,11 @@
         }
       };
 
+      destroyFunction = function () {
+        this.destroyAndRemoveMembers(this.members);
+        this.Super('destroy', arguments);
+      };
+
       for (; recentIndex < recentList.length; recentIndex++) {
         if (recentList[recentIndex]) {
           recent = recentList[recentIndex];
@@ -492,7 +497,8 @@
 
           entryLayout = isc.HLayout.create({
             defaultLayoutAlign: 'center',
-            width: '100%'
+            width: '100%',
+            destroy: destroyFunction
           });
           entryLayout.addMember(lbl);
           // if a standard window then show the new icon
--- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -12,6 +12,18 @@
 <!--18EE399F2AF54EA3BEB5086D4BF6D4B1-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--18EE399F2AF54EA3BEB5086D4BF6D4B1--></AD_MESSAGE>
 
+<!--4D8B309237B84F3DAC3F193F69CB81C5--><AD_MESSAGE>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <AD_MESSAGE_ID><![CDATA[4D8B309237B84F3DAC3F193F69CB81C5]]></AD_MESSAGE_ID>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <VALUE><![CDATA[OBCQL_NoAccessToWidget]]></VALUE>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <MSGTEXT><![CDATA[Current user/role does not have access to widget %0]]></MSGTEXT>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <AD_MODULE_ID><![CDATA[0A060B2AF1974E8EAA8DB61388E9AECC]]></AD_MODULE_ID>
+<!--4D8B309237B84F3DAC3F193F69CB81C5-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--4D8B309237B84F3DAC3F193F69CB81C5--></AD_MESSAGE>
+
 <!--51E3AB93D32F488E896F1E03654B89F3--><AD_MESSAGE>
 <!--51E3AB93D32F488E896F1E03654B89F3-->  <AD_MESSAGE_ID><![CDATA[51E3AB93D32F488E896F1E03654B89F3]]></AD_MESSAGE_ID>
 <!--51E3AB93D32F488E896F1E03654B89F3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION><![CDATA[1.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--0A060B2AF1974E8EAA8DB61388E9AECC-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--26558497C31140BFAB067BA4BC47D799-->  <STARTVERSION><![CDATA[2.1.20523]]></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/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -19,6 +19,7 @@
 <!--28B9A36691BA4D4EBCA68E39D5D4B1BE-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--28B9A36691BA4D4EBCA68E39D5D4B1BE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--28B9A36691BA4D4EBCA68E39D5D4B1BE-->  <AD_PACKAGE_ID><![CDATA[CB5966CA4E2945FE8CC3138D3934DB9E]]></AD_PACKAGE_ID>
+<!--28B9A36691BA4D4EBCA68E39D5D4B1BE-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--28B9A36691BA4D4EBCA68E39D5D4B1BE--></AD_TABLE>
 
 <!--87AB97C7EED3429BBEFE9EF28EFACC08--><AD_TABLE>
@@ -40,6 +41,7 @@
 <!--87AB97C7EED3429BBEFE9EF28EFACC08-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--87AB97C7EED3429BBEFE9EF28EFACC08-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--87AB97C7EED3429BBEFE9EF28EFACC08-->  <AD_PACKAGE_ID><![CDATA[CB5966CA4E2945FE8CC3138D3934DB9E]]></AD_PACKAGE_ID>
+<!--87AB97C7EED3429BBEFE9EF28EFACC08-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--87AB97C7EED3429BBEFE9EF28EFACC08--></AD_TABLE>
 
 <!--8EE7634FA71B40FDB9ADF85374264BF6--><AD_TABLE>
@@ -61,6 +63,7 @@
 <!--8EE7634FA71B40FDB9ADF85374264BF6-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--8EE7634FA71B40FDB9ADF85374264BF6-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--8EE7634FA71B40FDB9ADF85374264BF6-->  <AD_PACKAGE_ID><![CDATA[CB5966CA4E2945FE8CC3138D3934DB9E]]></AD_PACKAGE_ID>
+<!--8EE7634FA71B40FDB9ADF85374264BF6-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--8EE7634FA71B40FDB9ADF85374264BF6--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -10,6 +10,7 @@
 <!--DD17275427E94026AD721067C3C91C18-->  <CLASSNAME><![CDATA[org.openbravo.client.querylist.QueryListDataSource]]></CLASSNAME>
 <!--DD17275427E94026AD721067C3C91C18-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
 <!--DD17275427E94026AD721067C3C91C18-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--DD17275427E94026AD721067C3C91C18-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
 <!--DD17275427E94026AD721067C3C91C18--></OBSERDS_DATASOURCE>
 
 </data>
--- a/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.querylist/src/org/openbravo/client/querylist/QueryListDataSource.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2010-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -39,7 +39,9 @@
 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.exception.OBSecurityException;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.domaintype.BigDecimalDomainType;
 import org.openbravo.base.model.domaintype.BooleanDomainType;
@@ -56,9 +58,18 @@
 import org.openbravo.client.kernel.reference.UIDefinitionController;
 import org.openbravo.client.kernel.reference.YesNoUIDefinition;
 import org.openbravo.client.myob.WidgetClass;
+import org.openbravo.client.myob.WidgetInstance;
+import org.openbravo.client.myob.WidgetReference;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.model.ad.access.WindowAccess;
+import org.openbravo.model.ad.datamodel.Column;
 import org.openbravo.model.ad.domain.Reference;
+import org.openbravo.model.ad.ui.Field;
+import org.openbravo.model.ad.ui.Window;
+import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.datasource.DataSourceProperty;
 import org.openbravo.service.datasource.ReadOnlyDataSourceService;
 import org.openbravo.service.json.JsonConstants;
@@ -69,7 +80,7 @@
  * 
  * @author gorkaion
  */
-public class QueryListDataSource extends ReadOnlyDataSourceService {
+public class QueryListDataSource extends ReadOnlyDataSourceService implements PortalAccessible {
   private static final String OPTIONAL_FILTERS = "@optional_filters@";
   private static final Logger log = Logger.getLogger(QueryListDataSource.class);
 
@@ -96,6 +107,38 @@
     try {
       WidgetClass widgetClass = OBDal.getInstance().get(WidgetClass.class,
           parameters.get("widgetId"));
+
+      // Check security: continue only if the widget instance is visible for current user/role
+      WidgetInstance wi = OBDal.getInstance().get(WidgetInstance.class,
+          parameters.get("widgetInstanceId"));
+
+      boolean accessibleWidgetInForm = false;
+      if (wi == null) {
+        accessibleWidgetInForm = isAccessibleWidgetInForm(widgetClass);
+      }
+      if (!accessibleWidgetInForm
+          && (wi == null || wi.getWidgetClass().getId() != widgetClass.getId())) {
+        // weird stuff: widget class doesn't match widget instance's class, most probably URL is
+        // not generated by UI, but user is typing it
+        log.error("User " + OBContext.getOBContext().getUser() + " with role "
+            + OBContext.getOBContext().getRole() + " is trying to access widget '"
+            + widgetClass.getWidgetTitle() + "' but widget istance doesn't match with class");
+        throw new OBSecurityException(OBMessageUtils.getI18NMessage("OBCQL_NoAccessToWidget",
+            new String[] { widgetClass.getWidgetTitle() }));
+      }
+
+      if (!accessibleWidgetInForm
+          && (OBContext.getOBContext() != null
+              && ((wi.getVisibleAtUser() != null && !wi.getVisibleAtUser().getId()
+                  .equals(OBContext.getOBContext().getUser().getId()))) || (wi.getVisibleAtRole() != null && !wi
+              .getVisibleAtRole().getId().equals(OBContext.getOBContext().getRole().getId())))) {
+        log.error("User " + OBContext.getOBContext().getUser() + " with role "
+            + OBContext.getOBContext().getRole() + " is trying to access widget '"
+            + widgetClass.getWidgetTitle() + "' which is not granted");
+        throw new OBSecurityException(OBMessageUtils.getI18NMessage("OBCQL_NoAccessToWidget",
+            new String[] { widgetClass.getWidgetTitle() }));
+      }
+
       boolean isExport = "true".equals(parameters.get("exportToFile"));
       boolean showAll = "true".equals(parameters.get("showAll"));
       String viewMode = parameters.get("viewMode");
@@ -188,7 +231,9 @@
               }
 
               if (domainType instanceof BooleanDomainType) {
-                value = ((PrimitiveDomainType) domainType).createFromString((String) value);
+                if (value instanceof String) {
+                  value = ((PrimitiveDomainType) domainType).createFromString((String) value);
+                }
               }
 
               if (!isExport) {
@@ -211,6 +256,38 @@
     }
   }
 
+  // Checks if the widget is embedded in a tab accessible by the user
+  private boolean isAccessibleWidgetInForm(WidgetClass widgetClass) {
+    OBCriteria<WidgetReference> widgetInFormCriteria = OBDal.getInstance().createCriteria(
+        WidgetReference.class);
+    widgetInFormCriteria.add(Restrictions.eq(WidgetReference.PROPERTY_WIDGETCLASS, widgetClass));
+    List<Window> windowList = new ArrayList<Window>();
+    List<WidgetReference> widgetInFormList = widgetInFormCriteria.list();
+    for (WidgetReference widgetInForm : widgetInFormList) {
+      List<Column> columnList = widgetInForm.getReference().getADColumnReferenceSearchKeyList();
+      for (Column column : columnList) {
+        List<Field> fieldList = column.getADFieldList();
+        for (Field field : fieldList) {
+          windowList.add(field.getTab().getWindow());
+        }
+      }
+    }
+
+    if (windowList.isEmpty()) {
+      // The widget is not embedded in any window
+      return false;
+    } else {
+      OBCriteria<WindowAccess> accessibleWindowCriteria = OBDal.getInstance().createCriteria(
+          WindowAccess.class);
+      accessibleWindowCriteria.add(Restrictions.eq(WindowAccess.PROPERTY_ROLE, OBContext
+          .getOBContext().getRole()));
+      accessibleWindowCriteria.add(Restrictions.in(WindowAccess.PROPERTY_WINDOW, windowList));
+      int count = accessibleWindowCriteria.count();
+      // If the widget is embedded in at least one window accessible by the user, return true
+      return (count > 0);
+    }
+  }
+
   // Converts and object from String to Date
   private Date convertToDate(String value) {
     DateDomainType domainType = new DateDomainType();
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -1,5 +1,17 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--32873C7A39ED464F9D781AB4BE08323B--><AD_ELEMENT>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <AD_ELEMENT_ID><![CDATA[32873C7A39ED464F9D781AB4BE08323B]]></AD_ELEMENT_ID>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <COLUMNNAME><![CDATA[organizationList]]></COLUMNNAME>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <NAME><![CDATA[Organization List]]></NAME>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <PRINTNAME><![CDATA[Organization List]]></PRINTNAME>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--32873C7A39ED464F9D781AB4BE08323B-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--32873C7A39ED464F9D781AB4BE08323B--></AD_ELEMENT>
+
 <!--9C7735D7BEB33C9EE040A8C0EB06271C--><AD_ELEMENT>
 <!--9C7735D7BEB33C9EE040A8C0EB06271C-->  <AD_ELEMENT_ID><![CDATA[9C7735D7BEB33C9EE040A8C0EB06271C]]></AD_ELEMENT_ID>
 <!--9C7735D7BEB33C9EE040A8C0EB06271C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--FF8080812D842086012D844F3CC0003E-->  <VERSION><![CDATA[0.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--FF8080812D842086012D844F3CC0003E-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--FF8080812D842086012D845002070046-->  <STARTVERSION><![CDATA[2.1.20523]]></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.client.widgets/src-db/database/sourcedata/OBCQL_QUERY_COLUMN.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBCQL_QUERY_COLUMN.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -1,5 +1,24 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE--><OBCQL_QUERY_COLUMN>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[00786482F5BC4FB2BB3E205C1DB6D9FE]]></OBCQL_QUERY_COLUMN_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <DISPLAY_EXPRESSION><![CDATA[warehouse]]></DISPLAY_EXPRESSION>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <NAME><![CDATA[Warehouse]]></NAME>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <LINK_EXPRESSION><![CDATA[whid]]></LINK_EXPRESSION>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <INCLUDE_IN><![CDATA[M]]></INCLUDE_IN>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <HAS_LINK><![CDATA[Y]]></HAS_LINK>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <AD_TAB_ID><![CDATA[178]]></AD_TAB_ID>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <CAN_BE_FILTERED><![CDATA[Y]]></CAN_BE_FILTERED>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE-->  <WHERECLAUSE_LEFT_PART><![CDATA[Warehouse.name]]></WHERECLAUSE_LEFT_PART>
+<!--00786482F5BC4FB2BB3E205C1DB6D9FE--></OBCQL_QUERY_COLUMN>
+
 <!--28F920CD36E14AFBB2025802363E8B02--><OBCQL_QUERY_COLUMN>
 <!--28F920CD36E14AFBB2025802363E8B02-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[28F920CD36E14AFBB2025802363E8B02]]></OBCQL_QUERY_COLUMN_ID>
 <!--28F920CD36E14AFBB2025802363E8B02-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -49,6 +68,41 @@
 <!--3A8324D4520B42B08DDED26BD05F98B5-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
 <!--3A8324D4520B42B08DDED26BD05F98B5--></OBCQL_QUERY_COLUMN>
 
+<!--7D6F8F4432754AB5872B925CF2BD1E37--><OBCQL_QUERY_COLUMN>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[7D6F8F4432754AB5872B925CF2BD1E37]]></OBCQL_QUERY_COLUMN_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <DISPLAY_EXPRESSION><![CDATA[store]]></DISPLAY_EXPRESSION>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <NAME><![CDATA[Organization]]></NAME>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <LINK_EXPRESSION><![CDATA[orgid]]></LINK_EXPRESSION>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <INCLUDE_IN><![CDATA[W]]></INCLUDE_IN>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <HAS_LINK><![CDATA[Y]]></HAS_LINK>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <AD_TAB_ID><![CDATA[143]]></AD_TAB_ID>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <CAN_BE_FILTERED><![CDATA[Y]]></CAN_BE_FILTERED>
+<!--7D6F8F4432754AB5872B925CF2BD1E37-->  <WHERECLAUSE_LEFT_PART><![CDATA[Organization.name]]></WHERECLAUSE_LEFT_PART>
+<!--7D6F8F4432754AB5872B925CF2BD1E37--></OBCQL_QUERY_COLUMN>
+
+<!--8106A2118FF44331B98E04E3F6F022DE--><OBCQL_QUERY_COLUMN>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[8106A2118FF44331B98E04E3F6F022DE]]></OBCQL_QUERY_COLUMN_ID>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <DISPLAY_EXPRESSION><![CDATA[attr]]></DISPLAY_EXPRESSION>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <NAME><![CDATA[Product Attribute]]></NAME>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <INCLUDE_IN><![CDATA[M]]></INCLUDE_IN>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <HAS_LINK><![CDATA[N]]></HAS_LINK>
+<!--8106A2118FF44331B98E04E3F6F022DE-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
+<!--8106A2118FF44331B98E04E3F6F022DE--></OBCQL_QUERY_COLUMN>
+
 <!--824EC1769E0D45F8AB4C94DEAE2B5691--><OBCQL_QUERY_COLUMN>
 <!--824EC1769E0D45F8AB4C94DEAE2B5691-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[824EC1769E0D45F8AB4C94DEAE2B5691]]></OBCQL_QUERY_COLUMN_ID>
 <!--824EC1769E0D45F8AB4C94DEAE2B5691-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -87,6 +141,23 @@
 <!--896F28AC4D454104A7B763ED8C279794-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
 <!--896F28AC4D454104A7B763ED8C279794--></OBCQL_QUERY_COLUMN>
 
+<!--97F2CA4B8CC64E64817EADAE7A837BF1--><OBCQL_QUERY_COLUMN>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[97F2CA4B8CC64E64817EADAE7A837BF1]]></OBCQL_QUERY_COLUMN_ID>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <DISPLAY_EXPRESSION><![CDATA[qtyonhand]]></DISPLAY_EXPRESSION>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <NAME><![CDATA[Quantity On Hand]]></NAME>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <SUMMARIZE_TYPE><![CDATA[sum]]></SUMMARIZE_TYPE>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <AD_REFERENCE_ID><![CDATA[22]]></AD_REFERENCE_ID>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <INCLUDE_IN><![CDATA[W]]></INCLUDE_IN>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <HAS_LINK><![CDATA[N]]></HAS_LINK>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
+<!--97F2CA4B8CC64E64817EADAE7A837BF1--></OBCQL_QUERY_COLUMN>
+
 <!--A7F9DA78BB164108B69479709BEE41A3--><OBCQL_QUERY_COLUMN>
 <!--A7F9DA78BB164108B69479709BEE41A3-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[A7F9DA78BB164108B69479709BEE41A3]]></OBCQL_QUERY_COLUMN_ID>
 <!--A7F9DA78BB164108B69479709BEE41A3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -103,6 +174,25 @@
 <!--A7F9DA78BB164108B69479709BEE41A3-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
 <!--A7F9DA78BB164108B69479709BEE41A3--></OBCQL_QUERY_COLUMN>
 
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3--><OBCQL_QUERY_COLUMN>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[ACAA48835B0E4A8D9AC6FCF73AD148C3]]></OBCQL_QUERY_COLUMN_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <DISPLAY_EXPRESSION><![CDATA[category]]></DISPLAY_EXPRESSION>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <NAME><![CDATA[Product Category]]></NAME>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <LINK_EXPRESSION><![CDATA[pcid]]></LINK_EXPRESSION>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <INCLUDE_IN><![CDATA[W]]></INCLUDE_IN>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <HAS_LINK><![CDATA[Y]]></HAS_LINK>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <AD_TAB_ID><![CDATA[189]]></AD_TAB_ID>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <CAN_BE_FILTERED><![CDATA[Y]]></CAN_BE_FILTERED>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3-->  <WHERECLAUSE_LEFT_PART><![CDATA[ProductCategory.name]]></WHERECLAUSE_LEFT_PART>
+<!--ACAA48835B0E4A8D9AC6FCF73AD148C3--></OBCQL_QUERY_COLUMN>
+
 <!--AD5A79DBC85846EBAA6F881DA264A0CD--><OBCQL_QUERY_COLUMN>
 <!--AD5A79DBC85846EBAA6F881DA264A0CD-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[AD5A79DBC85846EBAA6F881DA264A0CD]]></OBCQL_QUERY_COLUMN_ID>
 <!--AD5A79DBC85846EBAA6F881DA264A0CD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -171,6 +261,25 @@
 <!--E4755A4156FE4E87AFC771FDCE3F9A0B-->  <CAN_BE_FILTERED><![CDATA[N]]></CAN_BE_FILTERED>
 <!--E4755A4156FE4E87AFC771FDCE3F9A0B--></OBCQL_QUERY_COLUMN>
 
+<!--F4028CFC1E6C405FB02AF3F922A98CF4--><OBCQL_QUERY_COLUMN>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[F4028CFC1E6C405FB02AF3F922A98CF4]]></OBCQL_QUERY_COLUMN_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <DISPLAY_EXPRESSION><![CDATA[product]]></DISPLAY_EXPRESSION>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <NAME><![CDATA[Product]]></NAME>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <WIDTH><![CDATA[10]]></WIDTH>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <LINK_EXPRESSION><![CDATA[pid]]></LINK_EXPRESSION>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <INCLUDE_IN><![CDATA[W]]></INCLUDE_IN>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <HAS_LINK><![CDATA[Y]]></HAS_LINK>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <AD_TAB_ID><![CDATA[180]]></AD_TAB_ID>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <CAN_BE_FILTERED><![CDATA[Y]]></CAN_BE_FILTERED>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4-->  <WHERECLAUSE_LEFT_PART><![CDATA[Product.name]]></WHERECLAUSE_LEFT_PART>
+<!--F4028CFC1E6C405FB02AF3F922A98CF4--></OBCQL_QUERY_COLUMN>
+
 <!--F80128948ADD4FDFBAC82BF7EBF0FEFD--><OBCQL_QUERY_COLUMN>
 <!--F80128948ADD4FDFBAC82BF7EBF0FEFD-->  <OBCQL_QUERY_COLUMN_ID><![CDATA[F80128948ADD4FDFBAC82BF7EBF0FEFD]]></OBCQL_QUERY_COLUMN_ID>
 <!--F80128948ADD4FDFBAC82BF7EBF0FEFD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBCQL_WIDGET_QUERY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBCQL_WIDGET_QUERY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -1,5 +1,28 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--53389C2060AD4DBEA1F9009A3C82B63F--><OBCQL_WIDGET_QUERY>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[53389C2060AD4DBEA1F9009A3C82B63F]]></OBCQL_WIDGET_QUERY_ID>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></OBKMO_WIDGET_CLASS_ID>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <HQL><![CDATA[select Organization.name as store, Warehouse.name as warehouse,Organization.id as orgid, Product.searchKey as identifier,Product.name as product,Product.id as pid, ProductCategory.name as category, ProductCategory.id as pcid,UOM.name as uom, sum(ps.quantityOnHand) as qtyonhand,AttributeSetInstance.description as attr,Warehouse.id as whid
+from ProductStockView ps left outer join ps.product as Product
+left outer join ps.storageBin as Locator
+left outer join Locator.warehouse as Warehouse
+left outer join Product.productCategory as ProductCategory
+left outer join Warehouse.organization as Organization
+left outer join ps.uOM as UOM
+left outer join ps.attributeSetValue as AttributeSetInstance
+where ps.client.id=:client
+and ps.organization.id IN (:organizationList)
+and Product.stocked='Y'
+and @optional_filters@
+group by Organization.name, Warehouse.name, Organization.id, Product.searchKey, Product.name, Product.id, ProductCategory.name, ProductCategory.id, UOM.name, AttributeSetInstance.description,Warehouse.id
+order by Warehouse.name, Product.name, sum(ps.quantityOnHand) desc]]></HQL>
+<!--53389C2060AD4DBEA1F9009A3C82B63F-->  <TYPE><![CDATA[HQL]]></TYPE>
+<!--53389C2060AD4DBEA1F9009A3C82B63F--></OBCQL_WIDGET_QUERY>
+
 <!--CFDF8EE593F04CFE9709F5AD19A3A573--><OBCQL_WIDGET_QUERY>
 <!--CFDF8EE593F04CFE9709F5AD19A3A573-->  <OBCQL_WIDGET_QUERY_ID><![CDATA[CFDF8EE593F04CFE9709F5AD19A3A573]]></OBCQL_WIDGET_QUERY_ID>
 <!--CFDF8EE593F04CFE9709F5AD19A3A573-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBKMO_WIDGET_CLASS.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBKMO_WIDGET_CLASS.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -47,6 +47,22 @@
 <!--35002C82027448708D173B75FB27D037-->  <ACCESSLEVEL><![CDATA[3]]></ACCESSLEVEL>
 <!--35002C82027448708D173B75FB27D037--></OBKMO_WIDGET_CLASS>
 
+<!--5B41A19E11494C519BE33BBED6012DAE--><OBKMO_WIDGET_CLASS>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></OBKMO_WIDGET_CLASS_ID>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <TITLE><![CDATA[Stock by Warehouse]]></TITLE>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <HEIGHT><![CDATA[300]]></HEIGHT>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <DESCRIPTION><![CDATA[Stock product by warehouse, attribute and unit of measure]]></DESCRIPTION>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <ALLOW_ANONYMOUS_ACCESS><![CDATA[Y]]></ALLOW_ANONYMOUS_ACCESS>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <ISSUPERCLASS><![CDATA[N]]></ISSUPERCLASS>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <WIDGET_SUPERCLASS_ID><![CDATA[2A32CF26F3F64FE39C7F94E9D82497D1]]></WIDGET_SUPERCLASS_ID>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <CAN_MAXIMIZE><![CDATA[N]]></CAN_MAXIMIZE>
+<!--5B41A19E11494C519BE33BBED6012DAE-->  <ACCESSLEVEL><![CDATA[3]]></ACCESSLEVEL>
+<!--5B41A19E11494C519BE33BBED6012DAE--></OBKMO_WIDGET_CLASS>
+
 <!--5EA740A9473048CFA6B6F1FB6F5576AC--><OBKMO_WIDGET_CLASS>
 <!--5EA740A9473048CFA6B6F1FB6F5576AC-->  <OBKMO_WIDGET_CLASS_ID><![CDATA[5EA740A9473048CFA6B6F1FB6F5576AC]]></OBKMO_WIDGET_CLASS_ID>
 <!--5EA740A9473048CFA6B6F1FB6F5576AC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.client.widgets/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -168,6 +168,26 @@
 <!--5479B44FEC814ACF825FA3B66D6DF25B-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[862EEC18D6FC4FA68E7867E3CF337CC7]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--5479B44FEC814ACF825FA3B66D6DF25B--></OBUIAPP_PARAMETER>
 
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF--><OBUIAPP_PARAMETER>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <OBUIAPP_PARAMETER_ID><![CDATA[5DA6BE86940349C58FF5A3CC9A3F8FFF]]></OBUIAPP_PARAMETER_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <NAME><![CDATA[Number of Rows]]></NAME>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <SEQNO><![CDATA[0]]></SEQNO>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <AD_REFERENCE_ID><![CDATA[11]]></AD_REFERENCE_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <COLUMNNAME><![CDATA[RowsNumber]]></COLUMNNAME>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <AD_ELEMENT_ID><![CDATA[9A0C92898CF17AC8E040007F01003160]]></AD_ELEMENT_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></EM_OBKMO_WIDGET_CLASS_ID>
+<!--5DA6BE86940349C58FF5A3CC9A3F8FFF--></OBUIAPP_PARAMETER>
+
 <!--61C0446937F449BC9FC32EC62857C504--><OBUIAPP_PARAMETER>
 <!--61C0446937F449BC9FC32EC62857C504-->  <OBUIAPP_PARAMETER_ID><![CDATA[61C0446937F449BC9FC32EC62857C504]]></OBUIAPP_PARAMETER_ID>
 <!--61C0446937F449BC9FC32EC62857C504-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -253,6 +273,27 @@
 <!--8DD513DA573E43FF8C1F89B758049767-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[CD1B06C4ED974B5F905A5A01B097DF4E]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--8DD513DA573E43FF8C1F89B758049767--></OBUIAPP_PARAMETER>
 
+<!--A4C8A10329CB458AA1467AB38CFD521A--><OBUIAPP_PARAMETER>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <OBUIAPP_PARAMETER_ID><![CDATA[A4C8A10329CB458AA1467AB38CFD521A]]></OBUIAPP_PARAMETER_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <NAME><![CDATA[Show all data]]></NAME>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <COLUMNNAME><![CDATA[showAll]]></COLUMNNAME>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <DEFAULTVALUE><![CDATA[false]]></DEFAULTVALUE>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <AD_ELEMENT_ID><![CDATA[9A0C92898CEE7AC8E040007F01003160]]></AD_ELEMENT_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--A4C8A10329CB458AA1467AB38CFD521A-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></EM_OBKMO_WIDGET_CLASS_ID>
+<!--A4C8A10329CB458AA1467AB38CFD521A--></OBUIAPP_PARAMETER>
+
 <!--A5FAD3FDF3164692A0FA05DEFF5BBC0B--><OBUIAPP_PARAMETER>
 <!--A5FAD3FDF3164692A0FA05DEFF5BBC0B-->  <OBUIAPP_PARAMETER_ID><![CDATA[A5FAD3FDF3164692A0FA05DEFF5BBC0B]]></OBUIAPP_PARAMETER_ID>
 <!--A5FAD3FDF3164692A0FA05DEFF5BBC0B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -274,6 +315,27 @@
 <!--A5FAD3FDF3164692A0FA05DEFF5BBC0B-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[862EEC18D6FC4FA68E7867E3CF337CC7]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--A5FAD3FDF3164692A0FA05DEFF5BBC0B--></OBUIAPP_PARAMETER>
 
+<!--A7EBA6BDA2C248378C86EF1B162423AE--><OBUIAPP_PARAMETER>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <OBUIAPP_PARAMETER_ID><![CDATA[A7EBA6BDA2C248378C86EF1B162423AE]]></OBUIAPP_PARAMETER_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <NAME><![CDATA[Client]]></NAME>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <COLUMNNAME><![CDATA[client]]></COLUMNNAME>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <AD_ELEMENT_ID><![CDATA[9C7735D7BEBF3C9EE040A8C0EB06271C]]></AD_ELEMENT_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <ISFIXED><![CDATA[Y]]></ISFIXED>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <FIXEDVALUE><![CDATA[OB.getContext().getCurrentClient().id]]></FIXEDVALUE>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <EVALUATEFIXEDVALUE><![CDATA[Y]]></EVALUATEFIXEDVALUE>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--A7EBA6BDA2C248378C86EF1B162423AE-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></EM_OBKMO_WIDGET_CLASS_ID>
+<!--A7EBA6BDA2C248378C86EF1B162423AE--></OBUIAPP_PARAMETER>
+
 <!--B181513A8B0141FB953295A0F1D02DDA--><OBUIAPP_PARAMETER>
 <!--B181513A8B0141FB953295A0F1D02DDA-->  <OBUIAPP_PARAMETER_ID><![CDATA[B181513A8B0141FB953295A0F1D02DDA]]></OBUIAPP_PARAMETER_ID>
 <!--B181513A8B0141FB953295A0F1D02DDA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -408,4 +470,25 @@
 <!--DF2B5B0735884B4A951E72F10724D48A-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[8A6B99392E2B4192012E2B58F5790056]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--DF2B5B0735884B4A951E72F10724D48A--></OBUIAPP_PARAMETER>
 
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D--><OBUIAPP_PARAMETER>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <OBUIAPP_PARAMETER_ID><![CDATA[E4CE808DC1B047158DB2AE1E20D5EE1D]]></OBUIAPP_PARAMETER_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <AD_MODULE_ID><![CDATA[FF8080812D842086012D844F3CC0003E]]></AD_MODULE_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <NAME><![CDATA[Organization List]]></NAME>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <COLUMNNAME><![CDATA[organizationList]]></COLUMNNAME>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <AD_ELEMENT_ID><![CDATA[32873C7A39ED464F9D781AB4BE08323B]]></AD_ELEMENT_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <ISFIXED><![CDATA[Y]]></ISFIXED>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <FIXEDVALUE><![CDATA[OB.getContext().getReadableOrganizations()]]></FIXEDVALUE>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <EVALUATEFIXEDVALUE><![CDATA[Y]]></EVALUATEFIXEDVALUE>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[5B41A19E11494C519BE33BBED6012DAE]]></EM_OBKMO_WIDGET_CLASS_ID>
+<!--E4CE808DC1B047158DB2AE1E20D5EE1D--></OBUIAPP_PARAMETER>
+
 </data>
--- a/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION><![CDATA[3.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--2A5EE903D7974AC298C0504FBC4501A7-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--A3B449C4D5FE4D688CC58236FE33B802-->  <STARTVERSION><![CDATA[3.0.20523]]></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.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION><![CDATA[1.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--3A3A943684D64DEF9EC39F588A656848-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--64060E9EE9EC408BBFFD0CC2DE25C86F-->  <STARTVERSION><![CDATA[3.0.20523]]></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.service.datasource/src-db/database/model/tables/OBSERDS_DATASOURCE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/model/tables/OBSERDS_DATASOURCE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -61,6 +61,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="USEASTABLEDATAORIGIN" 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="OBSERDS_DS_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -79,6 +83,7 @@
       <unique name="OBSERDS_DATASOURCE_NAME">
         <unique-column name="NAME"/>
       </unique>
+      <check name="OBSERDS_DS_DATAORIGIN_CHECK"><![CDATA[USEASTABLEDATAORIGIN IN ('Y', 'N')]]></check>
       <check name="OBSERDS_DS_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
     </table>
   </database>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_COLUMN.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_COLUMN.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -155,6 +155,7 @@
 <!--21517DD232744C1AA340826C3569D4A6-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--21517DD232744C1AA340826C3569D4A6-->  <AD_VAL_RULE_ID><![CDATA[C45CFD74FF5145B0A356E9233D49996F]]></AD_VAL_RULE_ID>
 <!--21517DD232744C1AA340826C3569D4A6-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--21517DD232744C1AA340826C3569D4A6-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT MAX(AD_MODULE_ID) FROM AD_MODULE WHERE ISDEFAULT='Y']]></DEFAULTVALUE>
 <!--21517DD232744C1AA340826C3569D4A6-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--21517DD232744C1AA340826C3569D4A6-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--21517DD232744C1AA340826C3569D4A6-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
@@ -716,6 +717,42 @@
 <!--9DB971B1A60A42518768915556E680D0-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--9DB971B1A60A42518768915556E680D0--></AD_COLUMN>
 
+<!--A3A0E440E92F409D9C711A91C69B7D80--><AD_COLUMN>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_COLUMN_ID><![CDATA[A3A0E440E92F409D9C711A91C69B7D80]]></AD_COLUMN_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <NAME><![CDATA[UseAsTableDataOrigin]]></NAME>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <DESCRIPTION><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window]]></DESCRIPTION>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <HELP><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window. In that case, the Table and Column subtabs of the Datasource window are hidden, because the columns of the datasource must be defined in the Columns tab of the Tables and Columns window.]]></HELP>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <COLUMNNAME><![CDATA[Useastabledataorigin]]></COLUMNNAME>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_TABLE_ID><![CDATA[B3283A801AAC411582CAAF6B99640CD8]]></AD_TABLE_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <SEQNO><![CDATA[160]]></SEQNO>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_ELEMENT_ID><![CDATA[9D90F1136B8048D590DC661CF73DFCF6]]></AD_ELEMENT_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <POSITION><![CDATA[16]]></POSITION>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--A3A0E440E92F409D9C711A91C69B7D80-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--A3A0E440E92F409D9C711A91C69B7D80--></AD_COLUMN>
+
 <!--A58BB4E7A5F145A0957573BDEB0434E9--><AD_COLUMN>
 <!--A58BB4E7A5F145A0957573BDEB0434E9-->  <AD_COLUMN_ID><![CDATA[A58BB4E7A5F145A0957573BDEB0434E9]]></AD_COLUMN_ID>
 <!--A58BB4E7A5F145A0957573BDEB0434E9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -920,6 +957,7 @@
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
+<!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <POSITION><![CDATA[10]]></POSITION>
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--E4EF3E50D3A54F53B3F6C2BF777F9967-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -56,6 +56,20 @@
 <!--73C534367AFA4C28A9F8767D59AAE37E-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--73C534367AFA4C28A9F8767D59AAE37E--></AD_ELEMENT>
 
+<!--9D90F1136B8048D590DC661CF73DFCF6--><AD_ELEMENT>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <AD_ELEMENT_ID><![CDATA[9D90F1136B8048D590DC661CF73DFCF6]]></AD_ELEMENT_ID>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <COLUMNNAME><![CDATA[Useastabledataorigin]]></COLUMNNAME>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <NAME><![CDATA[Use As Table Data Origin]]></NAME>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <PRINTNAME><![CDATA[UseAsTableDataOrigin]]></PRINTNAME>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <DESCRIPTION><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window]]></DESCRIPTION>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <HELP><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window. In that case, the Table and Column subtabs of the Datasource window are hidden, because the columns of the datasource must be defined in the Columns tab of the Tables and Columns window.]]></HELP>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
+<!--9D90F1136B8048D590DC661CF73DFCF6-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--9D90F1136B8048D590DC661CF73DFCF6--></AD_ELEMENT>
+
 <!--D8467987FB7A4EA6AADCB5500A96CBDB--><AD_ELEMENT>
 <!--D8467987FB7A4EA6AADCB5500A96CBDB-->  <AD_ELEMENT_ID><![CDATA[D8467987FB7A4EA6AADCB5500A96CBDB]]></AD_ELEMENT_ID>
 <!--D8467987FB7A4EA6AADCB5500A96CBDB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -139,6 +139,34 @@
 <!--26E08A464B024107BD27E0F8D4FA7648-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--26E08A464B024107BD27E0F8D4FA7648--></AD_FIELD>
 
+<!--43C1B7287F7F4A7CACA7132AE63DE02B--><AD_FIELD>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_FIELD_ID><![CDATA[43C1B7287F7F4A7CACA7132AE63DE02B]]></AD_FIELD_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <NAME><![CDATA[Use As Table Data Origin]]></NAME>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <DESCRIPTION><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window]]></DESCRIPTION>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <HELP><![CDATA[A flag indicating whether this datasource is used as a data origin in the Table window. In that case, the Table and Column subtabs of the Datasource window are hidden, because the columns of the datasource must be defined in the Columns tab of the Tables and Columns window.]]></HELP>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_TAB_ID><![CDATA[EFA7EFCFC6E14827B109D88F236A0B6C]]></AD_TAB_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_COLUMN_ID><![CDATA[A3A0E440E92F409D9C711A91C69B7D80]]></AD_COLUMN_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--43C1B7287F7F4A7CACA7132AE63DE02B--></AD_FIELD>
+
 <!--4AA80C1B900F429A91E12B547562DCE8--><AD_FIELD>
 <!--4AA80C1B900F429A91E12B547562DCE8-->  <AD_FIELD_ID><![CDATA[4AA80C1B900F429A91E12B547562DCE8]]></AD_FIELD_ID>
 <!--4AA80C1B900F429A91E12B547562DCE8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -444,7 +472,7 @@
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--B67E9A7DAC2E4AE99239612D0782836A-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--B67E9A7DAC2E4AE99239612D0782836A-->  <SEQNO><![CDATA[90]]></SEQNO>
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--B67E9A7DAC2E4AE99239612D0782836A-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION><![CDATA[2.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--A44B9BA75C354D8FB2E3F7D6EB6BFDC4-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--0BA071C783CC4984AC9C03BB7CAA87C7-->  <STARTVERSION><![CDATA[1.1.20523]]></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.20088]]></STARTVERSION>
+<!--3E531F0CD0A54130996F5AF3B6A2D01B-->  <STARTVERSION><![CDATA[2.0.20523]]></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.20088]]></STARTVERSION>
+<!--4FCE95802A854F7E8623AFF7C33D13EE-->  <STARTVERSION><![CDATA[3.0.20523]]></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.20088]]></STARTVERSION>
+<!--54AF8B39C55E4E7496902893ECD82786-->  <STARTVERSION><![CDATA[2.1.20523]]></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.20088]]></STARTVERSION>
+<!--D03C56D8A4E14F45A5466350E05C631F-->  <STARTVERSION><![CDATA[8.1.20523]]></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-db/database/sourcedata/AD_TAB.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_TAB.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -23,6 +23,7 @@
 <!--D7508D810A3B438D8D6B6760E2855334-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
 <!--D7508D810A3B438D8D6B6760E2855334-->  <UIPATTERN><![CDATA[STD]]></UIPATTERN>
 <!--D7508D810A3B438D8D6B6760E2855334-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
+<!--D7508D810A3B438D8D6B6760E2855334-->  <DISPLAYLOGIC><![CDATA[@Useastabledataorigin@!'Y']]></DISPLAYLOGIC>
 <!--D7508D810A3B438D8D6B6760E2855334-->  <EM_OBUIAPP_CAN_ADD><![CDATA[N]]></EM_OBUIAPP_CAN_ADD>
 <!--D7508D810A3B438D8D6B6760E2855334-->  <EM_OBUIAPP_CAN_DELETE><![CDATA[N]]></EM_OBUIAPP_CAN_DELETE>
 <!--D7508D810A3B438D8D6B6760E2855334-->  <EM_OBUIAPP_SHOW_SELECT><![CDATA[Y]]></EM_OBUIAPP_SHOW_SELECT>
--- a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -21,6 +21,7 @@
 <!--B3283A801AAC411582CAAF6B99640CD8-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--B3283A801AAC411582CAAF6B99640CD8-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--B3283A801AAC411582CAAF6B99640CD8-->  <AD_PACKAGE_ID><![CDATA[6410C86F580143D3B981F18A4B9C53EA]]></AD_PACKAGE_ID>
+<!--B3283A801AAC411582CAAF6B99640CD8-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--B3283A801AAC411582CAAF6B99640CD8--></AD_TABLE>
 
 <!--FC969D8F4327475095917840EC155462--><AD_TABLE>
@@ -43,6 +44,7 @@
 <!--FC969D8F4327475095917840EC155462-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FC969D8F4327475095917840EC155462-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FC969D8F4327475095917840EC155462-->  <AD_PACKAGE_ID><![CDATA[6410C86F580143D3B981F18A4B9C53EA]]></AD_PACKAGE_ID>
+<!--FC969D8F4327475095917840EC155462-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FC969D8F4327475095917840EC155462--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceProperty.java	Thu Jun 27 10:02:33 2013 +0200
@@ -140,7 +140,6 @@
    * 
    * @param reference
    *          List reference
-   * @return
    */
   public static Set<String> getAllowedValues(Reference reference) {
     Set<String> allowedValues = new HashSet<String>();
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServiceProvider.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServiceProvider.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -29,9 +29,11 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.util.OBClassLoader;
 import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.ad.datamodel.Table;
 
 /**
  * Provides {@link DataSourceService} instances and caches them in a global cache.
@@ -73,10 +75,22 @@
           }
         }
         if (dataSource == null) {
-          ds = weldUtils.getInstance(DefaultDataSourceService.class);
-          ds.setName(name);
-          ds.setEntity(ModelProvider.getInstance().getEntity(name));
-          dataSources.put(name, ds);
+          final OBCriteria<Table> qTable = OBDal.getInstance().createCriteria(Table.class);
+          qTable.add(Restrictions.eq(Table.PROPERTY_NAME, name));
+          if (!qTable.list().isEmpty()) {
+            Table table = (Table) qTable.list().get(0);
+            if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(table.getDataOriginType())) {
+              dataSource = table.getObserdsDatasource();
+              ds.setEntity(ModelProvider.getInstance().getEntityByTableId(table.getId()));
+            }
+          }
+          if (dataSource == null) {
+            ds = weldUtils.getInstance(DefaultDataSourceService.class);
+            ds.setName(name);
+            ds.setEntity(ModelProvider.getInstance().getEntity(name));
+            dataSources.put(name, ds);
+          }
+
         } else {
           if (dataSource.getJavaClassName() != null) {
             final Class<DataSourceService> clz = (Class<DataSourceService>) OBClassLoader
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -78,6 +78,7 @@
 import org.openbravo.model.ad.ui.FieldTrl;
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.ad.ui.Window;
+import org.openbravo.portal.PortalAccessible;
 import org.openbravo.service.json.DefaultJsonDataService;
 import org.openbravo.service.json.JsonConstants;
 import org.openbravo.service.json.JsonUtils;
@@ -120,6 +121,15 @@
       throws ServletException, IOException {
 
     try {
+      if (OBContext.getOBContext() != null && OBContext.getOBContext().isPortalRole()) {
+        if (!(getDataSource(request) instanceof PortalAccessible)) {
+          log.error("Portal user " + OBContext.getOBContext().getUser() + " with role "
+              + OBContext.getOBContext().getRole()
+              + " is trying to access to non granted datasource " + request.getRequestURL());
+          throw new OBSecurityException();
+        }
+      }
+
       SessionInfo.setModuleId(request.getParameter("moduleId"));
       SessionInfo.setCommand(request.getParameter(DataSourceConstants.OPERATION_TYPE_PARAM));
       SessionInfo.setProcessId(request.getParameter("tabId"));
--- a/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--FF8080813129ADA401312CA1222A0005-->  <VERSION><![CDATA[0.1.20523]]></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.
@@ -18,7 +18,7 @@
 <!--FF8080813129ADA401312CA1222A0005-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--FF8080813129ADA401312CA1222A0005-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--FF8080813129ADA401312CA1222A0005-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--FF8080813129ADA401312CA1222A0005-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--FF8080813129ADA401312CA1222A0005-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--FF8080813141B198013141BA0F7D0012-->  <STARTVERSION><![CDATA[0.1.20523]]></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.20088]]></STARTVERSION>
+<!--FF8080813151AEE1013151C4ACE6001B-->  <STARTVERSION><![CDATA[2.1.20523]]></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.google/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -18,6 +18,7 @@
 <!--FF8080813161A3D301316206A5840008-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF8080813161A3D301316206A5840008-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF8080813161A3D301316206A5840008-->  <AD_PACKAGE_ID><![CDATA[FF8080813129ADA401312CAC54900029]]></AD_PACKAGE_ID>
+<!--FF8080813161A3D301316206A5840008-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF8080813161A3D301316206A5840008--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--FF8080813141B198013141B86DD70003-->  <VERSION><![CDATA[0.1.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--FF8080813141B198013141B86DD70003-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--FF8080813141B198013141B8B21B0006-->  <STARTVERSION><![CDATA[3.0.20523]]></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.integration.openid/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -18,6 +18,7 @@
 <!--FF808081314B80C001314B976A49000C-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--FF808081314B80C001314B976A49000C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--FF808081314B80C001314B976A49000C-->  <AD_PACKAGE_ID><![CDATA[FF808081314B80C001314B95ADB90008]]></AD_PACKAGE_ID>
+<!--FF808081314B80C001314B976A49000C-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--FF808081314B80C001314B976A49000C--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></VERSION>
+<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION><![CDATA[2.0.20523]]></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[MP22.3]]></VERSION_LABEL>
+<!--F8D1B3ECB3474E8DA5C216473C840DF1-->  <VERSION_LABEL><![CDATA[MP24]]></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 Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -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.20088]]></STARTVERSION>
+<!--9E3E7B42DB16405FB794496D309D7044-->  <STARTVERSION><![CDATA[3.0.20523]]></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/AdvancedQueryBuilder.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Jun 27 10:02:33 2013 +0200
@@ -28,6 +28,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
 import org.codehaus.jettison.json.JSONArray;
@@ -510,7 +512,7 @@
                 && referencedTable.getDisplayedColumn().isActive()) {
               useProperty = property.getEntity().getPropertyByColumnName(
                   referencedTable.getDisplayedColumn().getDBColumnName());
-              final int index = useFieldName.indexOf(DalUtil.DOT);
+              final int index = useFieldName.lastIndexOf(DalUtil.DOT);
               useFieldName = useFieldName.substring(0, index + 1) + useProperty.getName();
               break;
             }
@@ -1146,7 +1148,26 @@
   }
 
   protected String getOrderByClausePart(String orderByParam) {
-    String localOrderBy = orderByParam;
+    // Support for one argument functions
+    String functionPattern = "(.*)\\((.*)\\) (desc|DESC)+";
+    Pattern p = Pattern.compile(functionPattern);
+    Matcher m = p.matcher(orderByParam);
+
+    String localOrderBy = null;
+    String functionName = null;
+    boolean descOrderedFunction = false;
+    if (m.find()) {
+      // If it is a function, retrieve the function name and the localOrderBy
+      functionName = m.group(1);
+      localOrderBy = m.group(2);
+      if (m.groupCount() == 3) {
+        // Check if the property is to be ordered in descending order
+        descOrderedFunction = true;
+      }
+    } else {
+      localOrderBy = orderByParam;
+    }
+
     final boolean asc = !localOrderBy.startsWith("-");
     String direction = "";
     if (!asc) {
@@ -1215,7 +1236,15 @@
       sb.append(resolvedPath);
       sb.append(direction);
     }
-    return sb.toString();
+
+    String orderByClausePart = sb.toString();
+    if (functionName != null) {
+      orderByClausePart = functionName + "(" + orderByClausePart + ")";
+      if (descOrderedFunction) {
+        orderByClausePart = orderByClausePart + " desc";
+      }
+    }
+    return orderByClausePart;
   }
 
   // Creates a Hibernate concatenation if there are multiple identifierproperties
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2013 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -32,11 +32,14 @@
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
+import org.openbravo.base.model.domaintype.TableDomainType;
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.base.util.Check;
+import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
+import org.openbravo.model.ad.datamodel.Column;
 
 /**
  * Implements a service which can handle different types of query and paging options. This class
@@ -56,8 +59,6 @@
 
   public static final String PARAM_DELIMITER = "@";
 
-  private static final long serialVersionUID = 1L;
-
   private String entityName;
   private Integer firstResult = null;
   private Integer maxResults = null;
@@ -65,6 +66,9 @@
   private boolean filterOnActive = true;
   private AdvancedQueryBuilder queryBuilder = new AdvancedQueryBuilder();
 
+  private boolean filterOnReadableOrganizations = true;
+  private boolean filterOnReadableClients = true;
+
   private String distinct;
 
   private String summarySettings;
@@ -79,6 +83,8 @@
     Check.isNotNull(entityName, "entityName must be set");
     final OBQuery<BaseOBObject> obq = OBDal.getInstance().createQuery(entityName,
         queryBuilder.getJoinClause() + queryBuilder.getWhereClause());
+    obq.setFilterOnReadableClients(isFilterOnReadableClients());
+    obq.setFilterOnReadableOrganization(isFilterOnReadableOrganizations());
 
     if (queryBuilder.hasOrganizationParameter()) {
       obq.setFilterOnReadableOrganization(false);
@@ -121,16 +127,18 @@
     log.debug("Querying for " + entityName + " " + whereOrderBy);
 
     final OBQuery<BaseOBObject> obq = OBDal.getInstance().createQuery(entityName, whereOrderBy);
+    obq.setFilterOnReadableClients(isFilterOnReadableClients());
+    obq.setFilterOnReadableOrganization(isFilterOnReadableOrganizations());
+
     if (getSummarySettings() != null) {
       obq.setSelectClause(queryBuilder.getSelectClause());
     } else if (getDistinct() != null) {
       final String localDistinct = getDistinct();
       queryBuilder.addSelectClausePart(localDistinct + ".id");
 
-      final Property property = DalUtil.getPropertyFromPath(
-          ModelProvider.getInstance().getEntity(getEntityName()), localDistinct);
+      final List<Property> properties = getDistinctDisplayProperties();
 
-      for (Property identifierProp : property.getTargetEntity().getIdentifierProperties()) {
+      for (Property identifierProp : properties) {
         if (identifierProp.getTargetEntity() != null) {
           // go one level deeper
           final List<Property> nextIdentifierProps = JsonUtils.getIdentifierSet(identifierProp);
@@ -165,6 +173,33 @@
     return obq;
   }
 
+  // package private on purpose
+  List<Property> getDistinctDisplayProperties() {
+    final String localDistinct = getDistinct();
+    final List<Property> properties = new ArrayList<Property>();
+    final Property property = DalUtil.getPropertyFromPath(
+        ModelProvider.getInstance().getEntity(getEntityName()), localDistinct);
+
+    // now use the table reference definition or select on the identifier properties
+    if (property.getDomainType() instanceof TableDomainType
+        && ((TableDomainType) property.getDomainType()).getRefTable() != null) {
+      final TableDomainType domainType = (TableDomainType) property.getDomainType();
+      final Property displayProp = KernelUtils.getInstance().getPropertyFromColumn(
+          OBDal.getInstance()
+              .get(Column.class, domainType.getRefTable().getDisplayColumn().getId()));
+      if (displayProp != null) {
+        properties.add(displayProp);
+      }
+    }
+
+    if (properties.isEmpty()) {
+      for (Property identifierProp : property.getTargetEntity().getIdentifierProperties()) {
+        properties.add(identifierProp);
+      }
+    }
+    return properties;
+  }
+
   public int getRowNumber(String targetRecordId) {
     final String whereOrderBy = queryBuilder.getJoinClause() + queryBuilder.getWhereClause()
         + queryBuilder.getOrderByClause();
@@ -174,6 +209,8 @@
     // System.err.println("Querying for " + entityName + " " + whereOrderBy);
 
     final OBQuery<BaseOBObject> obq = OBDal.getInstance().createQuery(entityName, whereOrderBy);
+    obq.setFilterOnReadableClients(isFilterOnReadableClients());
+    obq.setFilterOnReadableOrganization(isFilterOnReadableOrganizations());
 
     if (queryBuilder.hasOrganizationParameter()) {
       obq.setFilterOnReadableOrganization(false);
@@ -312,4 +349,20 @@
     return summaryFields;
   }
 
+  public boolean isFilterOnReadableOrganizations() {
+    return filterOnReadableOrganizations;
+  }
+
+  public void setFilterOnReadableOrganizations(boolean filterOnReadableOrganizations) {
+    this.filterOnReadableOrganizations = filterOnReadableOrganizations;
+  }
+
+  public boolean isFilterOnReadableClients() {
+    return filterOnReadableClients;
+  }
+
+  public void setFilterOnReadableClients(boolean filterOnReadableClients) {
+    this.filterOnReadableClients = filterOnReadableClients;
+  }
+
 }
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataToJsonConverter.java	Thu Jun 27 10:02:33 2013 +0200
@@ -262,16 +262,18 @@
           referencingProperty.getDisplayPropertyName());
       if (displayColumnProperty.hasDisplayColumn()) {
         // Allowing one level deep of displayed column pointing to references with display column
-        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
-            ((BaseOBObject) obObject.get(referencingProperty.getDisplayPropertyName()))
-                .get(displayColumnProperty.getDisplayPropertyName()));
+        jsonObject.put(propertyName.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR)
+            + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER, ((BaseOBObject) obObject
+            .get(referencingProperty.getDisplayPropertyName())).get(displayColumnProperty
+            .getDisplayPropertyName()));
       } else if (!displayColumnProperty.isPrimitive()) {
         // Displaying identifier for non primitive properties
-        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
-            ((BaseOBObject) obObject.get(referencingProperty.getDisplayPropertyName()))
-                .getIdentifier());
+        jsonObject.put(propertyName.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR)
+            + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER, ((BaseOBObject) obObject
+            .get(referencingProperty.getDisplayPropertyName())).getIdentifier());
       } else {
-        jsonObject.put(propertyName + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
+        jsonObject.put(propertyName.replace(DalUtil.DOT, DalUtil.FIELDSEPARATOR)
+            + DalUtil.FIELDSEPARATOR + JsonConstants.IDENTIFIER,
             obObject.get(referencingProperty.getDisplayPropertyName()));
       }
     } else {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Thu Jun 27 10:02:33 2013 +0200
@@ -85,6 +85,8 @@
       Check.isNotNull(entityName, "The name of the service/entityname should not be null");
       Check.isNotNull(parameters, "The parameters should not be null");
 
+      String selectedProperties = parameters.get(JsonConstants.SELECTEDPROPERTIES_PARAMETER);
+
       final JSONObject jsonResult = new JSONObject();
       final JSONObject jsonResponse = new JSONObject();
       List<BaseOBObject> bobs;
@@ -178,9 +180,32 @@
           final Property distinctProperty = DalUtil.getPropertyFromPath(ModelProvider.getInstance()
               .getEntity(entityName), distinct);
           final Entity distinctEntity = distinctProperty.getTargetEntity();
+
           final List<Property> properties = new ArrayList<Property>();
           properties.addAll(distinctEntity.getIdProperties());
-          properties.addAll(distinctEntity.getIdentifierProperties());
+          properties.addAll(queryService.getDistinctDisplayProperties());
+
+          // filter the json serialization later on
+          final StringBuilder selectedSb = new StringBuilder();
+          for (Property prop : properties) {
+            if (selectedSb.length() > 0) {
+              selectedSb.append(",");
+            }
+            if (prop.getTargetEntity() != null) {
+              // go one level deeper
+              final List<Property> nextIdentifierProps = JsonUtils.getIdentifierSet(prop);
+              for (Property nextIdentifierProp : nextIdentifierProps) {
+                selectedSb.append(prop.getName() + "." + nextIdentifierProp);
+              }
+            } else {
+              selectedSb.append(prop.getName());
+            }
+          }
+          if (selectedProperties == null) {
+            selectedProperties = selectedSb.toString();
+          } else {
+            selectedProperties += "," + selectedSb.toString();
+          }
 
           bobs = new ArrayList<BaseOBObject>();
 
@@ -229,6 +254,8 @@
           bobs = queryService.list();
         }
 
+        bobs = bobFetchTransformation(bobs, parameters);
+
         if (preventCountOperation) {
           count = bobs.size() + startRow;
           // computedMaxResults is one too much, if we got one to much then correct
@@ -259,8 +286,7 @@
       final DataToJsonConverter toJsonConverter = OBProvider.getInstance().get(
           DataToJsonConverter.class);
       toJsonConverter.setAdditionalProperties(JsonUtils.getAdditionalProperties(parameters));
-      toJsonConverter.setSelectedProperties(parameters
-          .get(JsonConstants.SELECTEDPROPERTIES_PARAMETER));
+      toJsonConverter.setSelectedProperties(selectedProperties);
       final List<JSONObject> jsonObjects = toJsonConverter.toJsonObjects(bobs);
 
       addWritableAttribute(jsonObjects);
@@ -287,31 +313,35 @@
     toJsonConverter.setAdditionalProperties(JsonUtils.getAdditionalProperties(parameters));
 
     final ScrollableResults scrollableResults = queryService.scroll();
-    int i = 0;
-    while (scrollableResults.next()) {
-      final Object result = scrollableResults.get()[0];
-      final JSONObject json = toJsonConverter.toJsonObject((BaseOBObject) result,
-          DataResolvingMode.FULL);
+    try {
+      int i = 0;
+      while (scrollableResults.next()) {
+        final Object result = scrollableResults.get()[0];
+        final JSONObject json = toJsonConverter.toJsonObject((BaseOBObject) result,
+            DataResolvingMode.FULL);
 
-      try {
-        doPostFetch(parameters, json);
-      } catch (JSONException e) {
-        throw new OBException(e);
+        try {
+          doPostFetch(parameters, json);
+        } catch (JSONException e) {
+          throw new OBException(e);
+        }
+
+        writer.write(json);
+
+        i++;
+        // Clear session every 1000 records to prevent huge memory consumption in case of big loops
+        if (i % 1000 == 0) {
+          OBDal.getInstance().getSession().clear();
+          log.debug("clearing in record " + i + " elapsed time " + (System.currentTimeMillis() - t));
+        }
       }
-
-      writer.write(json);
-
-      i++;
-      // Clear session every 1000 records to prevent huge memory consumption in case of big loops
-      if (i % 1000 == 0) {
-        OBDal.getInstance().getSession().clear();
-        log.debug("clearing in record " + i + " elapsed time " + (System.currentTimeMillis() - t));
-      }
+    } finally {
+      scrollableResults.close();
     }
     log.debug("Fetch took " + (System.currentTimeMillis() - t) + " ms");
   }
 
-  private DataEntityQueryService createSetQueryService(Map<String, String> parameters,
+  protected DataEntityQueryService createSetQueryService(Map<String, String> parameters,
       boolean forCountOperation) {
     final String entityName = parameters.get(JsonConstants.ENTITYNAME);
     final String startRowStr = parameters.get(JsonConstants.STARTROW_PARAMETER);
@@ -385,8 +415,7 @@
         && parameters.get(JsonConstants.DISTINCT_PARAMETER).trim().length() > 0) {
       queryService.setDistinct(parameters.get(JsonConstants.DISTINCT_PARAMETER).trim());
       // sortby the distinct's identifier
-      orderBy = queryService.getDistinct() + DalUtil.DOT + JsonConstants.IDENTIFIER + ","
-          + queryService.getDistinct() + DalUtil.DOT + JsonConstants.ID;
+      orderBy = getOrderByForDistinct(entityName, queryService);
     } else {
       // Always append id to the orderby to make a predictable sorting
       orderBy += (orderBy.isEmpty() ? "" : ",") + "id";
@@ -422,6 +451,26 @@
     return queryService;
   }
 
+  private String getOrderByForDistinct(String entityName, DataEntityQueryService queryService) {
+    final String localDistinct = queryService.getDistinct();
+    final List<Property> properties = queryService.getDistinctDisplayProperties();
+    final StringBuilder sb = new StringBuilder();
+    for (Property identifierProp : properties) {
+      if (identifierProp.getTargetEntity() != null) {
+        // go one level deeper
+        final List<Property> nextIdentifierProps = JsonUtils.getIdentifierSet(identifierProp);
+        for (Property nextIdentifierProp : nextIdentifierProps) {
+          sb.append(localDistinct + DalUtil.DOT + identifierProp.getName() + "."
+              + nextIdentifierProp + ",");
+        }
+      } else {
+        sb.append(localDistinct + DalUtil.DOT + identifierProp.getName() + ",");
+      }
+    }
+    sb.append(localDistinct + DalUtil.DOT + JsonConstants.ID);
+    return sb.toString();
+  }
+
   private void addWritableAttribute(List<JSONObject> jsonObjects) throws JSONException {
     for (JSONObject jsonObject : jsonObjects) {
       if (!jsonObject.has("client") || !jsonObject.has("organization")) {
@@ -668,6 +717,19 @@
     public abstract void write(JSONObject json);
   }
 
+  protected List<BaseOBObject> bobFetchTransformation(List<BaseOBObject> bobs,
+      Map<String, String> parameters) {
+    // If is override, take into account:
+    // * If the number of the returned bobs change, there could be problems because endRow and
+    // totalRows parameters will be out-of-sync with that the requester expects, and some values can
+    // be missing in the following fetches. If there is no pagination (all values are returned at
+    // once), there is no problem.
+    // * If any bob is modified, the original entity is being modified, so a good practice could be
+    // clone the bob (using DalUtil.copy, for example) before modify it, and then return the clone.
+
+    return bobs;
+  }
+
   protected String doPreAction(Map<String, String> parameters, String content,
       DataSourceAction action) {
     try {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonRestServlet.java	Thu Jun 27 10:02:33 2013 +0200
@@ -38,6 +38,7 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.base.util.CheckException;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.core.SessionHandler;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.service.web.BaseWebServiceServlet;
@@ -74,6 +75,13 @@
   protected void doService(HttpServletRequest request, HttpServletResponse response)
       throws ServletException, IOException {
     try {
+      if (OBContext.getOBContext() != null && OBContext.getOBContext().isPortalRole()) {
+        // Portal users are not granted to direct web services
+        log.error("Portal user " + OBContext.getOBContext().getUser() + " with role "
+            + OBContext.getOBContext().getRole()
+            + " is trying to access to non granted web service " + request.getRequestURL());
+        throw new OBSecurityException();
+      }
       callServiceInSuper(request, response);
       response.setStatus(200);
     } catch (final InvalidRequestException e) {
--- a/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_COLUMN.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_COLUMN.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -1688,7 +1688,8 @@
 <!--991EB88C248A48A58043C65806DE9708-->  <HELP><![CDATA[The Table indicates the table in which a field or fields reside.]]></HELP>
 <!--991EB88C248A48A58043C65806DE9708-->  <COLUMNNAME><![CDATA[AD_Table_ID]]></COLUMNNAME>
 <!--991EB88C248A48A58043C65806DE9708-->  <AD_TABLE_ID><![CDATA[7E50FCF61A884C9D966D1348705EC17C]]></AD_TABLE_ID>
-<!--991EB88C248A48A58043C65806DE9708-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--991EB88C248A48A58043C65806DE9708-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--991EB88C248A48A58043C65806DE9708-->  <AD_REFERENCE_VALUE_ID><![CDATA[1DBAAD6ABF2E4FE7A4654DDE387B89C9]]></AD_REFERENCE_VALUE_ID>
 <!--991EB88C248A48A58043C65806DE9708-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
 <!--991EB88C248A48A58043C65806DE9708-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--991EB88C248A48A58043C65806DE9708-->  <ISPARENT><![CDATA[N]]></ISPARENT>
--- a/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -6,7 +6,7 @@
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <NAME><![CDATA[User Interface Selector]]></NAME>
-<!--5EB4F15C80684ACA904756BDC12ADBE5-->  <VERSION><![CDATA[2.1.20088]]></VERSION>
+<!--5EB4F15C80684ACA904756BDC12ADBE5-->  <VERSION><![CDATA[2.1.20523]]></VERSION>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <DESCRIPTION><![CDATA[Provides a selector with a suggestion box and popup grid window]]></DESCRIPTION>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <HELP><![CDATA[The Openbravo selector provides new selector functionality which is used inside of existing Openbravo forms. The selector is mainly used for supporting foreign key references in the user interface. The selector combines both suggestion box behavior with a popup grid.]]></HELP>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <URL><![CDATA[http://forge.openbravo.com/projects/selector]]></URL>
@@ -22,7 +22,7 @@
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <UPDATEINFO><![CDATA[Bug fixing & new development for 3.0]]></UPDATEINFO>
-<!--5EB4F15C80684ACA904756BDC12ADBE5-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--5EB4F15C80684ACA904756BDC12ADBE5-->  <VERSION_LABEL><![CDATA[MP24]]></VERSION_LABEL>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--5EB4F15C80684ACA904756BDC12ADBE5-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--5EB4F15C80684ACA904756BDC12ADBE5--></AD_MODULE>
--- a/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -7,7 +7,7 @@
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <AD_DEPENDENT_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_DEPENDENT_MODULE_ID>
-<!--38825CAED43941D38CA0C78DB04FCFA0-->  <STARTVERSION><![CDATA[8.1.20088]]></STARTVERSION>
+<!--38825CAED43941D38CA0C78DB04FCFA0-->  <STARTVERSION><![CDATA[8.1.20523]]></STARTVERSION>
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <DEPENDANT_MODULE_NAME><![CDATA[Smartclient]]></DEPENDANT_MODULE_NAME>
 <!--38825CAED43941D38CA0C78DB04FCFA0-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <AD_DEPENDENT_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_DEPENDENT_MODULE_ID>
-<!--6DDE7B1A70174242AF82B5022FB89279-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--6DDE7B1A70174242AF82B5022FB89279-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Application]]></DEPENDANT_MODULE_NAME>
 <!--6DDE7B1A70174242AF82B5022FB89279-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID>
-<!--94F9CD2CB5EF4467A67475C786C984A7-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--94F9CD2CB5EF4467A67475C786C984A7-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME>
 <!--94F9CD2CB5EF4467A67475C786C984A7-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -49,7 +49,7 @@
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <AD_DEPENDENT_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_DEPENDENT_MODULE_ID>
-<!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <STARTVERSION><![CDATA[1.1.20088]]></STARTVERSION>
+<!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <STARTVERSION><![CDATA[1.1.20523]]></STARTVERSION>
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <DEPENDANT_MODULE_NAME><![CDATA[JBoss Weld]]></DEPENDANT_MODULE_NAME>
 <!--BCCB5A08EC0446DE8BCE191C6BC607A4-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -63,7 +63,7 @@
 <!--C8DAC574B88649D08C9468521B343F12-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--C8DAC574B88649D08C9468521B343F12-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--C8DAC574B88649D08C9468521B343F12-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--C8DAC574B88649D08C9468521B343F12-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--C8DAC574B88649D08C9468521B343F12-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--C8DAC574B88649D08C9468521B343F12-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--C8DAC574B88649D08C9468521B343F12-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--C8DAC574B88649D08C9468521B343F12-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -77,7 +77,7 @@
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <AD_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_MODULE_ID>
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <AD_DEPENDENT_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_DEPENDENT_MODULE_ID>
-<!--F14EB17946BE4724A46F80CB1A47EC70-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--F14EB17946BE4724A46F80CB1A47EC70-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <DEPENDANT_MODULE_NAME><![CDATA[JSON Datasource]]></DEPENDANT_MODULE_NAME>
 <!--F14EB17946BE4724A46F80CB1A47EC70-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_TABLE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_TABLE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -20,6 +20,7 @@
 <!--2AB26D8C93234EDFA52778276242BBA2-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--2AB26D8C93234EDFA52778276242BBA2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--2AB26D8C93234EDFA52778276242BBA2-->  <AD_PACKAGE_ID><![CDATA[2F1EAE1A2DA24B9DBEA1E9E59E8C9DA4]]></AD_PACKAGE_ID>
+<!--2AB26D8C93234EDFA52778276242BBA2-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--2AB26D8C93234EDFA52778276242BBA2--></AD_TABLE>
 
 <!--7E50FCF61A884C9D966D1348705EC17C--><AD_TABLE>
@@ -42,6 +43,7 @@
 <!--7E50FCF61A884C9D966D1348705EC17C-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--7E50FCF61A884C9D966D1348705EC17C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--7E50FCF61A884C9D966D1348705EC17C-->  <AD_PACKAGE_ID><![CDATA[2F1EAE1A2DA24B9DBEA1E9E59E8C9DA4]]></AD_PACKAGE_ID>
+<!--7E50FCF61A884C9D966D1348705EC17C-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--7E50FCF61A884C9D966D1348705EC17C--></AD_TABLE>
 
 <!--956C43EAF12D44EBA06071EF0610FA15--><AD_TABLE>
@@ -64,6 +66,7 @@
 <!--956C43EAF12D44EBA06071EF0610FA15-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--956C43EAF12D44EBA06071EF0610FA15-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--956C43EAF12D44EBA06071EF0610FA15-->  <AD_PACKAGE_ID><![CDATA[2F1EAE1A2DA24B9DBEA1E9E59E8C9DA4]]></AD_PACKAGE_ID>
+<!--956C43EAF12D44EBA06071EF0610FA15-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--956C43EAF12D44EBA06071EF0610FA15--></AD_TABLE>
 
 <!--A2F880F9981349E2A6A57BD58267EBCE--><AD_TABLE>
@@ -86,6 +89,7 @@
 <!--A2F880F9981349E2A6A57BD58267EBCE-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
 <!--A2F880F9981349E2A6A57BD58267EBCE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--A2F880F9981349E2A6A57BD58267EBCE-->  <AD_PACKAGE_ID><![CDATA[2F1EAE1A2DA24B9DBEA1E9E59E8C9DA4]]></AD_PACKAGE_ID>
+<!--A2F880F9981349E2A6A57BD58267EBCE-->  <DATAORIGINTYPE><![CDATA[Table]]></DATAORIGINTYPE>
 <!--A2F880F9981349E2A6A57BD58267EBCE--></AD_TABLE>
 
 </data>
--- a/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -10,6 +10,7 @@
 <!--5C8B84FA41CE4876B26B9E96A9E909BD-->  <CLASSNAME><![CDATA[org.openbravo.service.datasource.ModelDataSourceService]]></CLASSNAME>
 <!--5C8B84FA41CE4876B26B9E96A9E909BD-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
 <!--5C8B84FA41CE4876B26B9E96A9E909BD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5C8B84FA41CE4876B26B9E96A9E909BD-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
 <!--5C8B84FA41CE4876B26B9E96A9E909BD--></OBSERDS_DATASOURCE>
 
 <!--83B60C4C19AE4A9EBA947B948C5BA04D--><OBSERDS_DATASOURCE>
@@ -22,6 +23,7 @@
 <!--83B60C4C19AE4A9EBA947B948C5BA04D-->  <CLASSNAME><![CDATA[org.openbravo.userinterface.selector.SelectorFieldPropertyDataSource]]></CLASSNAME>
 <!--83B60C4C19AE4A9EBA947B948C5BA04D-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
 <!--83B60C4C19AE4A9EBA947B948C5BA04D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--83B60C4C19AE4A9EBA947B948C5BA04D-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
 <!--83B60C4C19AE4A9EBA947B948C5BA04D--></OBSERDS_DATASOURCE>
 
 <!--F8DD408F2F3A414188668836F84C21AF--><OBSERDS_DATASOURCE>
@@ -33,6 +35,7 @@
 <!--F8DD408F2F3A414188668836F84C21AF-->  <CLASSNAME><![CDATA[org.openbravo.userinterface.selector.CustomQuerySelectorDatasource]]></CLASSNAME>
 <!--F8DD408F2F3A414188668836F84C21AF-->  <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID>
 <!--F8DD408F2F3A414188668836F84C21AF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F8DD408F2F3A414188668836F84C21AF-->  <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN>
 <!--F8DD408F2F3A414188668836F84C21AF--></OBSERDS_DATASOURCE>
 
 </data>
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Thu Jun 27 10:02:33 2013 +0200
@@ -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 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -103,11 +103,15 @@
         // Defaulted to endRow + 2 to check for more records while scrolling.
         totalRows = endRow + 2;
         ScrollableResults queryResults = selQuery.scroll(ScrollMode.FORWARD_ONLY);
-        while (queryResults.next()) {
-          queryListSize++;
-          if (queryListSize % clearEachLoop == 0) {
-            OBDal.getInstance().getSession().clear();
+        try {
+          while (queryResults.next()) {
+            queryListSize++;
+            if (queryListSize % clearEachLoop == 0) {
+              OBDal.getInstance().getSession().clear();
+            }
           }
+        } finally {
+          queryResults.close();
         }
         if (startRow < endRow) {
           if (queryListSize < endRow) {
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Thu Jun 27 10:02:33 2013 +0200
@@ -27,6 +27,7 @@
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.base.util.Check;
 import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.client.application.ApplicationConstants;
 import org.openbravo.client.application.Parameter;
 import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.client.kernel.reference.ForeignKeyUIDefinition;
@@ -109,9 +110,28 @@
       // fallback to the default
       return null;
     }
-    final String result = (prop.getName() + DalUtil.FIELDSEPARATOR + displayFieldName).replace(".",
-        DalUtil.FIELDSEPARATOR);
-    return result;
+
+    if (!prop.getReferencedProperty().getEntity().hasProperty(getFirstProperty(displayFieldName))) {
+      // If the first property of the display field name does not belong to the referenced entity,
+      // return the displayFieldName
+      // Otherwise trying to append the displayFieldName to the referenced property would later
+      // result in an error
+      return displayFieldName.replace(".", DalUtil.FIELDSEPARATOR);
+    } else {
+      final String result = (prop.getName() + DalUtil.FIELDSEPARATOR + displayFieldName).replace(
+          ".", DalUtil.FIELDSEPARATOR);
+      return result;
+    }
+
+  }
+
+  private String getFirstProperty(String displayFieldName) {
+    int dotPosition = displayFieldName.indexOf(DalUtil.DOT);
+    if (dotPosition == -1) {
+      return displayFieldName;
+    } else {
+      return displayFieldName.substring(0, dotPosition);
+    }
   }
 
   public String getFieldProperties(Field field) {
@@ -119,10 +139,18 @@
       return super.getFieldProperties(field);
     }
     final Selector selector = getSelector(field);
+
     final String tableName = field.getColumn().getTable().getDBTableName();
     final String columnName = field.getColumn().getDBColumnName();
+    final String tableId = field.getColumn().getTable().getId();
 
-    final Property property = DalUtil.getProperty(tableName, columnName);
+    Property property = null;
+    if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(field.getColumn().getTable()
+        .getDataOriginType())) {
+      property = DalUtil.getPropertyByTableId(tableId, columnName);
+    } else {
+      property = DalUtil.getProperty(tableName, columnName);
+    }
 
     final SelectorComponent selectorComponent = WeldUtils
         .getInstanceFromStaticBeanManager(SelectorComponent.class);
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/SelectorUIReference.java	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/SelectorUIReference.java	Thu Jun 27 10:02:33 2013 +0200
@@ -202,10 +202,13 @@
           String parentFieldName = fieldName;
           String name = ((fieldName != null && !fieldName.equals("")) ? fieldName : comboTableData
               .getObjectName());
-          if (name.startsWith("EM_")) {
-            // For external module fields use the column field in selector to avoid comparing
-            // fields with EM_fieldname which will not be present in the current table.
-            // Refer issue https://issues.openbravo.com/view.php?id=23267
+          /*
+           * if the column name is available in selector use that for comparison as it is the column
+           * that is going to be saved. Solves issues
+           * https://issues.openbravo.com/view.php?id=23267,
+           * https://issues.openbravo.com/view.php?id=23124
+           */
+          if (selector.getColumn() != null) {
             name = selector.getColumn().getDBColumnName();
           }
           String tableDirName;
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Thu Jun 27 10:02:33 2013 +0200
@@ -78,6 +78,10 @@
       selector: this.selector,
       selectionAppearance: this.selectionAppearance,
 
+      // drawAllMaxCells is set to 0 to prevent extra reads of data
+      // Smartclient will try to read until drawAllMaxCells has been reached
+      drawAllMaxCells: 0,
+
       dataProperties: {
         useClientFiltering: false,
         useClientSorting: false
@@ -458,6 +462,9 @@
 
   setUpPickList: function (show, queueFetches, request) {
     this.pickListProperties.canResizeFields = true;
+    // drawAllMaxCells is set to 0 to prevent extra reads of data
+    // Smartclient will try to read until drawAllMaxCells has been reached
+    this.pickListProperties.drawAllMaxCells = 0;
     // Set the pickListWidth just before being shown.
     this.setPickListWidth();
     this.Super('setUpPickList', arguments);
@@ -493,6 +500,10 @@
       this.selectFirstPickListOption();
     }
 
+    if (this._clearingValue) {
+      this._editorEnterValue = null;
+    }
+
     this.Super('setValue', arguments);
   },
 
@@ -627,7 +638,7 @@
         this.valueMap = {};
       }
 
-      this.valueMap[record[this.valueField]] = record[this.displayField];
+      this.valueMap[record[this.valueField]] = record[this.displayField].replace(/[\n\r]/g, '');
       this.updateValueMap();
     }
 
@@ -963,7 +974,7 @@
       if (!this.valueMap) {
         this.valueMap = {};
       }
-      this.valueMap[record[this.gridValueField]] = record[this.gridDisplayField];
+      this.valueMap[record[this.gridValueField]] = record[this.gridDisplayField].replace(/[\n\r]/g, '');
       this.updateValueMap();
     }
     this.handleOutFields(record);
--- a/modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -6,7 +6,7 @@
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <NAME><![CDATA[2.50 to 3.00 Compatibility Skin]]></NAME>
-<!--96998CBC42744B3DBEE28AC8095C9335-->  <VERSION><![CDATA[2.0.20088]]></VERSION>
+<!--96998CBC42744B3DBEE28AC8095C9335-->  <VERSION><![CDATA[2.0.20523]]></VERSION>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <DESCRIPTION><![CDATA[Skin module to proper visualization of classic windows inside the MDI interface]]></DESCRIPTION>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <HELP><![CDATA[With this skin module the classic windows styles will display in a way more coherent with the new 3.00 styles]]></HELP>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <URL><![CDATA[www.openbravo.com]]></URL>
@@ -23,7 +23,7 @@
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <HASCHARTOFACCOUNTS><![CDATA[N]]></HASCHARTOFACCOUNTS>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
-<!--96998CBC42744B3DBEE28AC8095C9335-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--96998CBC42744B3DBEE28AC8095C9335-->  <VERSION_LABEL><![CDATA[MP24]]></VERSION_LABEL>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--96998CBC42744B3DBEE28AC8095C9335-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--96998CBC42744B3DBEE28AC8095C9335--></AD_MODULE>
--- a/modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -7,7 +7,7 @@
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <AD_MODULE_ID><![CDATA[96998CBC42744B3DBEE28AC8095C9335]]></AD_MODULE_ID>
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--39BF75AD9AB3453698BF5DE29E727AA9-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--39BF75AD9AB3453698BF5DE29E727AA9-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--39BF75AD9AB3453698BF5DE29E727AA9-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -6,7 +6,7 @@
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <NAME><![CDATA[Smartclient]]></NAME>
-<!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <VERSION><![CDATA[8.1.20088]]></VERSION>
+<!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <VERSION><![CDATA[8.1.20523]]></VERSION>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <DESCRIPTION><![CDATA[SmartClient libraries for use within Openbravo]]></DESCRIPTION>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <HELP><![CDATA[This module contains the SmartClient libraries for usage by other modules. It also contains some simple test pages to validate that SmartClient is working correctly. Also contains generic Openbravo SmartClient components]]></HELP>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <URL><![CDATA[http://forge.openbravo.com/projects/obsmartclient]]></URL>
@@ -23,7 +23,7 @@
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <UPDATEINFO><![CDATA[Bug fixing & new development for 3.0
 Updated to new SmartClient 8.3d 26-May-2012]]></UPDATEINFO>
-<!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <VERSION_LABEL><![CDATA[MP24]]></VERSION_LABEL>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--EC356CEE3D46416CA1EBEEB9AB82EDB9--></AD_MODULE>
--- a/modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -7,7 +7,7 @@
 <!--086331E18477496B8AC74D2CFEBD1307-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--086331E18477496B8AC74D2CFEBD1307-->  <AD_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_MODULE_ID>
 <!--086331E18477496B8AC74D2CFEBD1307-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--086331E18477496B8AC74D2CFEBD1307-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--086331E18477496B8AC74D2CFEBD1307-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--086331E18477496B8AC74D2CFEBD1307-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--086331E18477496B8AC74D2CFEBD1307-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--086331E18477496B8AC74D2CFEBD1307-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--DC5D4EF450244482BD2B458DAA496333-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--DC5D4EF450244482BD2B458DAA496333-->  <AD_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_MODULE_ID>
 <!--DC5D4EF450244482BD2B458DAA496333-->  <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID>
-<!--DC5D4EF450244482BD2B458DAA496333-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--DC5D4EF450244482BD2B458DAA496333-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--DC5D4EF450244482BD2B458DAA496333-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--DC5D4EF450244482BD2B458DAA496333-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME>
 <!--DC5D4EF450244482BD2B458DAA496333-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <AD_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_MODULE_ID>
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <AD_DEPENDENT_MODULE_ID><![CDATA[C70732EA90A14EC0916078B85CC33D2D]]></AD_DEPENDENT_MODULE_ID>
-<!--F2AF15C0AF5540E393D96BE506E20648-->  <STARTVERSION><![CDATA[1.1.20088]]></STARTVERSION>
+<!--F2AF15C0AF5540E393D96BE506E20648-->  <STARTVERSION><![CDATA[1.1.20523]]></STARTVERSION>
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <DEPENDANT_MODULE_NAME><![CDATA[JBoss Weld]]></DEPENDANT_MODULE_NAME>
 <!--F2AF15C0AF5540E393D96BE506E20648-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Thu Jun 27 10:02:33 2013 +0200
@@ -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-2012 Openbravo SLU
+ * All portions are Copyright (C) 2011-2013 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -130,13 +130,17 @@
 isc.Layout.addProperties({
 
   destroyAndRemoveMembers: function (toDestroy) {
-    var i;
+    var i, len, nextIndex = 0;
     if (!isc.isA.Array(toDestroy)) {
       toDestroy = [toDestroy];
     }
-    for (i = 0; i < toDestroy.length; i++) {
-      if (toDestroy[i] && toDestroy[i].destroy) {
-        toDestroy[i].destroy();
+    len = toDestroy.length;
+    for (i = 0; i < len; i++) {
+      if (toDestroy[nextIndex] && toDestroy[nextIndex].destroy) {
+        toDestroy[nextIndex].destroy();
+      }
+      if (toDestroy.length === len) {
+        nextIndex = nextIndex + 1;
       }
     }
     this.removeMembers(toDestroy);
--- a/modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -6,7 +6,7 @@
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <NAME><![CDATA[Standard Roles]]></NAME>
-<!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <VERSION><![CDATA[3.0.20088]]></VERSION>
+<!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <VERSION><![CDATA[3.0.20523]]></VERSION>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <DESCRIPTION><![CDATA[Pre-configured collection of standard ERP roles]]></DESCRIPTION>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <HELP><![CDATA[This dataset contains the following roles with their access to corresponding Openbravo entities - windows, reports, actions.
 * Employee - Any person of the enterprise
@@ -28,7 +28,7 @@
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <HASREFERENCEDATA><![CDATA[Y]]></HASREFERENCEDATA>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <REFERENCEDATAINFO><![CDATA[Pre-configured collection of standard ERP roles]]></REFERENCEDATAINFO>
-<!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <VERSION_LABEL><![CDATA[MP24]]></VERSION_LABEL>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--883B5872CA0548F9AF2BBBE7D2DDFA61--></AD_MODULE>
--- a/modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -7,7 +7,7 @@
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <AD_MODULE_ID><![CDATA[883B5872CA0548F9AF2BBBE7D2DDFA61]]></AD_MODULE_ID>
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--148A000EE9A04A3CA653B1296A00B8E6-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--148A000EE9A04A3CA653B1296A00B8E6-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--148A000EE9A04A3CA653B1296A00B8E6-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--30F966407A6F4E15965821BAEE34D25B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--30F966407A6F4E15965821BAEE34D25B-->  <AD_MODULE_ID><![CDATA[883B5872CA0548F9AF2BBBE7D2DDFA61]]></AD_MODULE_ID>
 <!--30F966407A6F4E15965821BAEE34D25B-->  <AD_DEPENDENT_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_DEPENDENT_MODULE_ID>
-<!--30F966407A6F4E15965821BAEE34D25B-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--30F966407A6F4E15965821BAEE34D25B-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--30F966407A6F4E15965821BAEE34D25B-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--30F966407A6F4E15965821BAEE34D25B-->  <DEPENDANT_MODULE_NAME><![CDATA[Advanced Payables and Receivables Mngmt]]></DEPENDANT_MODULE_NAME>
 <!--30F966407A6F4E15965821BAEE34D25B-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--F93CE30003B24F8F8886510B0065EECC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--F93CE30003B24F8F8886510B0065EECC-->  <AD_MODULE_ID><![CDATA[883B5872CA0548F9AF2BBBE7D2DDFA61]]></AD_MODULE_ID>
 <!--F93CE30003B24F8F8886510B0065EECC-->  <AD_DEPENDENT_MODULE_ID><![CDATA[3A3A943684D64DEF9EC39F588A656848]]></AD_DEPENDENT_MODULE_ID>
-<!--F93CE30003B24F8F8886510B0065EECC-->  <STARTVERSION><![CDATA[1.1.20088]]></STARTVERSION>
+<!--F93CE30003B24F8F8886510B0065EECC-->  <STARTVERSION><![CDATA[1.1.20523]]></STARTVERSION>
 <!--F93CE30003B24F8F8886510B0065EECC-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--F93CE30003B24F8F8886510B0065EECC-->  <DEPENDANT_MODULE_NAME><![CDATA[Orders Awaiting Delivery]]></DEPENDANT_MODULE_NAME>
 <!--F93CE30003B24F8F8886510B0065EECC-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
--- a/modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -6,7 +6,7 @@
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <NAME><![CDATA[Openbravo 3.0 Framework]]></NAME>
-<!--7E48CDD73B7E493A8BED4F7253E7C989-->  <VERSION><![CDATA[2.1.20088]]></VERSION>
+<!--7E48CDD73B7E493A8BED4F7253E7C989-->  <VERSION><![CDATA[2.1.20523]]></VERSION>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <DESCRIPTION><![CDATA[Openbravo 3.0 Framework]]></DESCRIPTION>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <HELP><![CDATA[Contains all the components required to run the Openbravo 3.0 framework]]></HELP>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <URL><![CDATA[http://forge.openbravo.com/projects/openbravov30framework]]></URL>
@@ -24,7 +24,7 @@
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <HASREFERENCEDATA><![CDATA[N]]></HASREFERENCEDATA>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <UPDATEINFO><![CDATA[minor bugfix release to include latest client.application 2.0.1, client.myob 2.0.2 and client.kernel 2.0.1]]></UPDATEINFO>
-<!--7E48CDD73B7E493A8BED4F7253E7C989-->  <VERSION_LABEL><![CDATA[MP22.3]]></VERSION_LABEL>
+<!--7E48CDD73B7E493A8BED4F7253E7C989-->  <VERSION_LABEL><![CDATA[MP24]]></VERSION_LABEL>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--7E48CDD73B7E493A8BED4F7253E7C989-->  <ISTRIALALLOWED><![CDATA[N]]></ISTRIALALLOWED>
 <!--7E48CDD73B7E493A8BED4F7253E7C989--></AD_MODULE>
--- a/modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Wed Jun 26 17:09:49 2013 +0200
+++ b/modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml	Thu Jun 27 10:02:33 2013 +0200
@@ -7,7 +7,7 @@
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <AD_DEPENDENT_MODULE_ID><![CDATA[2758CD25B2704AF6BBAD10365FC82C06]]></AD_DEPENDENT_MODULE_ID>
-<!--01E1BCCEC9114DE0960538DF34E30E6F-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--01E1BCCEC9114DE0960538DF34E30E6F-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <DEPENDANT_MODULE_NAME><![CDATA[My Openbravo Tab]]></DEPENDANT_MODULE_NAME>
 <!--01E1BCCEC9114DE0960538DF34E30E6F-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -21,7 +21,7 @@
 <!--025B181F63CA47B48A920F6983242390-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--025B181F63CA47B48A920F6983242390-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--025B181F63CA47B48A920F6983242390-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0]]></AD_DEPENDENT_MODULE_ID>
-<!--025B181F63CA47B48A920F6983242390-->  <STARTVERSION><![CDATA[3.0.20088]]></STARTVERSION>
+<!--025B181F63CA47B48A920F6983242390-->  <STARTVERSION><![CDATA[3.0.20523]]></STARTVERSION>
 <!--025B181F63CA47B48A920F6983242390-->  <ISINCLUDED><![CDATA[N]]></ISINCLUDED>
 <!--025B181F63CA47B48A920F6983242390-->  <DEPENDANT_MODULE_NAME><![CDATA[core]]></DEPENDANT_MODULE_NAME>
 <!--025B181F63CA47B48A920F6983242390-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -35,7 +35,7 @@
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <AD_DEPENDENT_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_DEPENDENT_MODULE_ID>
-<!--054B4FEAF919478AA3FF27098A46D1D6-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--054B4FEAF919478AA3FF27098A46D1D6-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Application]]></DEPENDANT_MODULE_NAME>
 <!--054B4FEAF919478AA3FF27098A46D1D6-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -49,7 +49,7 @@
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <AD_DEPENDENT_MODULE_ID><![CDATA[0A060B2AF1974E8EAA8DB61388E9AECC]]></AD_DEPENDENT_MODULE_ID>
-<!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <STARTVERSION><![CDATA[1.0.20088]]></STARTVERSION>
+<!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <STARTVERSION><![CDATA[1.0.20523]]></STARTVERSION>
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <DEPENDANT_MODULE_NAME><![CDATA[Query/List Widget]]></DEPENDANT_MODULE_NAME>
 <!--1FA6BAA6DC3A4434A6E62A0D1319A9D7-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -63,7 +63,7 @@
 <!--224754C3EF674C93B0D468F47BAAB824-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--224754C3EF674C93B0D468F47BAAB824-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--224754C3EF674C93B0D468F47BAAB824-->  <AD_DEPENDENT_MODULE_ID><![CDATA[5EB4F15C80684ACA904756BDC12ADBE5]]></AD_DEPENDENT_MODULE_ID>
-<!--224754C3EF674C93B0D468F47BAAB824-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--224754C3EF674C93B0D468F47BAAB824-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--224754C3EF674C93B0D468F47BAAB824-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--224754C3EF674C93B0D468F47BAAB824-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Selector]]></DEPENDANT_MODULE_NAME>
 <!--224754C3EF674C93B0D468F47BAAB824-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -77,7 +77,7 @@
 <!--5B72D24032DD4879A950194139D961B6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--5B72D24032DD4879A950194139D961B6-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--5B72D24032DD4879A950194139D961B6-->  <AD_DEPENDENT_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_DEPENDENT_MODULE_ID>
-<!--5B72D24032DD4879A950194139D961B6-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--5B72D24032DD4879A950194139D961B6-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--5B72D24032DD4879A950194139D961B6-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--5B72D24032DD4879A950194139D961B6-->  <DEPENDANT_MODULE_NAME><![CDATA[JSON Datasource]]></DEPENDANT_MODULE_NAME>
 <!--5B72D24032DD4879A950194139D961B6-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -91,7 +91,7 @@
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <AD_DEPENDENT_MODULE_ID><![CDATA[D393BE6F22BB44B7B728259B34FC795A]]></AD_DEPENDENT_MODULE_ID>
-<!--8730CA6A4224439D82E0DD31B3806E36-->  <STARTVERSION><![CDATA[1.0.20088]]></STARTVERSION>
+<!--8730CA6A4224439D82E0DD31B3806E36-->  <STARTVERSION><![CDATA[1.0.20523]]></STARTVERSION>
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <DEPENDANT_MODULE_NAME><![CDATA[HTML Widget]]></DEPENDANT_MODULE_NAME>
 <!--8730CA6A4224439D82E0DD31B3806E36-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -105,7 +105,7 @@
 <!--98C47FF058F8413B8A2B26036061446E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--98C47FF058F8413B8A2B26036061446E-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--98C47FF058F8413B8A2B26036061446E-->  <AD_DEPENDENT_MODULE_ID><![CDATA[EC356CEE3D46416CA1EBEEB9AB82EDB9]]></AD_DEPENDENT_MODULE_ID>
-<!--98C47FF058F8413B8A2B26036061446E-->  <STARTVERSION><![CDATA[8.1.20088]]></STARTVERSION>
+<!--98C47FF058F8413B8A2B26036061446E-->  <STARTVERSION><![CDATA[8.1.20523]]></STARTVERSION>
 <!--98C47FF058F8413B8A2B26036061446E-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--98C47FF058F8413B8A2B26036061446E-->  <DEPENDANT_MODULE_NAME><![CDATA[Smartclient]]></DEPENDANT_MODULE_NAME>
 <!--98C47FF058F8413B8A2B26036061446E-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -119,7 +119,7 @@
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <AD_DEPENDENT_MODULE_ID><![CDATA[96998CBC42744B3DBEE28AC8095C9335]]></AD_DEPENDENT_MODULE_ID>
-<!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <STARTVERSION><![CDATA[2.0.20088]]></STARTVERSION>
+<!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <STARTVERSION><![CDATA[2.0.20523]]></STARTVERSION>
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <DEPENDANT_MODULE_NAME><![CDATA[2.50 to 3.00 Compatibility Skin]]></DEPENDANT_MODULE_NAME>
 <!--A6D7BA917B3B4DEABD7CA1BA00B01E8A-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>
@@ -133,7 +133,7 @@
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <AD_MODULE_ID><![CDATA[7E48CDD73B7E493A8BED4F7253E7C989]]></AD_MODULE_ID>
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <AD_DEPENDENT_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_DEPENDENT_MODULE_ID>
-<!--A9CB99330AF34944877F889DD8A0AB3C-->  <STARTVERSION><![CDATA[2.1.20088]]></STARTVERSION>
+<!--A9CB99330AF34944877F889DD8A0AB3C-->  <STARTVERSION><![CDATA[2.1.20523]]></STARTVERSION>
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <ISINCLUDED><![CDATA[Y]]></ISINCLUDED>
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <DEPENDANT_MODULE_NAME><![CDATA[User Interface Client Kernel]]></DEPENDANT_MODULE_NAME>
 <!--A9CB99330AF34944877F889DD8A0AB3C-->  <DEPENDENCY_ENFORCEMENT><![CDATA[MAJOR]]></DEPENDENCY_ENFORCEMENT>