CSV Import fail on evaluate column mandatory logic

Description

When importing CSV files, the org.adempiere.impexp.GridTabCSVImporter.preprocessRow() submits the CSV row content to the field.isMandatory() function.

When this code is executed, field have the data of the field on current selected record in the UI, this way, all records isMandatory() will be submited to the logic against the current record and depending on the content of the record being inserted, it will return true for an empty field that should be returned false.

This checking can be safely removed from preprocessing, since when the importer fill the data later, it will be checked again with the correct context.

Environment

None

Activity

Show:
Claudemir Todo Bom
October 27, 2014, 12:13 PM

Fixed on this commit on my clone: http://goo.gl/AwBGWW

Already requested a pull.

Best regards,
Claudemir

Carlos Ruiz
November 26, 2014, 11:10 PM

Thanks , I changed a little your approach in order to still check field without checking context - I think this can be useful as column IsMandatory could be overwritten in field and field customization.

Hiep Lq
December 16, 2016, 9:12 AM

can't update a tab have mandatory field
test case:
export data have mandatory field
+ change some value
+ empty mandatory field (so don't want import csv touch this field)

import at merger or update mode.

get error FillMandatory

Fixed

Assignee

Carlos Ruiz

Reporter

Claudemir Todo Bom

Labels

None

Tested By

None

Time tracking

0m

Time remaining

1h

Components

Affects versions

Priority

Major