Skip to content

REFACTOR Make queue_job dependencies optional#2105

Merged
ecino merged 4 commits into
18.0from
ecino/queue-job-sh
Jul 2, 2026
Merged

REFACTOR Make queue_job dependencies optional#2105
ecino merged 4 commits into
18.0from
ecino/queue-job-sh

Conversation

@ecino

@ecino ecino commented Jun 25, 2026

Copy link
Copy Markdown
Member
  • NEW module queue_job_sh_safe that will safely use queue_jobs when available and fallback to an alternate mechanism with ir_cron in case the module is not installed.
  • This is useful for Nordic using odoo.sh on which queue jobs are prohibited and not optimal for the infrastructure

gemini-code-assist[bot]

This comment was marked as resolved.

@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Confidence Score: 1/5

The optional queue fallback path is undermined by an upgrade migration that still assumes the real queue-job table exists.

  • The new fallback mechanism is intended to support deployments without the real queue-job module.
  • child_compassion still runs an unconditional delete against the legacy queue-job function table during migration.
  • In the supported no-queue-job setup, that table can be absent, causing the upgrade to fail before the fallback can be used.

child_compassion/migrations/18.0.1.1.1/pre-migration.py

T-Rex T-Rex Logs

What T-Rex did

  • Observed that queue_job was unavailable and no fallback jobs existed before the invocation.
  • A with_delay_sh returned a fallback job id 1, a queue.job.replacement payload for model x.target and method mark_done was created, and the cron-equivalent runner executed it to completion with result ran:[42]:abc.
  • Tested deployments without the real queue_job module/table and confirmed the pre-migration step aborts with sqlite3.OperationalError: no such table: queue_job_function, exit code 1.
  • Tested the migration with the queue_job table present, and confirmed the migration completes, preserving ('edi import',) and deleting ('foo',), exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Comments Outside Diff (1)

  1. General comment

    P0 Optional queue_job_function table is still required by child_compassion pre-migration

    • Bug
      • The child_compassion pre-migration executes delete from queue_job_function where name not like '%edi%' unconditionally. In the newly supported setup where the real queue_job module is not installed and queue_job_optional is used instead, the queue_job_function table is absent, so the migration fails immediately before the optional fallback can help.
    • Cause
      • The migration assumes the legacy queue_job_function table exists even though the PR makes the real queue_job dependency optional.
    • Fix
      • Guard the deletion with a table-existence check or otherwise conditionally execute it only when queue_job_function exists, for example by checking information_schema.tables/Odoo migration utilities before running the DELETE.

    T-Rex Ran code and verified through T-Rex

Reviews (23): Last reviewed commit: "Various improvements" | Re-trigger Greptile

Comment thread queue_job_sh_safe/security/ir.model.access.csv Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 07f6d5f to a0cad46 Compare June 25, 2026 18:40
Comment thread queue_job_sh_safe/security/ir.model.access.csv Outdated
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_optional/models/queue_job_replacement.py
Comment thread partner_communication/__manifest__.py Outdated
Comment thread message_center_compassion/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from a0cad46 to e2d8348 Compare June 25, 2026 19:08
Comment thread queue_job_sh_safe/models/base.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread partner_communication/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from e2d8348 to 51f4a7d Compare June 29, 2026 08:32
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
Comment thread partner_communication/models/ir_actions.py
Comment thread message_center_compassion/__manifest__.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 51f4a7d to bda7e87 Compare June 29, 2026 09:19
Comment thread gift_compassion/models/account_move_line.py Outdated
Comment thread queue_job_optional/models/base.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from bda7e87 to c7688c2 Compare June 29, 2026 09:41
Comment thread queue_job_optional/models/base.py
Comment thread child_compassion/models/child_compassion.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from c7688c2 to 5959cc9 Compare June 29, 2026 09:54
Comment thread partner_communication_reminder/models/recurring_contract.py
Comment thread partner_communication/models/communication_job.py
Comment thread queue_job_sh_safe/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 5959cc9 to 9b2f73a Compare June 29, 2026 10:15
Comment thread queue_job_sh_safe/models/base.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 9b2f73a to 28c5143 Compare June 29, 2026 11:45
Comment thread queue_job_optional/models/base.py
@ecino ecino force-pushed the ecino/queue-job-sh branch 2 times, most recently from f21d9e3 to b886b0a Compare June 29, 2026 12:31
@ecino ecino changed the title [WIP] FEAT! Make queue_job dependencies optional REFACTOR Make queue_job dependencies optional Jun 29, 2026
@ecino ecino marked this pull request as ready for review June 29, 2026 12:31
Comment thread queue_job_optional/models/base.py
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from b886b0a to ff7a2b5 Compare June 29, 2026 13:24
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from ff7a2b5 to 1f482b5 Compare June 29, 2026 13:35
Comment thread queue_job_optional/models/queue_job_replacement.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from 1f482b5 to fff7252 Compare June 29, 2026 13:48
Comment thread queue_job_optional/models/queue_job_replacement.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from fff7252 to e577373 Compare June 29, 2026 14:26
Comment thread partner_communication_reminder/models/recurring_contract.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from e577373 to 07cdaba Compare June 29, 2026 14:39
Comment thread queue_job_optional/models/queue_job_replacement.py Outdated
@ecino ecino force-pushed the ecino/queue-job-sh branch from 07cdaba to de103a9 Compare July 1, 2026 09:09
Comment thread queue_job_optional/models/base.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from de103a9 to f83f159 Compare July 1, 2026 09:34
Comment thread message_center_compassion/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from f83f159 to 8572c94 Compare July 1, 2026 09:46
Comment thread partner_communication/__manifest__.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from 8572c94 to 7ae0694 Compare July 1, 2026 11:09
Comment thread queue_job_optional/models/queue_job_replacement.py
Comment thread queue_job_optional/models/queue_job_replacement.py
Comment thread queue_job_optional/models/queue_job_replacement.py
- NEW module queue_job_sh_safe that will safely use queue_jobs when available and fallback to an alternate mechanism with ir_cron in case the module is not installed.
- This is useful for Nordic using odoo.sh on which queue jobs are prohibited and not optimal for the infrastructure
@ecino ecino force-pushed the ecino/queue-job-sh branch from 7ae0694 to 16e8779 Compare July 1, 2026 13:52
Comment thread queue_job_optional/models/base.py
Comment thread queue_job_optional/models/queue_job_replacement.py
Comment thread sponsorship_compassion/models/contract_group.py
@ecino ecino force-pushed the ecino/queue-job-sh branch from dbb3b4d to 7fbd209 Compare July 2, 2026 07:09
@ecino ecino merged commit 61fd86b into 18.0 Jul 2, 2026
1 of 2 checks passed
@ecino ecino deleted the ecino/queue-job-sh branch July 2, 2026 07:14
Comment on lines +1 to +2
def migrate(cr, version):
cr.execute("""delete from queue_job_function where name not like '%edi%';""")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P0 Optional Queue Table Required

This migration still deletes from queue_job_function, but the new supported Odoo.sh setup can install child_compassion without the real queue_job module. In that deployment the table is absent, so upgrading this module raises a database error before the optional queue fallback can load.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant