Fixes issue 21461: Filters Financial Accounts by selected
authorDavid Miguelez <david.miguelez@openbravo.com>
Fri, 14 Sep 2012 14:47:39 +0200
changeset 17957 357149849277
parent 17956 245c366769f7
child 17958 3fec9dfdd735
Fixes issue 21461: Filters Financial Accounts by selected
Payment Method.
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Fri Sep 14 13:09:26 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromInvoice.java	Fri Sep 14 14:47:39 2012 +0200
@@ -505,10 +505,13 @@
     JSONObject msg = new JSONObject();
     try {
       msg.put("combo", finAccountComboHtml);
-      msg.put("financialAccountCurrencyId", financialAccountCurrency.getId());
+      if (financialAccountCurrency != null) {
+        msg.put("financialAccountCurrencyId", financialAccountCurrency.getId());
+        msg.put("financialAccountCurrencyPrecision",
+            financialAccountCurrency.getStandardPrecision());
+      }
       msg.put("exchangeRate", exchangeRate == null ? "" : exchangeRate);
       msg.put("formatOutput", formatOutput);
-      msg.put("financialAccountCurrencyPrecision", financialAccountCurrency.getStandardPrecision());
     } catch (JSONException e) {
       log4j.error("JSON object error" + msg.toString());
     }
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Fri Sep 14 13:09:26 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Fri Sep 14 14:47:39 2012 +0200
@@ -1322,6 +1322,8 @@
       Criterion crit = exp.getCriterion();
       if (crit != null) {
         obc.add(crit);
+      } else {
+        return new ArrayList<FIN_FinancialAccount>();
       }
     }
     return obc.list();