Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Close wizard after print report

Subscribe

Get notified when there's activity on this post

This question has been flagged
wizardreportodooV8
3 Replies
13548 Views
Avatar
ASP

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 

1
Avatar
Discard
Michael Goetz-Schneider

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 ?

Anabela Damas

Did you find the solution?

Avatar
Best Answer

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

1
Avatar
Discard
Deepa Venkatesh

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

Deepa Venkatesh

However this fails to load the Qweb format.

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

Avatar
Pouya Malekinejad
Best Answer

in your report action add this:
{
'close_on_report_download':True
}

Example:

def action_confirm(self):   
    vouchers=self.create_vouchers()
r\eport_action=self.env.ref('your_module.your_report_action').report_action(self.ids_to_print)
    report_action['close_on_report_download']=True
    return report_action

and in your form view :
<footer>
<button string="Confirm" class="btn-primary" type="object" name="action_confirm"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>


0
Avatar
Discard
Aïmane

Works in odoo 12, thank you very much.
Where have you found that, is it in a documentation ?

Pouya Malekinejad

No it is not in documentation nor it is used anywhere in Odoo, I needed it and I was looking where to add it and it was already there!

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hello,

In your case consider the following example

report_reference = self.env.ref('your_module_name.your_report_action_id').report_action(self, data=datas, config=False)
report_reference.update({'close_on_report_download': True})
return report_reference

It will close the wizard after downloading the report

Regards

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
Generate Report excel from Custom Wizard in Odoo8 ?
wizard report excel odooV8
Avatar
0
Apr 18
7090
Change PDF report name on wizard
wizard report
Avatar
Avatar
2
Jul 24
4143
Blank report PDF from Wizard Solved
wizard report
Avatar
Avatar
2
Apr 24
3675
External ID not found in the system
wizard report
Avatar
4
Oct 20
6599
how can i add default image to wizard?? Solved
wizard odooV8
Avatar
Avatar
Avatar
Avatar
3
Jun 19
6070
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now