Skip to Content
Menu
This question has been flagged
8 Replies
9159 Views

Hi,

In the accounting app under the customers and in the invoice section, i want to print invoices but the challenge is that when i click on print, it directly downloads the report(PDF) but i want to show the preview first and then download if needed. I know this can be achieved by changing the report type to html from pdf in UI but i want to make code level changes to achieve this and I tried changing the report type to qweb-html from qweb-pdf  in the report_invoice.xml file but it didn't have any effect and now i'm stuck and confused what to do and where to start. Any guidance or help is  appreciated.

Thank you!

Avatar
Discard
Hi,
My karma wont allow commenting but yeah I've tried changing it to qweb-html from qweb-pdf and also upgraded the appropriate app but no luck. The reports are still in pdf and didn't get changed to html

Cheers,
Sameer Ahmad.


On Wednesday, 27 February, 2019, 1:02:27 pm IST, Cybrosys Techno Solutions Pvt.Ltd <odoo@cybrosys.com> wrote:


A new question How to change the report type from pdf to html in code on Help has been posted. Click here to access the question :

See question


Sent by Odoo S.A. using Odoo.

Can you check in a fresh database and see. Might be some custom code, creates the issue

Author

Hi Cybrosys,

As I'm building a custom app, I've tried the solution given by Mitul and it worked just fine :) but i'm still confused as to why your approach and very similar to your approach was my approach didn't work

Nice to hear that you got a solution, so you have tried in the custom code, not inside the default code? we just thought you have edited the core and checked. Anyway, you have got a solution. :)

Author

I firstly tried in custom code then when it didn't work i went back and tried in base code to verify whether my approach was right or not. Then when the base code version also didn't give out any result i thought my approach was wrong and approached the forums.

I have just started learning odoo and still at the very beginning stages and i'm glad to see your prompt answers whenever i post a question in the forum. Please keep up this good work and guide novices like us :) A million thanks from newbie's like me

Best Answer

hello 

try like below code into your module for changing the report type .

<record id="account.account_invoices" model="ir.actions.report">
        <field name="report_type" eval="'qweb-html'"/>
    </record>
Avatar
Discard
Best Answer

Hi,

What you have done is the right way, to change the PDF to HTML as you have told you can do it either from the front end or from the backend. While doing it from the backend what we have to do is to change the qweb-pdf to qweb-html


Make sure that you have upgraded the correct module. In the case of accounting report upgrade the module with name Invoicing(technical name account)

After upgrading the module after the changes in the code,


Type is changed to the HTML. In your case check the report tag is not rewritten in other places and the file contains have no noupdate="1"

Thanks


Avatar
Discard
Best Answer

good community (Y)

Avatar
Discard
Related Posts Replies Views Activity
1
Sep 24
356
2
Apr 24
515
1
Dec 23
539
0
Mar 22
2
2
Jun 20
4157