[19.0][MIG] report_pdf_form#1107
Conversation
The use of mapped() can raise an AttributeError if any field in the dot-separated path does not exist (e.g., a typo in the configuration). This would crash the report generation. It's better to handle this potential error gracefully, for instance by catching the exception and returning an empty recordset, which will result in an empty value for the field.
Changes made: - Properly handle many2one field formatting to prevent TypeError
Added SQL constraint to ensure that each ir.actions.report can only be associated with one PDF form template, preventing unpredictable behavior when multiple templates share the same report_name.
…de fields Added ace code editor widget with Python syntax highlighting to: - odoo_field_value field in field mapping - code field in variables
- Demo data for testing the module with sample configurations - Documentation on how to use demo data - Information about tools to create PDF form fields (docfly.com, LibreOffice Draw, Scribus)
…lity This commit adds several enhancements to the report_pdf_form module: - Add validation for dotted field paths with visual indicators - Add manual validation button for field mappings - Add PDF preview functionality with sample data - Improve demo data with deeper dotted path examples - Enhance configuration documentation with PDF upload clarification Co-authored-by: Akim Juillerat <akim.juillerat@camptocamp.com>
This commit fixes translation formatting issues by using .format() method instead of % formatting for all translation strings to comply with Odoo's translation best practices.
be36b59 to
26879bd
Compare
| .. IMPORTANT:: | ||
| This is an alpha version, the data model and design can change at any time without warning. | ||
| Only for development or testing purpose, do not use in production. | ||
| `More details on development status <https://odoo-community.org/page/development-status>`_ |
There was a problem hiding this comment.
I think so.. This is the first migration. And have been adding some features.
Ci is 🔴 😿
Maybe later promote it to beta? Will check the requirements..
There was a problem hiding this comment.
Promoted to Beta now. I also added test coverage for the features that were bundled in this migration (field-type formatting, dotted-path validation + constraint, the unique report_id guard, code variables and the PDF preview), and fixed a bug in the write() uniqueness check found while doing so. CI should be green now.
631c757 to
f8b145c
Compare
fix(report_pdf_form): move binding to PDF form record This commit moves the binding configuration from the ir.actions.report record to the actual report.pdf.form record, which is the proper location for the binding since the module inherits from ir.actions.report using _inherits. This ensures the demo report appears in the contact's print menu.
f8b145c to
90ccc0b
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
The previous write() override searched for records matching the new report_id and only raised when more than one already existed. Because the record being written had not been updated yet, assigning an already used report_id to a second form passed the check, allowing duplicates. Check after the write for any *other* form sharing the report_id.
Cover the behaviour added during the migration: - value formatting per field type in _get_pdf_value_from_path (boolean, many2one, many2many, one2many, selection, date, datetime, fallback and empty values) and the invalid-path fallback; - python code evaluation using reusable variables; - dotted-path validation, validation message, manual validation action and the dotted-path constraint; - unique report_id guard on create and write, the report_id onchange and the PDF preview action.
The module is feature complete and covered by tests.
Standard migration.
"Improvements" deliberatly made in seperate commits for cherry-picking