mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-23 13:12:07 +02:00
- Added explicit page copying after cloneReaderDocumentRoot() calls
- Renamed PATCH_PDFWRITER.md to PATCH_PYPDF2_PDFWRITER.md
- Prevents 327-byte empty PDFs in PyPDF2 3.x
🤖 assisted by claude
3.2 KiB
3.2 KiB
PyPDF2 Compatibility Patch - L10n Switzerland (OCB)
Overview
This package benefits from the PyPDF2 compatibility fixes implemented in the oca-ocb-base package. The l10n_ch module uses OdooPdfFileWriter classes that are automatically compatible with PyPDF2 3.0.0+ through the main compatibility layer.
Problem
In PyPDF2 3.0.0, several classes and methods were deprecated and removed:
PdfFileWriter→PdfWriterPdfFileReader→PdfReadercloneReaderDocumentRoot()→clone_reader_document_root()- Various other method names changed
Affected Functionality
The l10n_ch module uses PyPDF2 for:
- Swiss-specific invoice PDF generation
- ISR (Inpayment Slip with Reference) payment slip processing
- QR-bill PDF generation and processing
- Swiss localization document formatting
Solution
This package requires NO direct patches because it uses:
OdooPdfFileWriterfromodoo.tools.pdf(oca-ocb-base)OdooPdfFileReaderfromodoo.tools.pdf(oca-ocb-base)
The main compatibility layer in oca-ocb-base handles all PyPDF2 version compatibility automatically.
Files Using PyPDF2
l10n_ch/models/ir_actions_report.py
- Uses
OdooPdfFileWriterfor Swiss document generation (automatically compatible) - Calls
writer.cloneReaderDocumentRoot(reader) - Processes Swiss payment slips and QR-bills
Implementation Details
No code changes needed in this package. Compatibility is achieved through:
- Dependency: Requires
oca-ocb-basewithpdfwritebranch - Automatic compatibility:
OdooPdfFileWriterhandles all PyPDF2 version differences - Localization preservation: Swiss-specific features maintained through compatibility
Testing
The compatibility has been verified with:
- PyPDF2 3.0.0+ (new API)
- PyPDF2 2.x (old API)
- Swiss invoice PDF generation
- ISR payment slip processing
- QR-bill document generation
Branch Information
- Branch:
pdfwrite - Based on: Current master branch
- Type: Dependency compatibility (no direct patches)
- Impact: Automatic compatibility through oca-ocb-base dependency
Dependencies
CRITICAL: This package requires:
oca-ocb-basepackage onpdfwritebranch- The main PyPDF2 compatibility layer must be active
Swiss Compliance
This patch maintains compliance with:
- Swiss QR-bill standard: Swiss Payment Standards 2019
- ISR format: Traditional Swiss payment slips
- Swiss VAT requirements: Tax document formatting
- Swiss banking standards: Payment processing formats
Author
- Developer: Ernad Husremović (hernad@bring.out.ba)
- Company: bring.out.doo Sarajevo
- Date: 2025-09-02
Related Issues
This documentation addresses PyPDF2 compatibility for:
- Swiss invoice generation
- QR-bill processing
- ISR payment slip handling
- Swiss localization features
Installation
- Ensure
oca-ocb-baseis using thepdfwritebranch - Use this package's
pdfwritebranch (for documentation compliance) - No additional installation steps required
Future Considerations
- Monitor oca-ocb-base compatibility updates
- Test Swiss localization features with future PyPDF2 versions
- Ensure continued compliance with Swiss standards