[Reconciliation refactor] merge to transaction from menu
authorSandra Huguet <sandra.huguet@openbravo.com>
Mon, 18 Aug 2014 08:57:02 +0200
changeset 24525 eda335476211
parent 24521 6459143e2b34 (current diff)
parent 24524 d9cd14c1241a (diff)
child 24526 923f2b69ce50
[Reconciliation refactor] merge to transaction from menu
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/modifiedTables/FIN_FINACC_TRANSACTION.xml	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/modifiedTables/FIN_FINACC_TRANSACTION.xml	Mon Aug 18 08:57:02 2014 +0200
@@ -10,7 +10,7 @@
         <onCreateDefault/>
       </column>
       <column name="EM_APRM_PROCESSED" primaryKey="false" required="true" type="VARCHAR" size="60" autoIncrement="false">
-        <default><![CDATA[[P]]></default>
+        <default><![CDATA[P]]></default>
         <onCreateDefault><![CDATA['R']]></onCreateDefault>
       </column>
     </table>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Aug 18 08:57:02 2014 +0200
@@ -1340,6 +1340,20 @@
 <!--EB44117C86AE448D87B86063155C2066-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--EB44117C86AE448D87B86063155C2066--></AD_ELEMENT>
 
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF--><AD_ELEMENT>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_ELEMENT_ID><![CDATA[E9AA03CAEC954FF8B268C2C164BA6CBF]]></AD_ELEMENT_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <COLUMNNAME><![CDATA[ad_org_id_display_logic]]></COLUMNNAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <NAME><![CDATA[Organization Display Logic]]></NAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <PRINTNAME><![CDATA[Organization Display Logic]]></PRINTNAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Organization]]></DESCRIPTION>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <HELP><![CDATA[Parameter used to implement Display Logic on Organization]]></HELP>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF--></AD_ELEMENT>
+
 <!--EDB9CF491555465382F828F48291A0C0--><AD_ELEMENT>
 <!--EDB9CF491555465382F828F48291A0C0-->  <AD_ELEMENT_ID><![CDATA[EDB9CF491555465382F828F48291A0C0]]></AD_ELEMENT_ID>
 <!--EDB9CF491555465382F828F48291A0C0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Mon Aug 18 08:57:02 2014 +0200
@@ -19601,7 +19601,7 @@
 <!--E40D003712A2492395ACB57BFBFE6720-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
-<!--E40D003712A2492395ACB57BFBFE6720-->  <DISPLAYLOGICGRID><![CDATA[@fin_payment_id@]]></DISPLAYLOGICGRID>
+<!--E40D003712A2492395ACB57BFBFE6720-->  <DISPLAYLOGICGRID><![CDATA[@fin_payment_id@ | @trxtype@!'']]></DISPLAYLOGICGRID>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--E40D003712A2492395ACB57BFBFE6720--></AD_FIELD>
 
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Mon Aug 18 08:57:02 2014 +0200
@@ -98,6 +98,32 @@
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[FF80808133186ADD01331B3A932C000D]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269--></OBUIAPP_PARAMETER>
 
+<!--0B13DC2C52424F36BDAFC790A0AB5886--><OBUIAPP_PARAMETER>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <OBUIAPP_PARAMETER_ID><![CDATA[0B13DC2C52424F36BDAFC790A0AB5886]]></OBUIAPP_PARAMETER_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <NAME><![CDATA[Organization Display Logic]]></NAME>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Organization]]></DESCRIPTION>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <HELP><![CDATA[Parameter used to implement Display Logic on Organization]]></HELP>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <SEQNO><![CDATA[1240]]></SEQNO>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <COLUMNNAME><![CDATA[ad_org_id_display_logic]]></COLUMNNAME>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDisplayLogicsExpression")]]></DEFAULTVALUE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_ELEMENT_ID><![CDATA[E9AA03CAEC954FF8B268C2C164BA6CBF]]></AD_ELEMENT_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886--></OBUIAPP_PARAMETER>
+
 <!--0E081905DD9646A2AFB296F81C1AA62E--><OBUIAPP_PARAMETER>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <OBUIAPP_PARAMETER_ID><![CDATA[0E081905DD9646A2AFB296F81C1AA62E]]></OBUIAPP_PARAMETER_ID>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -506,7 +532,7 @@
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
-<!--52BD390363394BE980D0A55AFC4CDBB9-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--52BD390363394BE980D0A55AFC4CDBB9-->  <STARTINNEWLINE><![CDATA[Y]]></STARTINNEWLINE>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <NUMCOLUMN><![CDATA[1]]></NUMCOLUMN>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
@@ -1025,19 +1051,19 @@
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <NAME><![CDATA[Organization]]></NAME>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <SEQNO><![CDATA[1100]]></SEQNO>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <SEQNO><![CDATA[5]]></SEQNO>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <COLUMNNAME><![CDATA[ad_org_id]]></COLUMNNAME>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDefaultValuesExpression")]]></DEFAULTVALUE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYLOGIC><![CDATA[@ad_org_id_display_logic@='Y']]></DISPLAYLOGIC>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02--></OBUIAPP_PARAMETER>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Mon Aug 18 08:57:02 2014 +0200
@@ -39,7 +39,7 @@
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <NAME><![CDATA[Financial Account]]></NAME>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <AD_REFERENCE_ID><![CDATA[7F1A079A842545DF966D7EFD4BC5CFCE]]></AD_REFERENCE_ID>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <AD_TABLE_ID><![CDATA[B129E53BC0E747879F7BA17F0AECEC32]]></AD_TABLE_ID>
-<!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <WHERECLAUSE><![CDATA[@fin_paymentmethod_id@ is null or exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm join fpm.account as fa where fpm.paymentMethod.id = @fin_paymentmethod_id@ and fa = e and (case when @inpissotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true and (@inpcCurrencyId@ = fa.currency.id or (case when @inpissotrx@ = 'true' then fpm.payinIsMulticurrency else fpm.payoutIsMulticurrency end) = true))]]></WHERECLAUSE>
+<!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <WHERECLAUSE><![CDATA[@fin_paymentmethod_id@ is null or exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm join fpm.account as fa where fpm.paymentMethod.id = @fin_paymentmethod_id@ and fa = e and (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true and (@c_currency_id@ = fa.currency.id or (case when @issotrx@ = 'true' then fpm.payinIsMulticurrency else fpm.payoutIsMulticurrency end) = true))]]></WHERECLAUSE>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[startsWith]]></SUGGESTIONTEXTMATCHSTYLE>
@@ -170,7 +170,7 @@
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <NAME><![CDATA[Payment Method]]></NAME>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <AD_REFERENCE_ID><![CDATA[E664E415582A483DBBC91DEF256FB9E6]]></AD_REFERENCE_ID>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <AD_TABLE_ID><![CDATA[0B44DF7A2A854784BF34AD49C58647D7]]></AD_TABLE_ID>
-<!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <WHERECLAUSE><![CDATA[exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm where fpm.paymentMethod = e  and  (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true   and fpm.account.id =  @fin_financial_account_id@ or @inpwindowId@ <> '94EAA455D2644E04AB25D93BE5157B6D')]]></WHERECLAUSE>
+<!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <WHERECLAUSE><![CDATA[exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm where fpm.paymentMethod = e  and  (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true   and (fpm.account.id =  @fin_financial_account_id@ or @inpwindowId@ <> '94EAA455D2644E04AB25D93BE5157B6D'))]]></WHERECLAUSE>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[substring]]></SUGGESTIONTEXTMATCHSTYLE>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -82,13 +82,21 @@
   protected JSONObject doExecute(Map<String, Object> parameters, String content) {
     JSONObject jsonResponse = new JSONObject();
     OBContext.setAdminMode(true);
+    boolean openedFromMenu = false;
     try {
       VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
       // Get Params
       JSONObject jsonRequest = new JSONObject(content);
       JSONObject jsonparams = jsonRequest.getJSONObject("_params");
 
-      final String strOrgId = jsonRequest.getString("inpadOrgId");
+      openedFromMenu = "null".equals(parameters.get("windowId").toString()) ? true : false;
+
+      String strOrgId = null;
+      if (jsonRequest.has("inpadOrgId") && jsonRequest.get("inpadOrgId") != JSONObject.NULL) {
+        strOrgId = jsonRequest.getString("inpadOrgId");
+      } else if (jsonparams.has("ad_org_id") && jsonparams.get("ad_org_id") != JSONObject.NULL) {
+        strOrgId = jsonparams.getString("ad_org_id");
+      }
       Organization org = OBDal.getInstance().get(Organization.class, strOrgId);
       boolean isReceipt = jsonparams.getBoolean("issotrx");
 
@@ -153,6 +161,7 @@
           JSONObject errorMessage = new JSONObject();
           errorMessage.put("severity", "error");
           errorMessage.put("text", e.getMessage());
+          jsonResponse.put("retryExecution", openedFromMenu);
           jsonResponse.put("message", errorMessage);
           return jsonResponse;
         }
@@ -177,6 +186,7 @@
         errorMessage.put("severity", message.getType().toLowerCase());
         errorMessage.put("title", message.getTitle());
         errorMessage.put("text", message.getMessage());
+        jsonResponse.put("retryExecution", openedFromMenu);
         jsonResponse.put("message", errorMessage);
         jsonResponse.put("refreshParent", false);
         JSONObject setSelectorValueFromRecord = new JSONObject();
@@ -186,6 +196,9 @@
         record.put("map", payment.getIdentifier());
         setSelectorValueFromRecord.put("record", record);
         responseActions.put("setSelectorValueFromRecord", setSelectorValueFromRecord);
+        if (openedFromMenu) {
+          responseActions.put("reloadParameters", setSelectorValueFromRecord);
+        }
         jsonResponse.put("responseActions", responseActions);
 
       }
@@ -201,6 +214,7 @@
         JSONObject errorMessage = new JSONObject();
         errorMessage.put("severity", "error");
         errorMessage.put("text", message);
+        jsonResponse.put("retryExecution", openedFromMenu);
         jsonResponse.put("message", errorMessage);
 
       } catch (Exception ignore) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDisplayLogicActionHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDisplayLogicActionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -53,6 +53,7 @@
       final JSONArray affectedParams = jsonData.getJSONArray("affectedParams");
       final JSONObject params = jsonData.getJSONObject("params");
 
+      @SuppressWarnings("unchecked")
       Iterator<String> keys = params.keys();
       while (keys.hasNext()) {
         String key = keys.next();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDocumentNoActionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.enterprise.Organization;
+
+public class AddPaymentDocumentNoActionHandler extends BaseActionHandler {
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String data) {
+    try {
+      final JSONObject jsonData = new JSONObject(data);
+      JSONObject result = new JSONObject();
+      String strDocNo = null;
+      final String strOrganization = jsonData.getString("organization");
+      if (StringUtils.isNotEmpty(strOrganization)) {
+        Organization organization = OBDal.getInstance().get(Organization.class, strOrganization);
+        strDocNo = FIN_Utility.getDocumentNo(organization, jsonData.getString("issotrx").toString()
+            .equals("true") ? "ARR" : "APP", "FIN_Payment", false);
+      }
+      result.put("payment_documentno", "<" + strDocNo + ">");
+      return result;
+    } catch (Exception e) {
+      throw new OBException(e);
+    }
+  }
+}
\ No newline at end of file
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/PaymentMethodMulticurrencyActionHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/PaymentMethodMulticurrencyActionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -46,14 +46,24 @@
       final String paymentMethodId = jsonData.getString("paymentMethodId");
       final String financialAccountId = jsonData.getString("financialAccountId");
       final boolean isSOTrx = jsonData.getBoolean("isSOTrx");
-      final String currencyId = jsonData.getString("currencyId");
+      String currencyId = jsonData.getString("currencyId");
       final String strPaymentDate = jsonData.getString("paymentDate");
       Date paymentDate = JsonUtils.createDateFormat().parse(strPaymentDate);
       final String strOrgId = jsonData.getString("orgId");
 
+      JSONObject result = new JSONObject();
+
+      if ("null".equals(currencyId) && !"null".equals(financialAccountId)
+          && !"".equals(financialAccountId)) {
+        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+            financialAccountId);
+        currencyId = financialAccount.getCurrency().getId();
+        result.put("currencyIdIdentifier", financialAccount.getCurrency().getIdentifier());
+        result.put("currencyId", currencyId);
+      }
+
       final FinAccPaymentMethod finAccPaymentMethod = getFinancialAccountPaymentMethod(
           paymentMethodId, financialAccountId);
-      JSONObject result = new JSONObject();
       if (finAccPaymentMethod != null) {
         result.put("isPayIsMulticurrency", isSOTrx ? finAccPaymentMethod.isPayinIsMulticurrency()
             : finAccPaymentMethod.isPayoutIsMulticurrency());
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/ReceivedFromPaymentMethodActionHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/ReceivedFromPaymentMethodActionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -21,7 +21,6 @@
 
 import java.util.Map;
 
-import org.apache.commons.lang.StringUtils;
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.client.kernel.BaseActionHandler;
@@ -41,25 +40,30 @@
       FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
           jsonData.getString("financialAccount"));
       boolean contains = false;
-      final String receivedFrom = jsonData.getString("receivedFrom");
       String paymentMethod = null;
-      if (StringUtils.isNotEmpty(receivedFrom)) {
-        BusinessPartner businessPartner = OBDal.getInstance().get(BusinessPartner.class,
-            receivedFrom);
-        if (jsonData.getString("isSOTrx").toString().equals("true")) {
-          paymentMethod = businessPartner.getPaymentMethod().getId();
-        } else {
-          paymentMethod = businessPartner.getPOPaymentMethod().getId();
+
+      if (financialAccount != null) {
+        if (jsonData.has("receivedFrom") && jsonData.get("receivedFrom") != JSONObject.NULL) {
+          final String receivedFrom = jsonData.getString("receivedFrom");
+          BusinessPartner businessPartner = OBDal.getInstance().get(BusinessPartner.class,
+              receivedFrom);
+          if (jsonData.getString("isSOTrx").toString().equals("true")) {
+            paymentMethod = businessPartner.getPaymentMethod().getId();
+          } else {
+            paymentMethod = businessPartner.getPOPaymentMethod().getId();
+          }
+          for (FinAccPaymentMethod finAccPaymentMethod : financialAccount
+              .getFinancialMgmtFinAccPaymentMethodList()) {
+            if (finAccPaymentMethod.getPaymentMethod().equals(
+                OBDal.getInstance().get(FIN_PaymentMethod.class, paymentMethod))) {
+              contains = true;
+            } else {
+              contains = false;
+            }
+          }
         }
-      }
-      for (FinAccPaymentMethod finAccPaymentMethod : financialAccount
-          .getFinancialMgmtFinAccPaymentMethodList()) {
-        if (finAccPaymentMethod.getPaymentMethod().equals(
-            OBDal.getInstance().get(FIN_PaymentMethod.class, paymentMethod))) {
-          contains = true;
-        } else {
-          contains = false;
-        }
+      } else {
+        contains = false;
       }
       if (!contains) {
         paymentMethod = "";
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddOrderOrInvoiceFilterExpressionHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddOrderOrInvoiceFilterExpressionHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -48,6 +48,14 @@
 
   protected abstract long getSeq();
 
+  /**
+   * This method gets called to obtain the default filtering values for the grid. It can be
+   * overwritten using Injections.
+   * 
+   * @param requestMap
+   * @return String containing the value for the filter expression
+   * @throws JSONException
+   */
   String getFilterExpression(Map<String, String> requestMap) throws JSONException {
     return getDefaultPaymentMethod(requestMap);
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Mon Aug 18 08:57:02 2014 +0200
@@ -120,8 +120,13 @@
 
   private String getWindowId(Map<String, String> requestMap) throws JSONException {
     final String strContext = requestMap.get("context");
-    JSONObject context = new JSONObject(strContext);
-    return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
   }
 
   private AddPaymentDefaultValuesHandler getHandler(String strWindowId) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -40,42 +40,53 @@
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
 
 @RequestScoped
-abstract class AddPaymentDefaultValuesHandler {
+public abstract class AddPaymentDefaultValuesHandler {
 
-  abstract String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultExpectedAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultActualAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultTransactionType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultTransactionType(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultOrderType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultOrderType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultConversionRate(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultConvertedAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultReceivedFrom(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultStandardPrecision(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultCurrency(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultCurrency(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getOrganization(Map<String, String> requestMap) throws JSONException;
+  public abstract String getOrganization(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultDocument(Map<String, String> requestMap) throws JSONException;
-  
-  abstract String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultDocument(Map<String, String> requestMap) throws JSONException;
+
+  public abstract String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException;
 
   protected abstract long getSeq();
 
-  String getDefaultCurrencyTo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultCurrencyTo(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinFinancialAccountId")
         && context.get("inpfinFinancialAccountId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinFinancialAccountId"))) {
@@ -98,7 +109,7 @@
     return null;
   }
 
-  String getDefaultCustomerCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCustomerCredit(Map<String, String> requestMap) throws JSONException {
     String strBusinessPartnerId = getDefaultReceivedFrom(requestMap);
     String strOrgId = getOrganization(requestMap);
     String strReceipt = getDefaultIsSOTrx(requestMap);
@@ -113,8 +124,12 @@
 
   }
 
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
 
     Organization org = OBDal.getInstance().get(Organization.class, context.get("inpadOrgId"));
     boolean isReceipt = "Y".equals(getDefaultIsSOTrx(requestMap));
@@ -126,7 +141,11 @@
   }
 
   public String getDefaultFinancialAccount(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinFinancialAccountId")
         && context.get("inpfinFinancialAccountId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinFinancialAccountId"))) {
@@ -162,8 +181,12 @@
     return null;
   }
 
-  String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinPaymentmethodId")
         && context.get("inpfinPaymentmethodId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinPaymentmethodId"))) {
@@ -201,12 +224,12 @@
     return pendingAmt;
   }
 
-  String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
     BigDecimal generateCredit = BigDecimal.ZERO;
     return generateCredit.toPlainString();
   }
 
-  String getDefaultDocumentCategory(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentCategory(Map<String, String> requestMap) throws JSONException {
     boolean isSOTrx = "Y".equals(getDefaultIsSOTrx(requestMap));
     if (isSOTrx) {
       return "ARR";
@@ -217,7 +240,11 @@
   }
 
   public String getDefaultReferenceNo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (!context.has("inpfinPaymentId")) {
       return null;
     }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsExpression.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsExpression.java	Mon Aug 18 08:57:02 2014 +0200
@@ -58,6 +58,8 @@
       Parameters param = Parameters.getParameter(strCurrentParam);
       try {
         switch (param) {
+        case Organization:
+          return handler.getOrganizationDisplayLogic(requestMap) ? "Y" : "N";
         case Document:
           return handler.getDocumentDisplayLogic(requestMap) ? "Y" : "N";
         case CreditToUse:
@@ -80,8 +82,13 @@
 
   private String getWindowId(Map<String, String> requestMap) throws JSONException {
     final String strContext = requestMap.get("context");
-    JSONObject context = new JSONObject(strContext);
-    return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
   }
 
   private AddPaymentDisplayLogicsHandler getHandler(String strWindowId) {
@@ -102,8 +109,8 @@
   }
 
   private enum Parameters {
-    Document("trxtype_display_logic"), CreditToUse("credit_to_use_display_logic"), OverpaymentAction(
-        "overpayment_action_display_logic");
+    Organization("ad_org_id_display_logic"), Document("trxtype_display_logic"), CreditToUse(
+        "credit_to_use_display_logic"), OverpaymentAction("overpayment_action_display_logic");
 
     private String columnname;
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -27,16 +27,26 @@
 import org.codehaus.jettison.json.JSONObject;
 
 @RequestScoped
-abstract class AddPaymentDisplayLogicsHandler {
+public abstract class AddPaymentDisplayLogicsHandler {
 
-  abstract boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException;
+  public abstract boolean getOrganizationDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException;
+  public abstract boolean getDocumentDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getCreditToUseDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
 
   protected abstract long getSeq();
 
-  boolean getOverpaymentActionDisplayLogic(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public boolean getOverpaymentActionDisplayLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("difference")) {
       double diff = context.getDouble("difference");
       BigDecimal difference = new BigDecimal(diff);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java	Mon Aug 18 08:57:02 2014 +0200
@@ -92,8 +92,13 @@
 
   private String getWindowId(Map<String, String> requestMap) throws JSONException {
     final String strContext = requestMap.get("context");
-    JSONObject context = new JSONObject(strContext);
-    return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
   }
 
   private AddPaymentReadOnlyLogicsHandler getHandler(String strWindowId) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java	Mon Aug 18 08:57:02 2014 +0200
@@ -32,34 +32,41 @@
 import org.openbravo.scheduling.ProcessLogger;
 
 @RequestScoped
-abstract class AddPaymentReadOnlyLogicsHandler {
+public abstract class AddPaymentReadOnlyLogicsHandler {
 
   private static ProcessLogger logger;
 
-  abstract boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+  public abstract boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
-  abstract boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap)
+  public abstract boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
-  abstract boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap)
+  public abstract boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
-  abstract boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap)
+  public abstract boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
-  abstract boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException;
-
-  abstract boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+  public abstract boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
-  abstract boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException;
+  public abstract boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
 
   protected abstract long getSeq();
 
-  boolean getConvertedAmountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getConvertedAmountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
     OBContext.setAdminMode();
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    JSONObject context = new JSONObject(strContext);
     String strWindow = context.getString("inpwindowId");
     Window window = OBDal.getInstance().get(Window.class, strWindow == null ? "" : strWindow);
 
@@ -84,9 +91,14 @@
     }
   }
 
-  boolean getConversionRateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getConversionRateReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
     OBContext.setAdminMode();
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    JSONObject context = new JSONObject(strContext);
     String strWindow = context.getString("inpwindowId");
     Window window = OBDal.getInstance().get(Window.class, strWindow == null ? "" : strWindow);
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerCustomerFilterExpression.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerCustomerFilterExpression.java	Mon Aug 18 08:57:02 2014 +0200
@@ -20,7 +20,7 @@
   public String getExpression(Map<String, String> _requestMap) {
     requestMap = _requestMap;
     tabId = requestMap.get(OBBindingsConstants.TAB_ID_PARAM);
-    if (requestMap.get("issotrx") != null && transactionTabId.equals(tabId)) {
+    if (requestMap.get("issotrx") != null && (transactionTabId.equals(tabId) || tabId == null)) {
       issotrx = requestMap.get("issotrx");
       if ("true".equals(issotrx)) {
         return "true";
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerVendorFilterExpression.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerVendorFilterExpression.java	Mon Aug 18 08:57:02 2014 +0200
@@ -20,7 +20,7 @@
   public String getExpression(Map<String, String> _requestMap) {
     requestMap = _requestMap;
     tabId = requestMap.get(OBBindingsConstants.TAB_ID_PARAM);
-    if (requestMap.get("issotrx") != null && transactionTabId.equals(tabId)) {
+    if (requestMap.get("issotrx") != null && (transactionTabId.equals(tabId) || tabId == null)) {
       issotrx = requestMap.get("issotrx");
       if ("false".equals(issotrx)) {
         return "true";
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -39,47 +39,47 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpfinPaymentId");
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
     // Document Number of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getDocumentNo();
@@ -100,21 +100,21 @@
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     // Conversion Rate of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionConvertRate().toPlainString();
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     // Converted Amount of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionAmount().toPlainString();
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     if (payment.getBusinessPartner() != null) {
@@ -125,33 +125,33 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getStandardPrecision().toString();
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getId();
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Payment
     return getPayment(requestMap).getOrganization().getId();
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     // Payment Date of the current payment
     return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // "@customer_credit@ > 0 & @received_from@!'' & (@issotrx@ == true | @generateCredit@ == 0)";
     FIN_Payment paymentIn = getPayment(requestMap);
     BusinessPartner bpartner = paymentIn.getBusinessPartner();
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,37 +34,39 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return true;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return true;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -39,21 +39,21 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
     // Generated Credit of the current Payment
     BigDecimal generateCredit = getPayment(requestMap).getGeneratedCredit();
     if (generateCredit == null) {
@@ -64,33 +64,33 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpfinPaymentId");
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
     // Document Number of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getDocumentNo();
@@ -111,21 +111,21 @@
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     // Conversion Rate of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionConvertRate().toPlainString();
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     // Converted Amount of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionAmount().toPlainString();
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     if (payment.getBusinessPartner() != null) {
@@ -136,33 +136,33 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getStandardPrecision().toString();
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getId();
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Payment
     return getPayment(requestMap).getOrganization().getId();
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     // Payment Date of the current payment
     return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     FIN_Payment paymentOut = getPayment(requestMap);
     if (getGeneratedCredit(requestMap).signum() == 0) {
       BusinessPartner bpartner = paymentOut.getBusinessPartner();
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,37 +34,39 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return true;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return true;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -47,7 +47,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing Purchase Invoice
     BigDecimal pendingAmt = getPendingAmount(requestMap);
     return pendingAmt.toPlainString();
@@ -60,43 +60,43 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) {
+  public String getDefaultPaymentType(Map<String, String> requestMap) {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) {
+  public String getDefaultOrderType(Map<String, String> requestMap) {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcInvoiceId");
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Purchase Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -104,7 +104,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -112,7 +112,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -120,13 +120,13 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Invoice
     return getInvoice(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
@@ -136,7 +136,7 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
     if (getDefaultGeneratedCredit(requestMap).signum() == 0) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,37 +34,39 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -40,7 +40,7 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount pending to pay on the Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -49,7 +49,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount pending to pay on the Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -58,12 +58,12 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "O";
   }
 
@@ -74,33 +74,33 @@
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcOrderId");
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -108,7 +108,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -116,7 +116,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -124,13 +124,13 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Purchase Order
     return getOrder(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
@@ -140,7 +140,7 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
     if (getDefaultGeneratedCredit(requestMap).signum() == 0) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,37 +34,39 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -47,7 +47,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing Sales Invoice
     BigDecimal pendingAmt = getPendingAmount(requestMap);
     return pendingAmt.toPlainString();
@@ -60,43 +60,43 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcInvoiceId");
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Sales Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -104,7 +104,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -112,7 +112,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -120,13 +120,13 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Invoice
     return getInvoice(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
@@ -136,7 +136,7 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
     BusinessPartner bpartner = invoice.getBusinessPartner();
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,37 +34,39 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -40,7 +40,7 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount pending to pay on the Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -49,7 +49,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount pending to pay on the Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -58,12 +58,12 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "O";
   }
 
@@ -74,33 +74,33 @@
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcOrderId");
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -108,7 +108,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -116,7 +116,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -124,7 +124,7 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Sales Order
     return getOrder(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
@@ -134,12 +134,12 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return "";
   }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // "@customer_credit@ > 0 & @received_from@!'' & (@issotrx@ == true | @generateCredit@ == 0)";
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -34,38 +34,40 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     // Document Type
     return false;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentDefaultValues.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentDefaultValues.java	Mon Aug 18 08:57:02 2014 +0200
@@ -44,17 +44,17 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     return BigDecimal.ZERO.toPlainString();
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     return BigDecimal.ZERO.toPlainString();
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     if (context.has("inptrxtype") && context.get("inptrxtype") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inptrxtype"))) {
@@ -71,58 +71,58 @@
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return BigDecimal.ONE.toPlainString();
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return BigDecimal.ZERO.toPlainString();
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     return getFinancialAccount(requestMap).getCurrency().getStandardPrecision().toString();
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     return getFinancialAccount(requestMap).getCurrency().getId().toString();
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Payment
     return getFinancialAccount(requestMap).getOrganization().getId();
   }
 
   @Override
-  String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     boolean isReceipt = true;
     if (context.has("IsSOTrx")) {
@@ -147,7 +147,7 @@
   }
 
   @Override
-  String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
     // Document Type
     JSONObject context = new JSONObject(requestMap.get("context"));
     if (context.has("inptrxtype") && context.get("inptrxtype") != JSONObject.NULL
@@ -165,7 +165,7 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     if (context.has("inpstatementdate") && !context.isNull("inpstatementdate")
         && !"".equals(context.getString("inpstatementdate"))) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentDisplayLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentDisplayLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -41,13 +41,19 @@
   }
 
   @Override
-  boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
     // Document Type
     return true;
   }
 
   @Override
-  boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     if (context.has("received_from") && !context.isNull("received_from")
         && !"".equals(context.getString("received_from"))) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentReadOnlyLogics.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentReadOnlyLogics.java	Mon Aug 18 08:57:02 2014 +0200
@@ -39,22 +39,23 @@
   }
 
   @Override
-  boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return false;
   }
 
   @Override
-  boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     String document = null;
     if (context.has("inptrxtype") && !context.isNull("inptrxtype")) {
@@ -71,20 +72,22 @@
   }
 
   @Override
-  boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return false;
   }
 
   @Override
-  boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
     return true;
   }
 
   @Override
-  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     FIN_PaymentMethod paymentMethod = null;
     FIN_FinancialAccount financialAccount = null;
+    String trxtype = null;
     boolean readOnly = true;
     if (context.has("fin_paymentmethod_id") && !context.isNull("fin_paymentmethod_id")) {
       paymentMethod = OBDal.getInstance().get(FIN_PaymentMethod.class,
@@ -101,19 +104,25 @@
       financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
           context.getString("fin_financial_account_id"));
     }
-
-    for (FinAccPaymentMethod finAccPaymentMethod : financialAccount
-        .getFinancialMgmtFinAccPaymentMethodList()) {
-      if (context.has("inptrxtype") && !context.isNull("inptrxtype")
-          && (context.getString("inptrxtype").toString().equals("RCIN"))) {
-        if (finAccPaymentMethod.getPaymentMethod().equals(paymentMethod)
-            && finAccPaymentMethod.isPayinIsMulticurrency()) {
-          readOnly = false;
-        }
-      } else {
-        if (finAccPaymentMethod.getPaymentMethod().equals(paymentMethod)
-            && finAccPaymentMethod.isPayoutIsMulticurrency()) {
-          readOnly = false;
+    if (context.has("inptrxtype") && !context.isNull("inptrxtype")) {
+      trxtype = context.getString("inptrxtype");
+    }
+    if (context.has("trxtype") && !context.isNull("trxtype")) {
+      trxtype = context.getString("trxtype");
+    }
+    if (trxtype != null) {
+      for (FinAccPaymentMethod finAccPaymentMethod : financialAccount
+          .getFinancialMgmtFinAccPaymentMethodList()) {
+        if (trxtype.equals("RCIN") || trxtype.equals("BPD")) {
+          if (finAccPaymentMethod.getPaymentMethod().equals(paymentMethod)
+              && finAccPaymentMethod.isPayinIsMulticurrency()) {
+            readOnly = false;
+          }
+        } else if (trxtype.equals("PDOUT") || trxtype.equals("BPW")) {
+          if (finAccPaymentMethod.getPaymentMethod().equals(paymentMethod)
+              && finAccPaymentMethod.isPayoutIsMulticurrency()) {
+            readOnly = false;
+          }
         }
       }
     }
@@ -152,6 +161,11 @@
       return OBDal.getInstance().get(FIN_FinancialAccount.class,
           context.get("inpfinFinancialAccountId"));
     }
+    if (context.has("fin_financial_account_id") && !context.isNull("fin_financial_account_id")
+        && !"".equals(context.getString("fin_financial_account_id"))) {
+      return OBDal.getInstance().get(FIN_FinancialAccount.class,
+          context.get("fin_financial_account_id"));
+    }
     return null;
   }
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMConstants.java	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMConstants.java	Mon Aug 18 08:57:02 2014 +0200
@@ -26,5 +26,6 @@
   public final static String PAYMENT_IN_WINDOW_ID = "E547CE89D4C04429B6340FFA44E70716";
   public final static String PAYMENT_OUT_WINDOW_ID = "6F8F913FA60F4CBD93DC1D3AA696E76E";
   public final static String TRANSACTION_WINDOW_ID = "94EAA455D2644E04AB25D93BE5157B6D";
+  public final static String ADD_PAYMENT_MENU = "NULLWINDOWID";
 
 }
\ No newline at end of file
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Mon Aug 18 13:51:02 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Mon Aug 18 08:57:02 2014 +0200
@@ -118,6 +118,7 @@
   }
   if (trxtype === "") {
     form.removeField(0);
+    form.removeField(1);
   }
 };
 
@@ -135,10 +136,21 @@
       orgId = form.getItem('ad_org_id').getValue();
 
   callback = function (response, data, request) {
-    var isShown = data.isPayIsMulticurrency && currencyId !== data.currencyToId;
+    var isShown = false;
+    if (data.currencyId) {
+      if (!form.getItem('c_currency_id').valueMap) {
+        form.getItem('c_currency_id').valueMap = {};
+      }
+      form.getItem('c_currency_id').setValue(data.currencyId);
+      form.getItem('c_currency_id').valueMap[data.currencyId] = data.currencyIdIdentifier;
+    }
+    isShown = data.isPayIsMulticurrency && currencyId !== data.currencyToId && currencyId !== undefined;
     if (data.isWrongFinancialAccount) {
       form.getItem('fin_financial_account_id').setValue('');
     } else {
+      if (!form.getItem('c_currency_to_id').valueMap) {
+        form.getItem('c_currency_to_id').valueMap = {};
+      }
       form.getItem('c_currency_to_id').setValue(data.currencyToId);
       form.getItem('c_currency_to_id').valueMap[data.currencyToId] = data.currencyToIdentifier;
       if (recalcConvRate && isc.isA.Number(data.conversionrate)) {
@@ -782,7 +794,8 @@
       issotrx = form.getItem('issotrx'),
       affectedParams = [],
       ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
-      newCriteria;
+      organization = form.getItem('ad_org_id'),
+      newCriteria, callback;
   if (document === 'RCIN') {
     issotrx.setValue(true);
   } else {
@@ -791,6 +804,9 @@
 
   form.getItem('fin_paymentmethod_id').setValue(null);
   form.getItem('received_from').setValue(null);
+  if (!form.paramWindow.parentWindow) {
+    form.getItem('fin_financial_account_id').setValue(null);
+  }
   OB.APRM.AddPayment.reloadLabels(form);
   affectedParams.push(form.getField('credit_to_use_display_logic').paramId);
   affectedParams.push(form.getField('actual_payment_readonly_logic').paramId);
@@ -806,6 +822,17 @@
     ordinvgrid.invalidateCache();
     form.redraw();
   }
+
+  callback = function (response, data, request) {
+    form.getItem('payment_documentno').setValue(data.payment_documentno);
+  };
+
+  if (document !== "") {
+    OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.AddPaymentDocumentNoActionHandler', {
+      organization: organization.getValue(),
+      issotrx: issotrx.getValue()
+    }, {}, callback);
+  }
 };
 
 OB.APRM.AddPayment.receivedFromOnChange = function (item, view, form, grid) {
@@ -813,12 +840,18 @@
       trxtype = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
       callback, receivedFrom = form.getItem('received_from').getValue(),
       isSOTrx = form.getItem('issotrx').getValue(),
-      financialAccount = form.getItem('fin_financial_account_id').getValue();
+      financialAccount = form.getItem('fin_financial_account_id').getValue(),
+      ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      defaultFilter = {
+      businessPartnerName: item.getElementValue()
+      };
   affectedParams.push(form.getField('credit_to_use_display_logic').paramId);
   OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
 
   callback = function (response, data, request) {
-    form.getItem('fin_paymentmethod_id').setValue(data.paymentMethodId);
+    if (data.paymentMethodId !== '') {
+      form.getItem('fin_paymentmethod_id').setValue(data.paymentMethodId);
+    }
   };
 
   if (trxtype !== "") {
@@ -827,6 +860,8 @@
       isSOTrx: isSOTrx,
       financialAccount: financialAccount
     }, {}, callback);
+    ordinvgrid.setFilterEditorCriteria(defaultFilter);
+    ordinvgrid.filterByEditor();
   }
 };
 
@@ -836,7 +871,9 @@
   thisform = form;
   thisview = view;
   params.context = form.paramWindow.getContextInfo();
-  params.context.inpwindowId = form.paramWindow.parentWindow.windowId;
+  if (form.paramWindow.parentWindow && form.paramWindow.parentWindow.windowId) {
+    params.context.inpwindowId = form.paramWindow.parentWindow.windowId;
+  }
 
   callbackDisplayLogicActionHandler = function (response, data, request) {
     var i, field, def, values = data.values,