-
Notifications
You must be signed in to change notification settings - Fork 71
[FIX]stock_voucher_ux:manage when report is doc #768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 18.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 | |||
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Copilot
AI
Sep 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.