YunoHost-Apps / libreerp_ynh

LibreERP package for YunoHost
https://odoo.com
GNU Affero General Public License v3.0
16 stars 19 forks source link

Print to pdf is not nicely rendered #45

Open Thatoo opened 8 months ago

Thatoo commented 8 months ago

Describe the bug

Print to pdf is not nicely rendered, either I click on download or print.

Context

Steps to reproduce

Expected behavior

Get a downloaded or printed invoice similar to what the odoo template disply

Logs

2023-12-14 11:24:35,081 95484 INFO libreerp odoo.modules.registry: At least one model cache has been invalidated, signaling through the database. 
2023-12-14 11:24:35,082 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:35] "POST /web/dataset/call_kw/base.document.layout/create HTTP/1.0" 200 - 194 0.098 0.147
2023-12-14 11:24:35,326 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:35] "POST /web/dataset/call_kw/base.document.layout/read HTTP/1.0" 200 - 57 0.021 0.109
2023-12-14 11:24:35,532 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:35] "POST /web/action/load HTTP/1.0" 200 - 14 0.005 0.006
2023-12-14 11:24:35,548 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:35] "GET /web/image?model=base.document.layout&id=6&field=logo&unique=1702553074000 HTTP/1.0" 200 - 7 0.005 0.005
2023-12-14 11:24:36,297 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:36] "GET /websocket HTTP/1.0" 400 - 2 0.001 0.005
2023-12-14 11:24:36,497 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:36] "GET /websocket HTTP/1.0" 400 - 1 0.001 0.003
2023-12-14 11:24:37,834 95484 WARNING libreerp odoo.addons.base.models.ir_actions_report: wkhtmltopdf: QSslSocket: cannot resolve CRYPTO_num_locks
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num
QSslSocket: cannot resolve sk_pop_free
QSslSocket: cannot resolve sk_value
QSslSocket: cannot resolve SSL_library_init
QSslSocket: cannot resolve SSL_load_error_strings
QSslSocket: cannot resolve SSLv3_client_method
QSslSocket: cannot resolve SSLv23_client_method
QSslSocket: cannot resolve SSLv3_server_method
QSslSocket: cannot resolve SSLv23_server_method
QSslSocket: cannot resolve X509_STORE_CTX_get_chain
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
QSslSocket: cannot resolve SSLeay
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function sk_num
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function SSL_library_init
Exit with code 1 due to network error: UnknownNetworkError
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback

2023-12-14 11:24:37,836 95484 INFO libreerp odoo.addons.base.models.ir_actions_report: The PDF report has been generated for model: res.company, records [6]. 
2023-12-14 11:24:37,843 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:37] "POST /report/download HTTP/1.0" 200 - 94 0.033 2.175
2023-12-14 11:24:38,023 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:24:38] "POST /web/dataset/call_kw/base.document.layout/read HTTP/1.0" 200 - 9 0.004 0.014
2023-12-14 11:25:44,710 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:25:44] "GET /websocket HTTP/1.0" 400 - 1 0.001 0.003
2023-12-14 11:25:44,724 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:25:44] "GET /websocket HTTP/1.0" 400 - 1 0.001 0.002
2023-12-14 11:26:45,644 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:26:45] "GET /websocket HTTP/1.0" 400 - 1 0.001 0.002
2023-12-14 11:26:45,985 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:26:45] "GET /websocket HTTP/1.0" 400 - 1 0.001 0.003
2023-12-14 11:27:47,300 95484 INFO libreerp werkzeug: 89.234.177.94 - - [14/Dec/2023 11:27:47] "GET /websocket HTTP/1.0" 400 - 1 0.000 0.002

image

image

Thatoo commented 8 months ago

I guess everything is about

WARNING libreerp odoo.addons.base.models.ir_actions_report: wkhtmltopdf: QSslSocket: cannot resolve CRYPTO_num_locks

When I look for this error on internet, I found that I should use wkhtmltopdf, at least 0.12.5 version.

Apparently, Yunohost installed

xxx@zzz:~$ wkhtmltopdf --version
wkhtmltopdf 0.12.4 (with patched qt)

Here, https://github.com/amra/DocumentationAsCode/issues/2, they mention also the idea of installing libssl1.0-dev or compat-openssl10-devel.x86_64

[EDIT], Well libssl seems to be installed already :

xxx@zzz:~$ dpkg -l libssl-dev
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom              Version          Architecture Description
+++-================-================-============-================================================
ii  libssl-dev:amd64 1.1.1w-0+deb11u1 amd64        Secure Sockets Layer toolkit - development files

Any idea?

Thatoo commented 8 months ago

Well, I don't get why I see a difference here :

xxx@zzz:~$ dpkg -l wkhtmltopdf
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom            Version      Architecture Description
+++-==============-============-============-===================================================================
ii  wkhtmltopdf    0.12.6-1     amd64        Command line utilities to convert html to pdf or image using WebKit
xxx@zzz:~$ wkhtmltopdf --version
wkhtmltopdf 0.12.4 (with patched qt)
Thatoo commented 8 months ago

I solved the issue. Nothing need to be installed, just a key to add in system settings. You need to activate devloppers tool go to Settings/system settings and add the key report.url with the value http://0.0.0.0:8069

Here is a screenshot

image

Well I still get the same error in the log WARNING libreerp odoo.addons.base.models.ir_actions_report: wkhtmltopdf: QSslSocket: cannot resolve CRYPTO_num_locks but the pdf render well

Thatoo commented 8 months ago

I wonder if it is possible to register that during the install process.