FIX invoice generation mindset - #282
Conversation
ecino
commented
Jul 16, 2026
- The next month should be generated if advance_billing_month is 1.
- The next month should be generated if advance_billing_month is 1.
|
@danpa32 In production we are waiting for the august invoices to be generated. But since your change this doesn't happen anymore. We don't wan't to wait for August for having the invoices. Can you review if this is correct regarding your changes or should we do it differently? |
There was a problem hiding this comment.
Code Review
This pull request modifies the invoice generation range calculation and updates the documentation table in recurring_contract/models/contract_group.py. The review feedback highlights that the new range formula introduces a bug when starting_offset = 1 by exceeding the advance billing limit. It is recommended to cap the upper bound at group.advance_billing_months + 1 and update the documentation table accordingly to maintain consistency.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
The previous formula (starting_offset + advance_billing_months + month_interval) still added starting_offset to the upper bound, which changes the invoice count depending on whether the contract is waiting or active. For a waiting contract with advance_billing_months=3, it generated 4 invoices instead of 3, breaking test_generate_invoice_data_coherency. starting_offset should only control where the range starts (skip the current month for a waiting contract), not where it ends.
|
I have pushed some changes for the rest to make sense. Can you check it out @ecino ? |