Fixes issue 34803: Error "Entity FIN_PaymentMethod is not directly readable"
authorRafael Queralta Pozo <rqueralta@nauta.cu>
Fri, 23 Dec 2016 07:18:41 -0500
changeset 31038 64ac0cc86133
parent 31037 304cd8d235f9
child 31039 17b1229a255e
Fixes issue 34803: Error "Entity FIN_PaymentMethod is not directly readable"

Added Administrator Mode to getFinancialAccountList method of FIN_Utility class
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Fri Dec 23 08:46:42 2016 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Fri Dec 23 07:18:41 2016 -0500
@@ -559,12 +559,17 @@
       String strFinancialAccountId, String strOrgId, boolean isMandatory, String strCurrencyId,
       boolean isInPayment) {
 
-    List<FIN_FinancialAccount> financialAccounts = dao.getFilteredFinancialAccounts(
-        strPaymentMethodId, strOrgId, strCurrencyId,
-        isInPayment ? AdvPaymentMngtDao.PaymentDirection.IN
-            : AdvPaymentMngtDao.PaymentDirection.OUT);
-    String options = getOptionsList(financialAccounts, strFinancialAccountId, isMandatory);
-    return options;
+    try {
+      OBContext.setAdminMode(true);
+      List<FIN_FinancialAccount> financialAccounts = dao.getFilteredFinancialAccounts(
+          strPaymentMethodId, strOrgId, strCurrencyId,
+          isInPayment ? AdvPaymentMngtDao.PaymentDirection.IN
+              : AdvPaymentMngtDao.PaymentDirection.OUT);
+      String options = getOptionsList(financialAccounts, strFinancialAccountId, isMandatory);
+      return options;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
   }
 
   /**