T3284 - remove recurring invoicer object#2110
Conversation
Remove menu item, ACL row, PO translations, and code that passed the invoicer object through _generate_gifts and generate_gift_wizard. The invoicer parameter is no longer needed now that recurring.invoicer is removed from compassion-accounting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…wizard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request simplifies the gift generation process by removing the recurring.invoicer model and its associated parameters, views, security rules, and translations across the codebase. Feedback on these changes highlights two main improvements: first, the overridden _generate_invoices method in contract_group.py should return the result of the super() call to prevent returning None implicitly; second, the final log message in contracts.py should use gift_type.name instead of gift_type to avoid printing the raw Odoo recordset representation.
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.
| def _generate_invoices(self): | ||
| # Exclude gifts from regular generation | ||
| invoicer = super( | ||
| super( | ||
| ContractGroup, self.with_context(open_invoices_sponsorship_only=True) | ||
| )._generate_invoices(invoicer_id) | ||
| )._generate_invoices() | ||
| contracts = self.active_contract_ids | ||
| if contracts: | ||
| contracts._generate_gifts( | ||
| invoicer, self.env.ref("sponsorship_compassion.gift_type_birthday") | ||
| self.env.ref("sponsorship_compassion.gift_type_birthday") | ||
| ) | ||
| contracts._generate_gifts( | ||
| invoicer, self.env.ref("sponsorship_compassion.gift_type_christmas") | ||
| self.env.ref("sponsorship_compassion.gift_type_christmas") | ||
| ) |
There was a problem hiding this comment.
The _generate_invoices method overrides the parent method but does not return its result. If other modules or callers expect a return value (such as the generated invoices or a boolean), this implicit None return could cause issues. It is safer to capture and return the result of the super() call.
| def _generate_invoices(self): | |
| # Exclude gifts from regular generation | |
| invoicer = super( | |
| super( | |
| ContractGroup, self.with_context(open_invoices_sponsorship_only=True) | |
| )._generate_invoices(invoicer_id) | |
| )._generate_invoices() | |
| contracts = self.active_contract_ids | |
| if contracts: | |
| contracts._generate_gifts( | |
| invoicer, self.env.ref("sponsorship_compassion.gift_type_birthday") | |
| self.env.ref("sponsorship_compassion.gift_type_birthday") | |
| ) | |
| contracts._generate_gifts( | |
| invoicer, self.env.ref("sponsorship_compassion.gift_type_christmas") | |
| self.env.ref("sponsorship_compassion.gift_type_christmas") | |
| ) | |
| def _generate_invoices(self): | |
| # Exclude gifts from regular generation | |
| res = super( | |
| ContractGroup, self.with_context(open_invoices_sponsorship_only=True) | |
| )._generate_invoices() | |
| contracts = self.active_contract_ids | |
| if contracts: | |
| contracts._generate_gifts( | |
| self.env.ref("sponsorship_compassion.gift_type_birthday") | |
| ) | |
| contracts._generate_gifts( | |
| self.env.ref("sponsorship_compassion.gift_type_christmas") | |
| ) | |
| return res |
| gift_wizard.generate_invoice(due_date=due_dates[contract]) | ||
| count += 1 | ||
|
|
||
| logger.debug(f"Automatic {gift_type} Generation Finished !!") |
There was a problem hiding this comment.
The log message uses {gift_type} directly, which will print the Odoo recordset representation (e.g., sponsorship.gift.type(1,)) instead of its name. Use {gift_type.name} to be consistent with the start log message on line 1044.
| logger.debug(f"Automatic {gift_type} Generation Finished !!") | |
| logger.debug(f"Automatic {gift_type.name} Generation Finished !!") |
- Return super() result in _generate_invoices override - Use gift_type.name in log messages instead of recordset repr
The invoice generation code is complex. We historically use a recurring.invoicer model that keeps the history of generated invoices but this has no real benefit to our users and can be safely removed. It will also simplify the code and the database inprint.
See other PR related to it
Module 1 — recurring_contract (compassion-accounting)
The invoicer wizard and its menu were replaced by a server action. Verification:
Module 2 — sponsorship_compassion (compassion-modules)
The invoicer was removed from _generate_invoices and _generate_gifts. Test from a Sponsorships → Sponsorships (S, SC, or SWP contract):
Contract Group form → "Generate invoices" button: invoices generate correctly AND birthday/Christmas gift invoices are still generated alongside regular invoices
Module 3 — sponsorship_switzerland (compassion-switzerland)