Skip to content

[T3284] Remove recurring.invoicer object - #2110

Draft
danpa32 wants to merge 5 commits into
18.0from
T3284-Remove-recurring-invoicer-object
Draft

danpa32 wants to merge 5 commits into
18.0from
T3284-Remove-recurring-invoicer-object

Conversation

@danpa32

@danpa32 danpa32 commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

[STAGING REQUIRED] Must be tested on Stage prior to production merge.

T3284 – Remove the recurring.invoicer object

The recurring.invoicer model kept a history of generated invoice batches ("Generated invoices") that has no use for the users. This PR removes it and simplifies invoice generation.

Related PRs (merge together, in this order):

  1. [T3284] Remove recurring.invoicer object compassion-accounting#279
  2. [T3284] Remove recurring.invoicer object #2110
  3. [T3284] Remove recurring.invoicer object compassion-switzerland#1766

Changes

recurring_contract (compassion-accounting)

  • recurring.invoicer and recurring.invoicer.wizard removed, along with the "Generated invoices" menu and the link from invoices to their batch.
  • "Launch invoices generation" is now a server action that calls generate_from_cron() directly (no confirmation wizard).
  • Pre-migration: the existing invoicing crons are kept. The daily cron gets the xmlid invoice_generation_cron (noupdate). The friday cron exists only in the database and is kept as is. Their server actions move to recurring.contract.group. Active state, next call and interval stay unchanged.
  • Post-migration: drops account_move.recurring_invoicer_id, the recurring_invoicer and recurring_invoicer_wizard tables, and saved filters whose domain uses recurring_invoicer_id.
  • Translations: obsolete entries removed.

sponsorship_compassion (compassion-modules)

  • The invoicer is no longer passed through _generate_invoices / _generate_gifts. Menu entry removed from the translations.

sponsorship_switzerland (compassion-switzerland)

  • The _build_invoice_gen_data override no longer gets the invoicer. gift_wizard is passed as a keyword.

Tested locally (stage18_neutralized, 2026-11-19)

  • Upgrade of recurring_contract, sponsorship_compassion, gift_compassion and sponsorship_switzerland: OK.
  • Both invoicing crons kept with the same state, next call and interval, now on recurring.contract.group. Tables, column, saved filter and menus removed.
  • "Generate invoices" on contract groups creates the invoices. "Launch invoices generation" queues the generation jobs.
  • Automated tests: no failure linked to this change. The remaining errors come from the neutralized test database (missing demo data, rights).

How to test on Stage

  • Accounting → Contracts → Launch invoices generation: runs without error and queues the generation jobs.
  • Contract Group form → "Generate invoices": invoices are generated, birthday/Christmas gift invoices still generated, Swiss data (payment reference, bank details) correct.
  • The "Generated invoices" menu is gone.
  • Scheduled actions: the daily and friday invoice generation crons are still there with their previous state.

At deploy

  • Check that no _generate_invoices queue jobs are pending or failed (they would fail with the new signature).
  • Check whether the daily and friday crons are active in production. They keep that state after the upgrade.

🤖 Generated with Claude Code

danpa32 and others added 3 commits July 1, 2026 13:47
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 <[email protected]>
@danpa32
danpa32 requested review from NoeBerdoz and ecino July 2, 2026 10:58

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +36 to 48
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")
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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.

Suggested change
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

@greptile-apps

greptile-apps Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The code appears safe to merge with the required companion PRs and deployment checks.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Generate group invoices] --> B[Generate regular invoices]
  B --> C[Find active contracts]
  C --> D[Generate birthday gifts]
  C --> E[Generate Christmas gifts]
  D --> F[Gift wizard]
  E --> F
  F --> G[Create and post gift invoices]
Loading

Reviews (3) · Last reviewed commit: "[T3284] Merge origin/18.0 into T3284-Rem..." · Reviewed by Greptile

- Return super() result in _generate_invoices override
- Use gift_type.name in log messages instead of recordset repr
@ecino
ecino marked this pull request as draft October 29, 2026 05:46
@danpa32 danpa32 changed the title T3284 - remove recurring invoicer object [T3284] Remove recurring.invoicer object Nov 23, 2026
@danpa32

danpa32 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants