CSV Import transactions can work for some lines and fail for others


The CSV Importer uses one transaction per master record. That leads to the fact that some records can fail but the rest will be applied. As data in an erp is in most cases very important data I see many cases where a failure is not an option. The user has to check every line in the log file to find out if the import worked. That would not be the case if the whole import is done in one single transaction.

On the other hand there are also good reasons for the actual behaviour: You can import most of the lines automatic and then work on the failed manually.

This behaviour seems introduced with which shows another reason for the actual behaviour: Transactions should not run too long.

I think a good solution can be an additional parameter for the process that allows the user to choose both ways.

We can think about allowing to set that only in the import process as a process parameter with a default value of "single line transaction" and not with the import toolbar button. That may make the ui less chatty in the case of manual import. I am not sure about that - I think I would add the button there too...





Carlos Ruiz
August 27, 2015, 2:43 PM

There is an easy workaround that you can test to see if it works:

First tab - a table that is the same for all the records to import (i.e. AD_Client)
Second tab - the table you want to import in a single trx

And do the import as a master/detail - as all the details are on the same master it will be on a single trx.


Carlos Ruiz

Thomas Bayen
August 27, 2015, 3:10 PM

That is a workaround but not a solution. I don't like the idea to create a new window for every time I want to import something in a single transaction.

Carlos Ruiz
August 27, 2015, 3:27 PM

Yes, precisely, workaround.

Documenting it here in case others find it worthy.

The design of the importer took that into account precisely to avoid what you wrote "That leads to the fact that some records can fail but the rest will be applied".
The old importers didn't have any way to manage transactions, a sales order with three lines can end completed with two lines imported.
We defined the transactionality per master record precisely to avoid that situation, but not for the whole file as it doesn't sound too wise in terms of lockings.

But of course, this is extensible, and it must be easy to extend the concept to make trx per file, just that because of lockings that must be an option, and not the default option.


Carlos Ruiz




Thomas Bayen



Tested By



Affects versions