IMP acc_export_csv: reinitialize StringIO instead of flush

pull/597/head
David Beal 2019-09-11 11:57:55 +02:00
parent c295e79f35
commit 0827550d46
2 changed files with 6 additions and 8 deletions

View File

@ -38,11 +38,9 @@ class AccountingWriter(object):
data = self.encoder.encode(data) data = self.encoder.encode(data)
# write to the target stream # write to the target stream
self.stream.write(data) self.stream.write(data)
# empty queue with seek() instead of truncate() # seek() or truncate() have side effect then we reinitialize StringIO
# see https://stackoverflow.com/a/9729516 # https://stackoverflow.com/questions/4330812/how-do-i-clear-a-stringio-object
# also problems with seek() if next line is shorter than previous self.queue = StringIO()
# chars of previous line are kept in the new one
self.queue.flush()
def writerows(self, rows): def writerows(self, rows):
for row in rows: for row in rows:

View File

@ -33,9 +33,9 @@
<field name="data" filename="export_filename"/> <field name="data" filename="export_filename"/>
</group> </group>
<footer> <footer>
<button name="action_manual_export_account" string="Trial Balance" type="object" icon="fa-cog" class="oe_highlight"/> <button name="action_manual_export_account" string="Trial Balance" type="object" icon="fa-cog"/>
<button name="action_manual_export_analytic" string="Analytic Balance (with accounts)" type="object" icon="fa-cog" class="oe_highlight"/> <button name="action_manual_export_analytic" string="Analytic Balance (with accounts)" type="object" icon="fa-cog"/>
<button name="action_manual_export_journal_entries" string="Journal Entries" type="object" icon="fa-cog" class="oe_highlight"/> <button name="action_manual_export_journal_entries" string="Journal Entries" type="object" icon="fa-cog"/>
or or
<button string="Close" class="oe_link" special="cancel" /> <button string="Close" class="oe_link" special="cancel" />
</footer> </footer>