Skip to content
Snippets Groups Projects
Commit 990e0e55 authored by Benjamin - Le Filament's avatar Benjamin - Le Filament
Browse files

[add] option to select quote or not on csv export

parent 351f1146
No related branches found
No related tags found
No related merge requests found
......@@ -65,11 +65,15 @@ class JournalDatasExport(http.Controller):
# Common function
# ------------------------------------------------------
def export_csv(self, export_id, lines_to_export, filename_):
if export_id.csv_quote_all:
quote = csv.QUOTE_ALL
else:
quote = csv.QUOTE_NONE
fp = StringIO()
export_file = csv.writer(
fp,
delimiter=export_id.delimiter,
quoting=csv.QUOTE_ALL)
quoting=quote)
# Add header line
if export_id.is_header:
row = []
......
......@@ -32,3 +32,4 @@ class ExportJournalType(models.Model):
delimiter = fields.Char('Séparateur', default=';')
csv_datestyle = fields.Char('Format Date CSV', default='%Y-%m-%d')
xls_datestyle = fields.Char('Format Date XLS', default='YYYY-MM-DD')
csv_quote_all = fields.Boolean("CSV Quote", default=True)
......@@ -20,6 +20,7 @@
<field name="journal_ids" widget="many2many_tags" options="{'no_create': 1}" required="1"/>
<field name="is_header"/>
<field name="delimiter" required="1"/>
<field name="csv_quote_all"/>
<field name="csv_datestyle" required="1"/>
<field name="xls_datestyle" required="1"/>
</group>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment