Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excesive top margin downloading PDF documents #589

Closed
manuel-florido opened this issue Nov 23, 2023 · 5 comments · Fixed by #590
Closed

Excesive top margin downloading PDF documents #589

manuel-florido opened this issue Nov 23, 2023 · 5 comments · Fixed by #590
Labels

Comments

@manuel-florido
Copy link
Contributor

Describe the bug

When you download a PDF (e.g. Preview or Invoice) for the first time it appears correctly, but when you download it again, the top margin increases.

It happens using doodba-copier-template and my private projects.

Paper format is not modified, all by default.

The parameter "report.url" is correctly configurated.
image

First download:
image

Second download:
image

To Reproduce

I am using doodba-copier-template, choosing Odoo version "16.0" and Postgresql version '13'.

Here is my copier-answers,yml:

# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v5.3.5
_src_path: gh:Tecnativa/doodba-copier-template
backup_dst: ''
cidr_whitelist: null
domains_prod: {}
domains_test: {}
gitlab_url: ''
odoo_dbfilter: ^prod
odoo_initial_lang: es_ES
odoo_listdb: true
odoo_oci_image: ''
odoo_proxy: traefik
odoo_version: 16.0
paths_without_crawlers:
- /web
- /website/info
postgres_dbname: prod
postgres_exposed: false
postgres_username: odoo
postgres_version: '13'
project_author: Tecnativa
project_license: BSL-1.0
project_name: myproject-odoo
smtp_default_from: ''
smtp_relay_host: '''

Affected versions:
It affects on version 16.0 and 17.0.

Steps to reproduce the behavior:

  1. Command: "copier copy --trust gh:Tecnativa/doodba-copier-template project/folder".
  2. Command: "invoke develop img-build git-aggregate resetdb start".
  3. Activate "sale_management" module.
  4. Go to "General settings" > "Companies" > "Document Layout" > "Configure Document Layout".
  5. Paper format > A4.
  6. Click on "Download PDF Preview".

The first one will be correct, but the second will have an excesive top margin.

Expected behavior
All the downloads like the first one, with a normal top margin.

Additional context
Ubuntu 22.04.
Docker version 24.0.7, build afdd53b.

@HaraldPanten
Copy link

@josep-tecnativa @yajo @ap-wtioit Have you experienced anything like that?

THX

@ap-wtioit
Copy link
Contributor

ap-wtioit commented Nov 24, 2023

hm, i just tested in 16.0 with a fresh database installing account (Invoicing), we have usually no odoo_initial_lang set and use nginx instead of traefik.

Edit:
removed the old bug description (that is a different one, probably on our demo systems)

Yes i can confirm we are seeing the exact same thing with the images after #578

Tested by using a CI backup image from before that merge and the issue disappears when using the bullseye/wkhtmltopdf 0.12.5 image.

Can you check what your output of this is:

docker-compose exec odoo wkhtmltopdf --version
  • working (for me): wkhtmltopdf 0.12.5 (with patched qt)
  • not working (header far too low in document): wkhtmltopdf 0.13.0 (with patched qt)

@josep-tecnativa
Copy link
Contributor

josep-tecnativa commented Nov 24, 2023

I think that the best solution is to use 0.12.6.1 version, that is compatible with bookworm, but i have to test if it works properly. Once is tested i will do a PR in order to solve this issue.
Edit:
Test done.
Once this command is executed:
invoke develop img-build git-aggregate resetdb start
I have installed wkhtmltopdf 0.12.6.1 in the odoo container following this steps:

  • Download locally the package: wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
  • Coping that file inside of container: docker cp wkhtmltox_0.12.6.1-3.bookworm_amd64.deb container_name:/
  • Open container console: docker exec -it --user root testpdf_odoo_1 /bin/bash
  • Going to / path and installing package: cd / and dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
  • Then, from outside we can check the wkhtmltopdf version using: docker-compose exec odoo wkhtmltopdf --version and i get wkhtmltopdf 0.12.6.1 (with patched qt), so it is correctly installed.

After that i have done several tests and it prints properly. So i am going to fix this, using wkhtmltopdf 0.12.6.1

@ap-wtioit
Copy link
Contributor

@josep-tecnativa thanks.

FYI i have tested switching back to 0.12.5 and got that working (as a hotfix directly in doodba):
in odoo/Dockerfile:

ARG ODOO_VERSION
FROM ghcr.io/tecnativa/doodba:${ODOO_VERSION}-onbuild
USER root
ARG WKHTMLTOPDF_VERSION=0.12.5
ARG WKHTMLTOPDF_CHECKSUM='8feeb4d814263688d6e6fe28e03b541be5ca94f39c6e1ef8ff4c88dd8fb9443a'
RUN curl -SLo wkhtmltox.deb https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTMLTOPDF_VERSION}/wkhtmltox_${WKHTMLTOPDF_VERSION}-1.buster_amd64.deb
RUN curl -SLo libssl1.1.deb http://deb.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_amd64.deb
RUN dpkg -i libssl1.1.deb \
    && dpkg -i wkhtmltox.deb \
    && rm ./wkhtmltox.deb \
    && rm ./libssl1.1.deb
USER odoo

This is still a hotfix, but we are now testing and it looks like it fixes the issue.

Will prepare a PR as well but if you get 0.12.6.1 running that's fine as well.

@manuel-florido
Copy link
Contributor Author

manuel-florido commented Nov 24, 2023

Hello,

I just tested it and it works properly.

Thank you all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants