T2860 - FIX invoice loop range and skip cancelled invoices on Odoo 18 - #277
Conversation
danpa32
commented
Jun 24, 2026
- Fix off-by-one in _generate_invoices loop range: use advance_billing_months + month_interval - 1 as upper bound so the correct number of invoices is produced for all billing cycle combinations
- Exclude cancelled invoices from _should_skip_invoice_generation so that a cancelled invoice no longer blocks regeneration for the same period
- Expand readme (DESCRIPTION, USAGE, DEVELOP) with billing cycle docs
There was a problem hiding this comment.
Code Review
This pull request updates the invoice generation loop upper bound to correctly handle monthly and annual billing cycles, excludes cancelled invoices from deduplication, and adds comprehensive documentation. However, a critical issue was identified where the implementation of _should_skip_invoice_generation still uses an exact match on invoice_date, contradicting the newly added documentation and design principles. It is recommended to update the query to use a date range covering the full billing interval.
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.
Confidence Score: 5/5The changes are narrowly scoped to recurring invoice duplicate checks and regeneration behavior. No correctness issues were identified in the reviewed change set, and the implementation aligns with the described invoice-regeneration behavior.
What T-Rex did
|
|
@copilot When |
Fixed in |
…for existing invoices _should_skip_invoice_generation only matched on invoice_date/partner/contract/ product, so a cancelled invoice for a period still blocked regeneration for that period. Add state != cancel to the search domain.
12f6b48 to
03283ea
Compare