Odoo Help


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.


print button report in form view

layal abishalhla
on 4/25/14, 7:10 AM 2,507 views

i need to add a report to the print button inside form view instead of the one in header .. any help

On 4/25/14, 10:18 AM

Hi Layal,

You can add a button in the form view and associate a method in the same object. Then the method should return something that triggers the report.

Example of printing a webkit report:

   def print_check(self, cr, uid, ids, context=None):
        if not ids:
            return  {}

        return {
            'type': 'ir.actions.report.xml', 
            'datas': {
                    'id': ids and ids[0] or False,
                    'ids': ids and ids or [],
                    'report_type': 'webkit'
            'nodestroy': True

Add the button like this in the xml file of the view,

<button name="print_check"  string="Print check" type="object" icon="gtk-execute"/>

Please note that the return style will vary based on the type of report you want to print. Because we have reports like webkit report, aerro report, rml report and jasper report


Thank you Vivekrajan ,its on the way to work ! but my report is of rml type .. i wrote 'report_type': 'rml' as u mentioned but i got "openerp warning : unknown report type :rml"..please may u guide me please .

layal abishalhla
on 4/28/14, 8:35 AM

There is no need to write key of 'report_type'.

Ankit H Gandhi(AHG)
on 11/10/15, 3:22 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

0 follower(s)


Asked: 4/25/14, 7:10 AM
Seen: 2507 times
Last updated: 11/9/15, 5:26 AM