Odoo Help

Welcome!

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.

1

Close wizard after print report

By
ASP
on 6/15/15, 10:23 AM 1,320 views

Hi All,

In my project there's a requirement to cut check in batch and print reports in a single click by selecting the list of open supplier invoices. To achieve this I've prepared a wizard and added an option called 'Write check in batch' under 'more' button of the invoice tree view.

 When I select a list of open invoices and choose the above option, a wizard appears for check number entry and it has 2 buttons: 

1. Confirm, 2.Cancel. When user enters the check number and click on confirm it is creating voucher record and validating it as well. Also I'm getting the PDF report instantly as I'm returning a report action at the end of the function.


But my issue is the wizard is not closing and still remains open even after report generation. The Confirm button on the wizard is of type object and I've defined a corresponding method for it where at the end I'm using this:


return self.pool['report'].get_action(cr, uid, [], 'model.report', contect=context) - which generated the PDF.


But my wizard is not closing. Please help me on this. Any help would be appreciated :)


Regards

ASP 

Hi ASP, I see just a typo contect=context, but this may be just copy and paste error. We made a generic print wizard initiated by a button, to be able to send the document to a server printer using base_report_to_printer from a third party named Agile. In Version 7 everything works fine, after printing a preview, i.e. PDF as usual, the wizard closes, in Version 8 it does not. Your project may differ from ours, but it is the same issue. Could you solve your problem meanwhile ?

Michael Goetz-Schneider
on 7/15/15, 11:40 AM

Did you find the solution?

Versão Integral, Anabela Damas
on 6/16/16, 10:53 AM
1
Damien Crier
On 8/26/16, 6:51 AM

Hi !

Maybe late but solution is to remove report_type key of the resulting dict.

Example:

action_dict = self.env['report'].get_action('xml_id_of_report')
del action_dict['report_type']
return action_dict

or instead of using the get_action method, you can return this

return {'type': ir.actions.report.xml', 'report_name':'xml_id_of_report'}

Hope this help

First option worked liked a charm, though second option didn't work for me. Still good solution, earned a point from me :).. ThankQ...

deep
on 11/4/16, 3:13 AM

However this fails to load the Qweb format.

deep
on 11/7/16, 5:29 AM

@deep maybe your Qweb report has an error because I already launch a Qweb-pdf report successfully with this piece of code

Damien Crier
on 11/7/16, 5:33 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

2 follower(s)

Stats

Asked: 6/15/15, 10:23 AM
Seen: 1320 times
Last updated: 8/26/16, 6:51 AM