Search code examples
odooodoo-10

How can i print a report from odoo server actions (GUI)


How can I make a server action in the GUI of odoo 10 to print the custom picking report Report id: id=690

(I am trying to make an automated action to print al new confirmed orders)


Solution

  • I just noticed that this module supports odoo 10

    https://apps.odoo.com/apps/modules/15.0/printnode_base/

    This is probably your best bet.

    To get the report from the odoo server: {server}/report/pdf/{report_id}/{object_id} example:

    https://odoo.yourcompany.com/report/pdf/account.report_invoice_with_payments/70
    

    I don't have access to Odoo 10, but for modern Odoos you can generate the report like that:

    pdf_data = self.env.ref('account.report_invoice_with_payments').with_user(SUPERUSER_ID)._render_qweb_pdf([invoice.id])[0]
    

    This pdf_data is pdf data as bytes that can be posted to the server or saved to a file.