[T3357] FIX: Child Gift contract invoice generation crash - #2132
Open
danpa32 wants to merge 1 commit into
Open
Conversation
build_inv_line_data() assigned contract_line.sponsorship_id (a Many2one recordset) directly to the invoice line's contract_id instead of its id, causing psycopg2.ProgrammingError: can't adapt type 'recurring.contract' whenever a Child Gift contract's invoices were generated.
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.
Original report
Test procedure: create a Child Gift contract for a sponsor with an active
LSV/DD sponsorship, link a sponsorship gift product to the existing
sponsorship, save/validate, then click "Generate invoices".
Expected: correct invoices generated at the right frequency.
Actual: clicking "Generate invoices" returned an RPC_ERROR:
Root cause
sponsorship_compassion/models/contract_group.py,build_inv_line_data():sponsorship_id(recurring_contract_line.py) is aMany2onetorecurring.contract— socontract_line.sponsorship_idis a recordset, notan id. Every other assignment in this method (and the base
recurring_contract/contract_group.pyversion) uses.id. When building theinvoice line for a Child Gift contract,
account.move.line.contract_idwasset to that recordset directly;
How to test manually
See Quality test