diff --git a/src/org/openbravo/module/remittance/process/REM_RemittanceProcess.java b/src/org/openbravo/module/remittance/process/REM_RemittanceProcess.java
--- a/src/org/openbravo/module/remittance/process/REM_RemittanceProcess.java
+++ b/src/org/openbravo/module/remittance/process/REM_RemittanceProcess.java
@@ -41,7 +41,6 @@
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.dal.service.OBQuery;
 import org.openbravo.database.ConnectionProvider;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
@@ -70,6 +69,7 @@
   private static final String GENERATED_GROUPED_PAYMENT_DUEDATE = "GGPD";
   private static final String GENERATED_GROUPED_PAYMENT_INVOICE = "GGPI";
   private static final String GENERATED_GROUPED_PAYMENT_INVOICE_DUEDATE = "GGID";
+  private static String strRemittanceId = "";
 
   private OBError error = new OBError();
 
@@ -87,7 +87,8 @@
 
       // retrieve standard params
       final String recordID = (String) bundle.getParams().get("REM_Remittance_ID");
-      final Remittance remittance = dao.getObject(Remittance.class, recordID);
+      strRemittanceId = recordID;
+      Remittance remittance = dao.getObject(Remittance.class, recordID);
 
       final VariablesSecureApp vars = bundle.getContext().toVars();
       final ConnectionProvider conProvider = bundle.getConnection();
@@ -185,7 +186,7 @@
           msg.setMessage(msg.getMessage() + "\n" + error.getMessage());
         }
 
-        OBDal.getInstance().getSession().refresh(remittance);
+        remittance = OBDal.getInstance().get(Remittance.class, strRemittanceId);
         if (remittance.getRemittanceType().isRemitForDiscount() && isReceipt) {
           FIN_PaymentMethod pm = remittance.getRemittanceType().getPaymentMethodForDiscount();
           List<FinAccPaymentMethod> financialAccountPMs = remittance.getFinancialAccount()
@@ -372,7 +373,7 @@
         addRemittanceBankInstruction(remittance, payment);
       }
     }
-
+    whereClause.append(" select remline.id from REM_RemittanceLine ");
     // Get remittance lines ordered by business partner of the invoice/order
     whereClause.append(" as remline join remline.paymentScheduleDetail as psd");
     whereClause.append(" left outer join psd.orderPaymentSchedule as ops");
@@ -385,22 +386,22 @@
     whereClause.append(" coalesce(inv.salesTransaction, ord.salesTransaction), ");
     whereClause.append(" coalesce(inv.id, ord.id) ");
 
-    parameters.add(remittance.getId());
+    final Query remitanceLineQuery = OBDal.getInstance().getSession()
+        .createQuery(whereClause.toString());
+    remitanceLineQuery.setParameter(0, remittance.getId());
 
-    final OBQuery<RemittanceLine> obqRemLine = OBDal.getInstance().createQuery(
-        RemittanceLine.class, whereClause.toString());
-    obqRemLine.setParameters(parameters);
+    List<String> lines = remitanceLineQuery.list();
+    List<FIN_PaymentScheduleDetail> psdList = new ArrayList<FIN_PaymentScheduleDetail>();
 
-    List<RemittanceLine> lines = obqRemLine.list();
-    List<FIN_PaymentScheduleDetail> psdList = new ArrayList<FIN_PaymentScheduleDetail>();
+    OBDal.getInstance().getSession().clear();
     List<RemittanceLine> remLines = new ArrayList<RemittanceLine>();
     HashMap<String, BigDecimal> hm = new HashMap<String, BigDecimal>();
     BigDecimal currentPaymentTotal = BigDecimal.ZERO;
     Date expectedDate = null;
-
     int size = lines.size();
     for (int i = 0; i < size; i++) {
-      RemittanceLine line = lines.get(i);
+      remittance = OBDal.getInstance().get(Remittance.class, strRemittanceId);
+      RemittanceLine line = OBDal.getInstance().get(RemittanceLine.class, lines.get(i).toString());
       BusinessPartner nextbp = null;
       Invoice nextInvoice = null;
       Date nextExpectedDate = null;
@@ -427,7 +428,8 @@
         expectedDate = lineExpectedDate;
       }
       if ((i + 1) < size) { // Is not the last Item
-        RemittanceLine nextline = lines.get(i + 1);
+        RemittanceLine nextline = OBDal.getInstance().get(RemittanceLine.class,
+            lines.get(i + 1).toString());
         nextbp = nextline.getPaymentScheduleDetail().getInvoicePaymentSchedule() != null ? nextline
             .getPaymentScheduleDetail().getInvoicePaymentSchedule().getInvoice()
             .getBusinessPartner() : nextline.getPaymentScheduleDetail().getOrderPaymentSchedule()
@@ -487,7 +489,6 @@
               hm, false, false);
           OBDal.getInstance().save(payment);
           OBDal.getInstance().flush();
-
           ConnectionProvider conn = new DalConnectionProvider();
           OBError error = FIN_AddPayment.processPayment(new VariablesSecureApp(OBContext
               .getOBContext().getUser().getId(), OBContext.getOBContext().getCurrentClient()
@@ -510,12 +511,15 @@
         addRemittanceBankInstruction(remittance, psdList, hm, expectedDate);
         // Clear data structures, new business partner starts
         psdList = new ArrayList<FIN_PaymentScheduleDetail>();
+        OBDal.getInstance().getSession().clear();
         hm = new HashMap<String, BigDecimal>();
         remLines = new ArrayList<RemittanceLine>();
         currentPaymentTotal = BigDecimal.ZERO;
         expectedDate = null;
       }
+
     }
+    remittance = OBDal.getInstance().get(Remittance.class, strRemittanceId);
     if (remittance.isSinglePayment()) {
       createSinglePayment(remittance);
     }
