IDEMPIERE-2273:CSV Import fail on evaluate column mandatory logic

This commit is contained in:
hieplq 2016-12-16 16:12:14 +07:00
parent 3a813602ea
commit 8d236a3a9d
1 changed files with 11 additions and 2 deletions

View File

@ -941,7 +941,16 @@ public class GridTabCSVImporter implements IGridTabImporter
return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)})); return new StringBuilder(Msg.getMsg(Env.getCtx(), "FieldNotDisplayed",new Object[] {header.get(i)}));
MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID()); MColumn column = MColumn.get(Env.getCtx(), field.getAD_Column_ID());
if((field.isMandatory(false) || column.isMandatory()) && value == null && field.getDefault()==null){ boolean isWrongValueForMandatory = false;
if (field.isMandatory(false) || column.isMandatory()){
if (isInsertMode() && value == null && field.getDefault()==null){
isWrongValueForMandatory = true;
}else if (!isInsertMode() && "(null)".equals(value)){
isWrongValueForMandatory = true;
}
}
if(isWrongValueForMandatory){
mandatoryColumns.append(" / "); mandatoryColumns.append(" / ");
mandatoryColumns.append(header.get(i)); mandatoryColumns.append(header.get(i));
} }