✨(backend) add final_reference field to Invoice model#1333
Open
jonathanreveille wants to merge 1 commit into
Open
✨(backend) add final_reference field to Invoice model#1333jonathanreveille wants to merge 1 commit into
final_reference field to Invoice model#1333jonathanreveille wants to merge 1 commit into
Conversation
ad6b84d to
2f0de28
Compare
There was a problem hiding this comment.
Pull request overview
Adds support for generating and storing a “final invoice reference” on Invoice, intended for uniquely identifying finalized invoices per organization.
Changes:
- Add nullable unique
final_referencefield toInvoice(with a migration). - Add eligibility logic (
can_generate_final_reference) and reference generation/update methods onInvoice. - Add tests covering final reference generation/uniqueness and eligibility behavior; document change in changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
src/backend/joanie/payment/models.py |
Adds final_reference field and generation/eligibility logic on Invoice. |
src/backend/joanie/payment/migrations/0013_invoice_final_reference.py |
Creates DB column for final_reference. |
src/backend/joanie/tests/payment/test_models_invoice.py |
Adds tests for final reference uniqueness and eligibility rules. |
CHANGELOG.md |
Notes the addition of final_reference on invoices. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Invoice modelfinal_reference field to Invoice model
2f0de28 to
c638694
Compare
kernicPanel
approved these changes
Apr 28, 2026
c638694 to
0e7364f
Compare
0e7364f to
7907e6d
Compare
The final reference field will be used when we generate on demand a final invoice. This may happen when orders are completed and all their installments are paid. This means the balance should be at 0. The final reference will be unique per organization. We also allow to generate the final invoice when a batch order uses the card payment.
7907e6d to
6397bbc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
The final reference field will be used when we generate on demand a final invoice. This may happen when orders are completed and all their installments are paid. This means the balance should be at 0. The final reference will be unique per organization. We also allow to generate the final invoice when a batch order uses the card payment.
🥚 Note : Not to be merged yet in main. This branch is the first PR for the implementation of this issue #1247
Proposal
final_referenceinInvoicemodel