Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

[SOLVED] Error to generate a qweb-pdf (odoo 8)

By
dlsuarez
on 2/4/15, 7:51 AM 3,418 views

Hello, 

My report is located in a wizard view (my_module/wizards/stats_view.xml):

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report
            id="crm_ticket_platforms_report_crm_stats"
            model="stats"
            string="Stats"
            name="crm_ticket_platforms.crm_stats"
            file="crm_ticket_platforms.crm_stats"
            report_type="qweb-pdf"
        />
        ...
        ...

And I have inside of 'reports' folder the next code:

my_module/report/crm_stats.py

from openerp import api, models

class CrmStatsReport(models.AbstractModel):
    _name = 'report.crm_ticket_platforms.crm_stats'

    @api.multi
    def render_html(self, data=None):
        report_obj = self.env['report']
        report = report_obj._get_report_from_name(
            'crm_ticket_platforms.crm_stats')
        docargs = {
            'doc_ids': self._ids,
            'doc_model': report.model,
            'docs': self,
        }
        return report_obj.render('crm_ticket_platforms.crm_stats', docargs)

my_module/report/crm_stats.xml

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
        <template id="crm_stats">
            <t t-call="report.html_container">
                <t t-foreach="docs" t-as="o">
                    <t t-call="report.external_layout">
                        <div class="page">
                            <h2>Stats</h2>
                        </div>
                    </t>
                </t>
            </t>
        </template>
    </data>
</openerp>

It doesn't generate errors in my module, but show this errors:

File "/opt/odoo/odoo_8_devel/code/linked-addons/report/models/report.py", line 442, in _run_wkhtmltopdf
    wkhtmltopdf = [_get_wkhtmltopdf_bin()] + command_args + local_command_args
File "/opt/odoo/odoo_8_devel/code/linked-addons/report/models/report.py", line 54, in _get_wkhtmltopdf_bin
    raise IOError
IOError

My version of wkhtmltopdf is 0.12.2.1

I need to fix this, thanks!

 

 

3

zbik

--zbik--
5976
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 2/4/15, 8:15 AM

Code where error is shown:

    wkhtmltopdf_bin = find_in_path('wkhtmltopdf')
    if wkhtmltopdf_bin is None:
        raise IOError

from this it follows that the system can not find the path to wkhtmltopdf.

Probably problem with wkhtmltopdf. To solve wkhtmltopdf issue try this:

Hope this help.

Above link is not working. Please use as follow: http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb

dirtyHandsPHP
on 11/14/15, 5:52 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 2/4/15, 7:51 AM
Seen: 3418 times
Last updated: 3/16/15, 8:10 AM