Install report_webkit

Install report_webkit report module, webkit library, and wkthtmltopdf.

This module requires the wkthtmltopdf library to render HTML documents as PDF. Version 0.9.9 or later is necessary, and can be found at http://code.google.com/p/wkhtmltopdf/ for Linux, Mac OS X (i386) and Windows (32bits). 

After installing the library on the OpenERP Server machine, you need to set the PATH to the wkthtmltopdf executable file on each Company.

Create Action Reports

Menu Settings > Technical > Action > Reports

Create New

image

Name: the report name
Service Name: <model>.<unique number>
Object: model name
Report Type: webkit

On the Webkit tab:
Header: select one of the available header.

The Webkit Template: the report template in HTML, example:

% for o in objects :
<html>
<head>
<style type="text/css">
${css}
.page {page-break-after: always}
</style>
</head>
<body>
   <div class="page">
      <h1>${o.name}</h1>
      <h2>Attendees:</h2>
      <table border="1" width="100%">
      % for a in o.attendee_ids :
         <tr><td>${a.partner_id.name}</td></tr>
      % endfor
      </table>
   </div>
</body>
</html>
% endfor

 

Create Action Button

Save the Action Report.

Click the button Print > Add Print Buttons

image

This will create an Action Binding record automatically.

New Print button will be shown up in the model form and list view.

image

 

This is just some topic covered in our Technical Training (Unofficial). More information about the training , please contact us:

VITRAINING.COM
Grand Surapati Core Blok C-16
Jl PHH Mustofa  136 Bandung
Telephone : +62 (22) 8724 1394
Fax : +62 (22) 8724 1394
Mobile Phone Number : +62 813 2037 9277
Email: akhmad.daniel[at]gmail.com or info[at]vitraining.com

OpenERP: Webkit Report Settings
Tagged on: