IDEMPIERE-6081 Import Csv by Template: Allow import from a detail tab into different parents (#2289)

This commit is contained in:
hengsin 2024-04-04 23:43:19 +08:00 committed by Carlos Ruiz
parent 5d04cc7728
commit 29b36f84e2
1 changed files with 5 additions and 3 deletions

View File

@ -1348,10 +1348,10 @@ public class GridTabCSVImporter implements IGridTabImporter
}
boolean checkParentKey = parentColumns.size()!=gridTab.getParentColumnNames().size();
if(isThereRow && logMsg==null && masterRecord!=null && checkParentKey){
if(isThereRow && logMsg==null && (masterRecord!=null||gridTab.getParentTab()!=null) && checkParentKey){
for(String linkColumn : gridTab.getParentColumnNames()){
String columnName = linkColumn;
Object setValue = masterRecord.get_Value(linkColumn);
Object setValue = masterRecord != null ? masterRecord.get_Value(linkColumn) : gridTab.getParentTab().getValue(linkColumn);
//resolve missing key
if(setValue==null){
columnName = null;
@ -1493,7 +1493,9 @@ public class GridTabCSVImporter implements IGridTabImporter
if (gridTab.isDetail()){
for(String linkColumn : gridTab.getParentColumnNames()){
if(!pquery.getWhereClause().contains(linkColumn)){
Object value = masterRecord!=null?masterRecord.get_Value(linkColumn):null;
Object value = masterRecord!=null
? masterRecord.get_Value(linkColumn)
: gridTab.getParentTab() != null ? gridTab.getParentTab().getValue(linkColumn) : null;
//resolve key
if(value==null){
String columnName = null;