Skip to content

Commit

Permalink
Merge pull request #4 from mpanarin/11-add-connector_importer
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk committed Sep 4, 2018
2 parents 2ef630e + 5f4a278 commit ea4883f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions connector_importer/models/recordset.py
Expand Up @@ -3,6 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import json
import base64
import os
from collections import OrderedDict

Expand Down Expand Up @@ -280,12 +281,12 @@ def run_import(self):
def generate_report(self):
self.ensure_one()
reporter = self.get_source().get_reporter()
if not reporter:
if reporter is None:
logger.debug('No reporter found...')
return
metadata, content = reporter.report_get(self)
self.write({
'report_file': content.encode('base64'),
'report_file': base64.encodestring(content.encode()),
'report_filename': metadata['complete_filename']
})
logger.info((
Expand Down
2 changes: 1 addition & 1 deletion connector_importer/models/reporter.py
Expand Up @@ -25,7 +25,7 @@ class ReporterMixin(models.AbstractModel):
@api.model
def report_get(self, recordset, **options):
"""Create and return a report for given recordset."""
fileout = io.BytesIO()
fileout = io.StringIO()
self.report_do(recordset, fileout, **options)
self.report_finalize(recordset, fileout, **options)
metadata = self.report_get_metadata(recordset, **options)
Expand Down

0 comments on commit ea4883f

Please sign in to comment.