Browse Source

[12.0][ENH] excel_import_export, faster export

Previously export is slow on large number of rows.
This fix ensure that sheet.insert_rows is called only once for all rows,
instead of insert 1 row for every rows
12.0-mig-module_prototyper_last
kittiu 5 years ago
parent
commit
577ae5d5fb
  1. 4
      excel_import_export/models/xlsx_export.py
  2. 5
      excel_import_export/readme/HISTORY.rst

4
excel_import_export/models/xlsx_export.py

@ -200,9 +200,7 @@ class XLSXExport(models.AbstractModel):
# Insert rows to preserve total line # Insert rows to preserve total line
if not rows_inserted: if not rows_inserted:
rows_inserted = True rows_inserted = True
if row_count > 1:
for _x in range(row_count-1):
st.insert_rows(row+1)
st.insert_rows(row+1, amount=row_count-1)
# -- # --
for (row_val, style) in vals[field]: for (row_val, style) in vals[field]:
new_row = row + i new_row = row + i

5
excel_import_export/readme/HISTORY.rst

@ -1,3 +1,8 @@
12.0.1.0.5 (2019-12-19)
~~~~~~~~~~~~~~~~~~~~~~~
* Speed up export when dealing with many rows
12.0.1.0.4 (2019-08-28) 12.0.1.0.4 (2019-08-28)
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~

Loading…
Cancel
Save