IDEMPIERE-3805 Query gets lost when Importing a csv file from the toolbar button

This commit is contained in:
Diego Ruiz 2018-10-22 18:37:29 +02:00
parent 86c3c5638f
commit 02a89750ae
1 changed files with 20 additions and 0 deletions

View File

@ -291,6 +291,13 @@ public class CSVImportAction implements EventListener<Event>
private void importFile() { private void importFile() {
try { try {
MQuery query = panel.getActiveGridTab().getQuery();
MQuery detailQuery = null;
if (panel.getADTab() != null && panel.getADTab().getSelectedDetailADTabpanel() != null
&& panel.getADTab().getSelectedDetailADTabpanel().getGridTab() != null)
detailQuery = panel.getADTab().getSelectedDetailADTabpanel().getGridTab().getQuery();
IADTabbox adTab = panel.getADTab(); IADTabbox adTab = panel.getADTab();
int selected = adTab.getSelectedIndex(); int selected = adTab.getSelectedIndex();
int tabLevel = panel.getActiveGridTab().getTabLevel(); int tabLevel = panel.getActiveGridTab().getTabLevel();
@ -335,6 +342,19 @@ public class CSVImportAction implements EventListener<Event>
media = new AMedia(theCSVImporter.getSuggestedFileName(panel.getActiveGridTab()), null, theCSVImporter.getContentType(), outFile, true); media = new AMedia(theCSVImporter.getSuggestedFileName(panel.getActiveGridTab()), null, theCSVImporter.getContentType(), outFile, true);
Filedownload.save(media); Filedownload.save(media);
if (query != null) {
query.addRestriction("1=1");
panel.getActiveGridTab().setQuery(query);
panel.getADTab().getSelectedTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords());
}
panel.getActiveGridTab().dataRefresh(false);
if (detailQuery != null){
detailQuery.addRestriction("1=1");
panel.getADTab().getSelectedDetailADTabpanel().getGridTab().setQuery(detailQuery);
panel.getADTab().getSelectedDetailADTabpanel().query(false, 0, MRole.getDefault().getMaxQueryRecords());
panel.getADTab().getSelectedDetailADTabpanel().getGridTab().dataRefresh(false);
}
} catch (Exception e) { } catch (Exception e) {
throw new AdempiereException(e); throw new AdempiereException(e);
} finally { } finally {