Export CSV data from URL


We have CSV export from the client, this is useful for users to manipulate data outside Tryton for example in spreadsheet. But some experimented users may want to go further by automating the process. For that they may want to use spreadsheet functionality like IMPORTDATA from Google.


I propose to add a generic entry point that returns CSV file like the export data on the client.
I think the URL could be generated automatically by the client on the export windows using the selected parameters. This will ease the learning of the URL syntax by the user.
The entry-point is of course be protected by authentication and the access rights will be enforced using the authenticated user. Any undefined locale settings is taken from the default value of the authenticated user.

The URL syntax is:


The parameters are:

  • l: language used, default: user language
  • d: JSON domain, default: []
  • o: list of the couple field name and direction to order, default: None
  • s: limit the number of record
  • p: number of page to skip (p * s = offset)
  • f: list of field names (same as for ModelStorage.export_data)
  • dl: CSV delimiter, default ,
  • qc: quote char, default "
  • enc: encoding, default UTF-8
  • loc: Boolean to use locale formatting for date/time, number.


I don’t see the point in having short parameters name.

As the URL may be already quite long (e.g. JSON domain) and that some parameters will be repeated a lot of time (e.g. fields), I think it is good to limit the size especially those repeated. This is because URL are de facto limited to 2000 chars.

What if limit is not set? All records will be exported?

How will be the URL exposed to the user?

Yes like for search.

As an URL to copy.

The current export button will be removed? I do not see any benefit about adding a extra step to the current export workflow.


There will be no extra step with the current export workflow.
But the user will have the ability to get also an URL where he can repeat the export and automate it.

Here is Issue 9090: Add export CSV route - Tryton issue tracker which implements it.
So mainly I added a button under the save which allows to copy (or open) the URL.
I also added an option to allow to export all the listed records instead of just the selected (as usual).