author Asier Lostalé <>
Mon, 23 Feb 2015 11:17:39 +0100
changeset 26041 d061c9e837aa
parent 25233 9eba998e1eb9
child 27448 46cd97b2e65f
permissions -rw-r--r--
fixed bug 28712: record selection lost in p&e grid if data has multiple pages

In P&E grid with data displayed in several pages, if part of the selection was
not in the 1st page two errors occured:

-If after selecting a record in 2nd page another one in the 1st page was selected,
selection of record in 2nd page was lost
-If record in 2nd page was selected by using a filter, the filter was removed, and
the p&e was submitted, the selection was not sent to backend

The problem is in SC grid.getSelectedRecords which returns records only in current

To solve this a cache of selected/unselected records is completelly maintained for p&e
grids without using getSelectedRecords, this is used also to send the selected recors
on p&e submission.
 * 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
 * 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.modulescript;

import org.apache.log4j.Logger;
import org.openbravo.database.ConnectionProvider;
import org.openbravo.utils.FormatUtilities;

public class InitializeBPCurrency extends ModuleScript {

  // Initialize the currency for the customer.Related to the issue
  public void execute() {
    try {
      ConnectionProvider cp = getConnectionProvider();
      boolean isExecuted= InitializeBPCurrencyData.isExecuted(cp);
      if (!isExecuted){
        // update bp currency if it is not updated by initializeCurrency
        // and there exists completed invoice in same currency 
        // for any business partner
      } else {
        boolean isUpdated = InitializeBPCurrencyData.isUpdated(cp);
        if(!isUpdated) {
        boolean isUpdatedFromInv = InitializeBPCurrencyData.isUpdatedFromInvoice(cp);
        if(!isUpdatedFromInv) {
    } catch (Exception e) {