Add mandatory PATCH_PDFWRITER.md documentation

Complete mandatory documentation for PyPDF2 compatibility.
This package benefits from oca-ocb-base compatibility layer.

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2025-09-02 19:13:50 +02:00
parent 1395ffc223
commit 89a37cad97

View file

@ -0,0 +1,88 @@
# PyPDF2 Compatibility Patch - Account (OCB)
## Overview
This package benefits from the PyPDF2 compatibility fixes implemented in the `oca-ocb-base` package. The account module contains test files that use PyPDF2 classes, which are automatically compatible through the main compatibility layer.
## Problem
In PyPDF2 3.0.0, several classes and methods were deprecated and removed:
- `PdfFileWriter``PdfWriter`
- `PdfFileReader``PdfReader`
- Various method names changed (e.g., `addPage()``add_page()`)
## Affected Functionality
The account module has:
- Test files that directly use `PdfFileWriter` and `PdfFileReader`
- PDF processing in test scenarios
- Account report PDF generation testing
## Solution
**This package requires NO direct patches** because:
1. Test files use PyPDF2 classes that are handled by the global compatibility layer
2. Main account functionality uses `OdooPdfFileWriter`/`OdooPdfFileReader` from oca-ocb-base
3. The compatibility layer in `oca-ocb-base` automatically handles all PyPDF2 version differences
## Files Using PyPDF2
### `account/tests/test_ir_actions_report.py`
- Direct PyPDF2 imports: `from PyPDF2 import PdfFileReader, PdfFileWriter`
- Test PDF creation and manipulation
- Automatically compatible through oca-ocb-base patches
## Implementation Details
**No code changes needed** in this package. Compatibility is achieved through:
1. **Global compatibility**: PyPDF2 classes are monkey-patched by oca-ocb-base
2. **Automatic inheritance**: All PyPDF2 usage automatically uses compatibility wrappers
3. **Test compatibility**: Test files work seamlessly with both PyPDF2 versions
## Testing
The compatibility has been verified with:
- PyPDF2 3.0.0+ (new API)
- PyPDF2 2.x (old API)
- Account report generation
- PDF test scenarios
- Account-specific PDF workflows
## 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-base` package on `pdfwrite` branch
- The main PyPDF2 compatibility layer must be active
## 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:
- Account report generation
- PDF testing scenarios
- Invoice PDF processing
## Installation
1. Ensure `oca-ocb-base` is using the `pdfwrite` branch
2. Use this package's `pdfwrite` branch (for documentation compliance)
3. No additional installation steps required
## Future Considerations
- Monitor oca-ocb-base compatibility updates
- Test account workflows with future PyPDF2 versions
- Consider updating test files to use newer PyPDF2 patterns