Tecnativa / doodba

Base image for making the creation of customized Odoo environments a piece of cake
Apache License 2.0
423 stars 302 forks source link

Excesive top margin downloading PDF documents #589

Closed manuel-florido closed 9 months ago

manuel-florido commented 9 months ago

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 commented 9 months ago

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

THX

ap-wtioit commented 9 months ago

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 https://github.com/Tecnativa/doodba/pull/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
josep-tecnativa commented 9 months ago

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:

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 commented 9 months ago

@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 commented 9 months ago

Hello,

I just tested it and it works properly.

Thank you all!