This question has been flagged
2 Replies
3777 Views

I'm currently developing a button that can print a label for order line, and I'm using the function print_quotation that I've rename print_label for consistency. But I'm confronted by an error that's tell this:

File "/home/odoo/src/user/hubi/models/inherited_sale_order.py", line 117, in print_label
    return self.env.ref('hubi.action_hubi_packing_preparation').report_action(self)
AttributeError: 'ir.actions.act_window' object has no attribute 'report_action'

I've tried another solution for the line:

return self.env.ref('hubi.action_hubi_packing_preparation').report_action(self)

That is:

return {'type': 'ir.actions.report','report_name': 'report_saleorder_hubi_document','report_type':"qweb-pdf"}


But for this line I've got an error that display a KeyError : False


Avatar
Discard
Best Answer

Hello

you have to pass the report id which is you create using <report>.

for eg. <report id="report_orderline_label">

so in your code you have to use like:

return self.env.ref('modulename.report_orderline_label').report_action(self)

Avatar
Discard
Author Best Answer

On my view I have a tree. Do I create <report> inside the <tree> or in the <field> before the <tree> ?

Avatar
Discard

see the example of sales order's quotation report.

Author

Okay thanks

Author

I've search for the example but I can't find it. So I still don't know where to find the location of <report>