Updating values by CSV import


(Jani-Matti Hätinen) #1

Is it possible to update values of e.g. existing parties by importing a CSV file?

When I try to import a CSV with simply the party Code and Name (in which in some cases the Name has changed and should thus the updated, in other cases hasn’t changed, but can still be updated), I get the error: The code of the party must be unique.

Can’t see any options in the CSV import dialog regarding updating existing parties/entities. Seems rather retarded to duplicate, or delete existing database info just to be able to do a mass update.


(Cédric Krier) #2

Tryton does not support such feature. Synchronization is a complex task that can not be managed with the simple CSV import.


(Jani-Matti Hätinen) #3

Umm. No it’s not.

If you use unique record IDs (such as the Party Code is by default) as line identifiers in the CSV there’s nothing complex about merging/updating records. Just check whether the UID exists, and if it does, update the existing record. If there’s no UID given in the import, there’s nothing else one can do, but create new records.


(Jani-Matti Hätinen) #4

Just to clarify, what I’m talking about is the specific use case where you take an export from the Tryton database, with row IDs, match it with an external data source (data dump from another database, or an Excel/Libreoffice spreadsheet usually), and feed it back into Tryton, with the row IDs intact.

Without row IDs, trying to decipher which CSV rows are updates to existing records and which are new records would indeed be insane. Or, at the very least, almost unique to each use case and thus clearly outside of the scope of the core project.


(Cédric Krier) #5

Of course simple update could be implement, I do not see any problem to submit such patch.