Print report on print button in odoo10

筅森魡賤 提交于 2021-02-11 15:40:26

问题


Hi I am having a problem in printing the report. I have coded the report format in html and then made its module and attached it with the relevant model. and upload it on my online server

First I was receiving this error : Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display

I have solved this problem using this following link https://gist.github.com/tejastank/45b6eba13fb38e24110218e3ce50129b

Its still not printing but keeps on creating child of the report in rec_name area, please see the attachment and showing this error on the side

Questions:

1).How I can print the report directly from the print button without getting these errors.

One of our client give us access of there ERP for some changes, I have seen there reports when we click on print button on there ERP it downloads the PDF version pf the report and then we print it. so

2). How can we download the report in PDF formate.

I am using odoo10 not odoo8. Thanks in advance


回答1:


Try this Solution :

Downlaod this -https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

and then follow the step : (IF THE ABOUT WKHTMLTOPDF IS NOT INSTALL THAN AND THAN 1ST STEP HAVE TO DO IT) 1) sudo dpkg -i http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

2) sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin 3) sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin

may be it will help you.




回答2:


Try this solution:

  1. Download wkhtmltopdf https://downloads.wkhtmltopdf.org/0.12/0.12.1/
  2. Install *.deb file using this command, sudo dpkg -i file_name.deb
  3. If any error occur during installation execute, sudo apt-get install -f
  4. sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
  5. Restart odoo server and try.

Hope it will resolve your problem.




回答3:


Try with this one might it ill help you..

sudo pip install Wkhtmltopdf

Hope this will solve your problem.



来源:https://stackoverflow.com/questions/45564362/print-report-on-print-button-in-odoo10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!