[Reconciliation] fixed editable currency and reload grid
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 06 Aug 2014 15:07:44 +0200
changeset 24502 ec2d92ea9ef1
parent 24501 a10bdfe985e4
child 24503 d7c33b8d75fc
[Reconciliation] fixed editable currency and reload grid
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentReadOnlyLogics.java
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Aug 06 15:07:44 2014 +0200
@@ -264,6 +264,20 @@
 <!--51F0875CB4114D90A239FBCA54B5C1AB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--51F0875CB4114D90A239FBCA54B5C1AB--></AD_ELEMENT>
 
+<!--52F85707307D4FC5923B7CA29B8D8A87--><AD_ELEMENT>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_ELEMENT_ID><![CDATA[52F85707307D4FC5923B7CA29B8D8A87]]></AD_ELEMENT_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <COLUMNNAME><![CDATA[c_currency_id_readonly_logic]]></COLUMNNAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <NAME><![CDATA[Currency Read Only Logic]]></NAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <PRINTNAME><![CDATA[Currency Read Only Logic]]></PRINTNAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></DESCRIPTION>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></HELP>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--52F85707307D4FC5923B7CA29B8D8A87--></AD_ELEMENT>
+
 <!--533E204A46FD4BB9AED3D9FC26EEC67C--><AD_ELEMENT>
 <!--533E204A46FD4BB9AED3D9FC26EEC67C-->  <AD_ELEMENT_ID><![CDATA[533E204A46FD4BB9AED3D9FC26EEC67C]]></AD_ELEMENT_ID>
 <!--533E204A46FD4BB9AED3D9FC26EEC67C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Wed Aug 06 15:07:44 2014 +0200
@@ -1134,6 +1134,32 @@
 <!--B86607BED54F45B89718C80C61878093-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--B86607BED54F45B89718C80C61878093--></OBUIAPP_PARAMETER>
 
+<!--B8ECE87414564F1D8B974572A458E98A--><OBUIAPP_PARAMETER>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <OBUIAPP_PARAMETER_ID><![CDATA[B8ECE87414564F1D8B974572A458E98A]]></OBUIAPP_PARAMETER_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <NAME><![CDATA[Currency Read Only Logic]]></NAME>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></DESCRIPTION>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></HELP>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <SEQNO><![CDATA[1230]]></SEQNO>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <COLUMNNAME><![CDATA[c_currency_id_readonly_logic]]></COLUMNNAME>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_ELEMENT_ID><![CDATA[52F85707307D4FC5923B7CA29B8D8A87]]></AD_ELEMENT_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--B8ECE87414564F1D8B974572A458E98A--></OBUIAPP_PARAMETER>
+
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB--><OBUIAPP_PARAMETER>
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB-->  <OBUIAPP_PARAMETER_ID><![CDATA[BC5E638E184C4F3AB36B9DA574E0E8BB]]></OBUIAPP_PARAMETER_ID>
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1257,7 +1283,8 @@
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <READONLYLOGIC><![CDATA[true]]></READONLYLOGIC>
+<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <READONLYLOGIC><![CDATA[@c_currency_id_readonly_logic@ == 'Y']]></READONLYLOGIC>
+<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.currencyOnChange ]]></ONCHANGEFUNCTION>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2--></OBUIAPP_PARAMETER>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java	Wed Aug 06 15:07:44 2014 +0200
@@ -74,6 +74,8 @@
           return handler.getFinancialAccountReadOnlyLogic(requestMap) ? "Y" : "N";
         case ConversionRate:
           return handler.getConversionRateReadOnlyLogic(requestMap) ? "Y" : "N";
+        case Currency:
+          return handler.getCurrencyReadOnlyLogic(requestMap) ? "Y" : "N";
         }
       } catch (Exception e) {
         log.error("Error trying to get default value of " + strCurrentParam + " " + e.getMessage(),
@@ -116,7 +118,7 @@
         "received_from_readonly_logic"), PaymentMethod("payment_method_readonly_logic"), ActualPayment(
         "actual_payment_readonly_logic"), ConvertedAmount("converted_amount_readonly_logic"), PaymentDate(
         "payment_date_readonly_logic"), FinancialAccount("fin_financial_account_id_readonly_logic"), ConversionRate(
-        "conversion_rate_readonly_logic");
+        "conversion_rate_readonly_logic"), Currency("c_currency_id_readonly_logic");
 
     private String columnname;
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java	Wed Aug 06 15:07:44 2014 +0200
@@ -53,6 +53,8 @@
   abstract boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
       throws JSONException;
 
+  abstract boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException;
+
   protected abstract long getSeq();
 
   boolean getConvertedAmountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
@@ -108,4 +110,5 @@
       OBContext.restorePreviousMode();
     }
   }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -62,4 +62,9 @@
   boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
+
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -63,4 +63,9 @@
     return true;
   }
 
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -63,4 +63,9 @@
     return false;
   }
 
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -63,4 +63,9 @@
     return false;
   }
 
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -63,4 +63,9 @@
     return false;
   }
 
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -64,4 +64,9 @@
     return false;
   }
 
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
 }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentReadOnlyLogics.java	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/TransactionAddPaymentReadOnlyLogics.java	Wed Aug 06 15:07:44 2014 +0200
@@ -24,6 +24,10 @@
 import org.codehaus.jettison.json.JSONObject;
 import org.openbravo.advpaymentmngt.utility.APRMConstants;
 import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod;
+import org.openbravo.model.financialmgmt.payment.FinAccPaymentMethod;
 
 @ComponentProvider.Qualifier(APRMConstants.TRANSACTION_WINDOW_ID)
 public class TransactionAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
@@ -75,4 +79,79 @@
   boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
     return true;
   }
+
+  @Override
+  boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    FIN_PaymentMethod paymentMethod = null;
+    FIN_FinancialAccount financialAccount = null;
+    boolean readOnly = true;
+    if (context.has("fin_paymentmethod_id") && !context.isNull("fin_paymentmethod_id")) {
+      paymentMethod = OBDal.getInstance().get(FIN_PaymentMethod.class,
+          context.getString("fin_paymentmethod_id"));
+    } else {
+      paymentMethod = OBDal.getInstance()
+          .get(FIN_PaymentMethod.class, getPaymentMethod(requestMap));
+    }
+    if (context.has("inpfinFinancialAccountId") && !context.isNull("inpfinFinancialAccountId")) {
+      financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+          context.getString("inpfinFinancialAccountId"));
+    } else if (context.has("fin_financial_account_id")
+        && !context.isNull("fin_financial_account_id")) {
+      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;
+        }
+      }
+    }
+    return readOnly;
+  }
+
+  private String getPaymentMethod(Map<String, String> requestMap) throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    boolean isReceipt = true;
+    if (context.has("IsSOTrx")) {
+      isReceipt = "Y".equals(context.get("IsSOTrx")) ? true : false;
+    }
+
+    FinAccPaymentMethod anyFinAccPaymentMethod = null;
+    for (FinAccPaymentMethod finAccPaymentMethod : getFinancialAccount(requestMap)
+        .getFinancialMgmtFinAccPaymentMethodList()) {
+      if (finAccPaymentMethod.isDefault()) {
+        if ((isReceipt && finAccPaymentMethod.isPayinAllow())
+            || (!isReceipt && finAccPaymentMethod.isPayoutAllow())) {
+          return finAccPaymentMethod.getPaymentMethod().getId();
+        }
+      }
+      if ((isReceipt && finAccPaymentMethod.isPayinAllow())
+          || (!isReceipt && finAccPaymentMethod.isPayoutAllow())) {
+        anyFinAccPaymentMethod = finAccPaymentMethod;
+      }
+    }
+    return anyFinAccPaymentMethod != null ? anyFinAccPaymentMethod.getPaymentMethod().getId() : "";
+  }
+
+  private FIN_FinancialAccount getFinancialAccount(Map<String, String> requestMap)
+      throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    if (context.has("inpfinFinancialAccountId") && !context.isNull("inpfinFinancialAccountId")
+        && !"".equals(context.getString("inpfinFinancialAccountId"))) {
+      return OBDal.getInstance().get(FIN_FinancialAccount.class,
+          context.get("inpfinFinancialAccountId"));
+    }
+    return null;
+  }
 }
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Tue Aug 05 14:48:51 2014 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Wed Aug 06 15:07:44 2014 +0200
@@ -170,8 +170,11 @@
 };
 
 OB.APRM.AddPayment.financialAccountOnChange = function (item, view, form, grid) {
+  var affectedParams = [];
   OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
   OB.APRM.AddPayment.checkSingleActionAvailable(form);
+  affectedParams.push(form.getField('c_currency_id_readonly_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
 };
 
 OB.APRM.AddPayment.paymentMethodOnChange = function (item, view, form, grid) {
@@ -179,13 +182,35 @@
       defaultFilter = {
       paymentMethodName: item.getElementValue()
       },
-      trxtype = form.getItem('trxtype').getValue();
+      trxtype = form.getItem('trxtype').getValue(),
+      affectedParams = [];
   OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
   OB.APRM.AddPayment.checkSingleActionAvailable(form);
   if (trxtype !== "") {
     ordinvgrid.setFilterEditorCriteria(defaultFilter);
     ordinvgrid.filterByEditor();
   }
+  affectedParams.push(form.getField('c_currency_id_readonly_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
+};
+
+OB.APRM.AddPayment.currencyOnChange = function (item, view, form, grid) {
+  var trxtype = form.getItem('trxtype').getValue(),
+      ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      newCriteria;
+  if (trxtype !== "") {
+    OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
+
+    // fetch data after change trx type, filters should be preserved and ids of
+    // the selected records should be sent
+    newCriteria = ordinvgrid.addSelectedIDsToCriteria(ordinvgrid.getCriteria(), true);
+    newCriteria.criteria = newCriteria.criteria || [];
+    // add dummy criterion to force fetch
+    newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+    ordinvgrid.invalidateCache();
+
+    form.redraw();
+  }
 };
 
 OB.APRM.AddPayment.transactionTypeOnChangeFunction = function (item, view, form, grid) {
@@ -214,7 +239,7 @@
   newCriteria.criteria = newCriteria.criteria || [];
   // add dummy criterion to force fetch
   newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
-  ordinvgrid.fetchData(newCriteria);
+  ordinvgrid.invalidateCache();
 
   form.redraw();
 };
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Tue Aug 05 14:48:51 2014 +0200
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Wed Aug 06 15:07:44 2014 +0200
@@ -75,6 +75,8 @@
 <!--08391130B441429AB0F05C3747950973-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--08391130B441429AB0F05C3747950973-->  <AD_COLUMN_ID><![CDATA[7891269C83E2655DE040007F010155CE]]></AD_COLUMN_ID>
 <!--08391130B441429AB0F05C3747950973-->  <NAME><![CDATA[Status]]></NAME>
+<!--08391130B441429AB0F05C3747950973-->  <DESCRIPTION><![CDATA[A defined state or position of a payment.]]></DESCRIPTION>
+<!--08391130B441429AB0F05C3747950973-->  <HELP><![CDATA[Current status of a debt/payment.]]></HELP>
 <!--08391130B441429AB0F05C3747950973-->  <PROPERTY><![CDATA[status]]></PROPERTY>
 <!--08391130B441429AB0F05C3747950973-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--08391130B441429AB0F05C3747950973-->  <SORT><![CDATA[Y]]></SORT>
@@ -370,6 +372,8 @@
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <AD_COLUMN_ID><![CDATA[03276FB53CC54CC1829E0AA6EC0F2EE6]]></AD_COLUMN_ID>
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <NAME><![CDATA[Financial Account]]></NAME>
+<!--2B6B9530CE04486ABBCACA9B04873C1B-->  <DESCRIPTION><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></DESCRIPTION>
+<!--2B6B9530CE04486ABBCACA9B04873C1B-->  <HELP><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></HELP>
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <PROPERTY><![CDATA[account]]></PROPERTY>
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2B6B9530CE04486ABBCACA9B04873C1B-->  <SORT><![CDATA[Y]]></SORT>
@@ -1019,6 +1023,8 @@
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <AD_COLUMN_ID><![CDATA[8032E178607750D5E040007F01004282]]></AD_COLUMN_ID>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <NAME><![CDATA[Document Type]]></NAME>
+<!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <DESCRIPTION><![CDATA[A value defining what sequence and process setup are used to handle this document.]]></DESCRIPTION>
+<!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <HELP><![CDATA[The Document Type determines document sequence and processing rules]]></HELP>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <PROPERTY><![CDATA[documentType]]></PROPERTY>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--4C72931EA7A94CF7B4CF570A8C81DC6A-->  <SORT><![CDATA[Y]]></SORT>
@@ -1366,6 +1372,8 @@
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <AD_COLUMN_ID><![CDATA[7891269C83DC655DE040007F010155CE]]></AD_COLUMN_ID>
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <NAME><![CDATA[Currency]]></NAME>
+<!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <DESCRIPTION><![CDATA[An accepted medium of monetary exchange that may vary across countries.]]></DESCRIPTION>
+<!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <HELP><![CDATA[Indicates the currency to be used when processing this document.]]></HELP>
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <PROPERTY><![CDATA[currency]]></PROPERTY>
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--6AA3521F6AF347338CAD9B9DE8268DE2-->  <SORT><![CDATA[Y]]></SORT>
@@ -1494,7 +1502,9 @@
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <AD_COLUMN_ID><![CDATA[4028C9BC2DA5C491012DA689D11F03BD]]></AD_COLUMN_ID>
-<!--76C49C94F54A4E17BAC70C1920A017BA-->  <NAME><![CDATA[Trx. Amount]]></NAME>
+<!--76C49C94F54A4E17BAC70C1920A017BA-->  <NAME><![CDATA[Received (Financial Account)]]></NAME>
+<!--76C49C94F54A4E17BAC70C1920A017BA-->  <DESCRIPTION><![CDATA[Amount received in currency of financial account]]></DESCRIPTION>
+<!--76C49C94F54A4E17BAC70C1920A017BA-->  <HELP><![CDATA[The total amount of the payment, converted to the currency of the financial account.]]></HELP>
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <PROPERTY><![CDATA[financialTransactionAmount]]></PROPERTY>
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--76C49C94F54A4E17BAC70C1920A017BA-->  <SORT><![CDATA[Y]]></SORT>
@@ -1515,6 +1525,8 @@
 <!--775E5035EA174F24BEC50854F6F74626-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--775E5035EA174F24BEC50854F6F74626-->  <AD_COLUMN_ID><![CDATA[7891269C83D9655DE040007F010155CE]]></AD_COLUMN_ID>
 <!--775E5035EA174F24BEC50854F6F74626-->  <NAME><![CDATA[Business Partner]]></NAME>
+<!--775E5035EA174F24BEC50854F6F74626-->  <DESCRIPTION><![CDATA[Anyone who takes part in daily business operations by acting as a customer, employee, etc.]]></DESCRIPTION>
+<!--775E5035EA174F24BEC50854F6F74626-->  <HELP><![CDATA[A Business Partner is anyone with whom you transact.  This can include a customer, vendor, employee or any combination of these.]]></HELP>
 <!--775E5035EA174F24BEC50854F6F74626-->  <PROPERTY><![CDATA[businessPartner]]></PROPERTY>
 <!--775E5035EA174F24BEC50854F6F74626-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--775E5035EA174F24BEC50854F6F74626-->  <SORT><![CDATA[Y]]></SORT>