Search code examples
odooodoo-8wkhtmltopdf

Can't generate pdf report in odoo 8


When i trying to print customer invoice getting an error:

Traceback (most recent call last):
  File "/home/ubuntu/liveAMS/openerp/addons/report/controllers/main.py", line 121, in report_download
    response = self.report_routes(reportname, docids=docids, converter='pdf')
  File "/home/ubuntu/liveAMS/openerp/http.py", line 403, in response_wrap
    response = f(*args, **kw)
  File "/home/ubuntu/liveAMS/openerp/addons/report/controllers/main.py", line 65, in report_routes
    pdf = report_obj.get_pdf(cr, uid, docids, reportname, data=options_data, context=context)
  File "/home/ubuntu/liveAMS/openerp/api.py", line 256, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/ubuntu/liveAMS/openerp/addons/report/models/report.py", line 198, in get_pdf
    save_in_attachment = self._check_attachment_use(cr, uid, ids, report)
  File "/home/ubuntu/liveAMS/openerp/api.py", line 256, in wrapper
    return old_api(self, *args, **kwargs)
 File "/home/ubuntu/liveAMS/openerp/addons/report/models/report.py", line 345, in _check_attachment_use
    pdf = base64.decodestring(pdf)
 File "/usr/lib/python2.7/base64.py", line 321, in decodestring
   return binascii.a2b_base64(s)
TypeError: must be string or buffer, not None

Installed wkhtmltopdf: wkhtmltopdf 0.12.2.1 (with patched qt).

How can resolve this?


Solution

  • Odoo might be trying to load an empty PDF from the database. In this case, try these:

    1. Enable debug / developer mode - go to yoursite.com/web?debug

    2. Go to Settings > Technical > Reports > Reports

    3. Search for 'invoices'

    4. Click on the report record with name Invoices and Template Name account.report_invoice

    5. Click Edit

    6. Uncheck Reload from attachment

    7. Click Save

    Now try to print the invoice again.