Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
10715 มุมมอง

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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', 
            'report_name':'account.check.print',
            'datas': {
                    'model':'account.voucher',
                    '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

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

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 .

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
How to add a "print" button in form view แก้ไขแล้ว
3
ก.ค. 22
11506
7
มี.ค. 22
41733
how to print a custom report in openerp แก้ไขแล้ว
1
ต.ค. 22
5673
6
เม.ย. 20
11270
2
มี.ค. 15
7578