Skip to content

[18.0][FIX] report_pdf_form: print number fields equal to 0 - #1228

Open
parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-report_pdf_form-zero
Open

parabol123654 wants to merge 1 commit into
OCA:18.0from
parabol123654:18.0-fix-report_pdf_form-zero

Conversation

@parabol123654

Copy link
Copy Markdown

Bug. _get_pdf_value_from_path is a copy of the value formatter of sale_pdf_quote_builder. The copy predates odoo/odoo@8b37bbe17 ("[FIX] sale_pdf_quote_builder: show zero values in quotation docs", 2025-08-11). Its elif not value_: formatted_value_ = "" also catches integer and float fields equal to 0. A PDF form field mapped to such a field (a quantity, a count, a percentage) is left empty instead of showing 0.

Fix. Same condition as core: elif not value_ and field_type_ not in {"integer", "float"}.

Test. test_fill_pdf_form_zero_number maps an integer field equal to 0 and reads the filled PDF. Without the fix it fails with '' != '0'. All 4 tests pass with the fix.

The value formatter is a copy of the one of sale_pdf_quote_builder taken
before odoo/odoo@8b37bbe17, so integer and float fields equal to 0 were
left empty in the filled PDF form.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @grindtildeath,
some modules you are maintaining are being modified, check this out!

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 this pull request may close these issues.

2 participants