Skip to content

Conversation

@jcadhoc
Copy link
Contributor

@jcadhoc jcadhoc commented Sep 17, 2025

No description provided.

Copilot AI review requested due to automatic review settings September 17, 2025 18:38
@roboadhoc
Copy link
Collaborator

Pull request status dashboard

Copy link

Copilot AI left a 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.

@@ -1,3 +1,6 @@
# Copyright 2017 ACSONE SA/NV
git# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian
Copy link

Copilot AI Sep 17, 2025

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 '#'.

Suggested change
git# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian
# Copyright 2018 - Brain-tec AG - Carlos Jesus Cebrian

Copilot uses AI. Check for mistakes.
Comment on lines 80 to 93
except Exception:
# If PDF reading fails, fallback to 1 page
number_pages = 1
Copy link

Copilot AI Sep 17, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +128
except Exception:
# If PDF reading fails, fallback to 1 page
number_pages = 1
Copy link

Copilot AI Sep 17, 2025

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.

Copilot uses AI. Check for mistakes.
@jcadhoc jcadhoc force-pushed the 18.0-t-57083-jc branch 3 times, most recently from d510329 to a2d4057 Compare September 17, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants