Skip to Content
Menu
This question has been flagged
2 Replies
3798 Views

Hello,

in the mrp.production form, i added a new action menu

This menu do few things on the data and at the end must print the production order (like if you click on print menu)/

I try with many code but no one works

Here an example :


def print_of(self):
res = self\.env\.ref\('mrp\.action_report_production_order'\)\.report_action\(self\)
\ \ \ \ \ \ \ \ _logger\.critical\("RES="\+str\(res\)\)
\ \ \ \ \ \ \ \ return\ res

and\ the\ content\ of\ the\ log\ :
RES=\{'context':\ \{'lang':\ 'en_GB',\ 'tz':\ 'Europe/Paris',\ 'uid':\ 2,\ 'allowed_company_ids':\ \[1\],\ 'active_id':\ 24871,\ 'active_ids':\ \[24871\],\ 'active_model':\ 'mrp\.production',\ 'mail_notify_force_send':\ False\},\ 'data':\ None,\ 'type':\ 'ir.actions.report', 'report_name': 'mrp.report_mrporder', 'report_type': 'qweb-pdf', 'report_file': 'mrp.report.mrp_production_templates', 'name': 'Production Order'}

It seems that RES is ok but nothing is printed/generated!!!

Do you know where is my error or if there is an other way to do that ?

Avatar
Discard
Author Best Answer

Hi,

There is no problem with the report.

It is the standard Odoo report for a production order.

It works well when i click on the menu print and production order

If i add a button which call my method with the same code, it works too

But it doesn't works when i call my method with my new action menu !?

Avatar
Discard
Best Answer

Hi,

One potential reason why nothing is being printed/generated could be due to a misconfiguration or issue with the report template itself. You may want to check the configuration of the report and verify that it is correctly set up to generate a PDF output.

refer the blog for details on how to create a pdf report in odoo 15
https://www.cybrosys.com/blog/how-to-create-a-pdf-report-in-odoo-15


also refer the youtube link:


https://www.youtube.com/watch?v=q7xRyMOjn-8

Regards

Avatar
Discard