[FIX]stock_voucher_ux:manage when report is doc#768
[FIX]stock_voucher_ux:manage when report is doc#768jcadhoc wants to merge 1 commit intoingadhoc:18.0from
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes stock voucher UX functionality to handle non-PDF report formats (specifically .doc files) in addition to PDFs. The change addresses an issue where the system was failing when reports were generated as documents other than PDFs.
Key changes:
- Added PDF format detection before attempting to parse files as PDFs
- Implemented fallback behavior for non-PDF files with default single page handling
- Added exception handling to prevent crashes when PDF parsing fails
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
stock_voucher_ux/controllers/main.py
Outdated
| @@ -1,3 +1,6 @@ | |||
| # Copyright 2017 ACSONE SA/NV | |||
| git# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian | |||
There was a problem hiding this comment.
There's a typo in the copyright comment. 'git#' should be '#'.
| git# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian | |
| # Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian |
| except Exception: | ||
| # If PDF reading fails, fallback to 1 page | ||
| number_pages = 1 |
There was a problem hiding this comment.
Catching bare Exception is too broad and can mask unexpected errors. Consider catching specific exceptions like PdfReadError or IOError that are expected during PDF processing.
| except Exception: | ||
| # If PDF reading fails, fallback to 1 page | ||
| number_pages = 1 |
There was a problem hiding this comment.
Catching bare Exception is too broad and can mask unexpected errors. Consider catching specific exceptions like PdfReadError or IOError that are expected during PDF processing.
d510329 to
a2d4057
Compare
a2d4057 to
876b071
Compare

No description provided.