Skip to content

T3067 my compassion 18.0 migration#341

Merged
ecino merged 28 commits into
18.0from
T3067-my_compassion-18.0-migration
Jul 2, 2026
Merged

T3067 my compassion 18.0 migration#341
ecino merged 28 commits into
18.0from
T3067-my_compassion-18.0-migration

Conversation

@NoeBerdoz

@NoeBerdoz NoeBerdoz commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

[MIG] T3067: migrate the MyCompassion portal and theme to Odoo 18

This is the main part of the portal migration. It moves the MyCompassion portal, its
theme, and two sibling website modules from Odoo 14 to Odoo 18.

Modules in this PR

  • my_compassion: the portal (/my2 pages).
  • theme_compassion_2025: the website theme.
  • website_child_protection: the child-protection charter page.
  • website_sponsorship: removed. Its useful parts were moved into my_compassion.

Key changes

  • Migrate my_compassion to Odoo 18. Python, views, and all JavaScript updated.
    The JavaScript was rewritten to the Odoo 18 style (OWL components and ES modules;
    the old odoo.define no longer exists). All portal pages render again: donations,
    letters, children, sponsorships, profile, settings, login and signup.
  • Migrate theme_compassion_2025 to Odoo 18. Assets moved to the manifest,
    dynamic stylesheets ported, JS rewritten to OWL, Bootstrap 4 to Bootstrap 5
    updates. Fixed the theme color isolation so another website's palette no longer
    bleeds in, and set the pages back to full width.
  • Migrate website_child_protection to Odoo 18.
  • Remove website_sponsorship. The parts the portal needs moved into
    my_compassion. The old public routes (/children, /child/...) now redirect
    to the new /my2 pages.
  • Fix minor issues: header menu centering, gift-basket
    cart icon issues, footer issues, portal menu translations issues, per-user menu cache fix.

Deployment note

Upgrade with:

-u my_compassion,theme_compassion_2025,partner_salutation --i18n-overwrite

Related PRs (please review together)

This is one part of a 3-repo migration. The reviewer of this PR is also concerned
by the other two:

Merge order: compassion-modules first (it adds fields this PR uses), then
compassion-website, then compassion-switzerland.The --i18n-overwrite is needed so the translated menu labels are applied.

Important Note

During the migration of my_compassion, I discovered that some parts are too tightly coupled to our Swiss-related modules.
The dissociation will be handled in a separate PR to ensure the portal is entirely compatible with the Nordic countries' Odoo instance.

Forward-ported fixes from v14

Production kept improving the v14 portal while this migration was underway. Those fixes are carried over so v18 does not ship behind v14:

  • Gift form only offers eligible sponsorships (T3236)
  • Letters page lists only relevant children (T3241)
  • Correct theme on /my2 when linked from another website (T3243)
  • Backend and translation carry-overs a date-sort fix, a route converter that
    no longer errors on missing records, giving-limits styling, and the German,
    French and Italian translations.

I deliberately skipped T3265 (that change introduced a bug and is linked to my_compassion_native).

my_compassion_native is not migrated (kept dormant)

You will see my_compassion_native files in the diff, but the module is left as a
dormant stub (installable: False) and is not part of this migration:

my_compassion must stay country-agnostic. Nordic instances may not want the
mobile app, so the portal must not depend on it.

@Danielgergely owns the mobile/native experience and will migrate my_compassion_native in
a separate PR.

NoeBerdoz added 22 commits June 2, 2026 13:36
  - Bump to 18.0.1.0.0 and mark the module installable.
  - Move static assets into the manifest assets dict.
  - Add data/assets.xml so the 3 dynamic stylesheets load as ir.asset records.
  - Rename the dynamic stylesheet URLs to /theme_compassion_2025/dynamic/*.scss.
  - Port the post-install hook to the (env) signature and run it directly, no queue.
  - Port the stylesheet generator to Odoo 18 (clear_cache, encode text before base64, render the staged
  theme view so fresh install works).
  - Remove stray spaces in the access rights CSV.
  - Fix the header: drop the Odoo 14 inherit that no longer exists, point the brand bar and menu at the
  new navbar.
  - Rename <tree> to <list> in the backend views.
  - Replace t-raw with t-out in the components.
  - Delete the old views/assets.xml (now replaced by the manifest assets dict).
Rewrite theme JS to OWL components and ES-module publicWidgets:
  - Password, RangeInput, ProgressBar become OWL 2.8.2 public components in
    static/src/js/components/, registered in the public_components registry;
    their XML templates updated to OWL 2.x syntax.
  - event_banner, map, form_field_validator become ES-module publicWidgets in
    static/src/js/widgets/; form_field_validator moves under the theme namespace.
  - Delete the old odoo.define / raw-listener files (_password, _range_input,
    _progress_bar, _event_banner, _map, utils/form_field_validator).
Add upgrade migration script and dynamic-stylesheet tests:
  - migrations/18.0.1.0.0/post-migration.py: on upgrade, rename the 3 dynamic
    stylesheet ir.attachment URLs from /theme/compassion/*.scss to
    /theme_compassion_2025/dynamic/*.scss (idempotent SQL), invalidate caches,
    and regenerate the stylesheets. Signature is migrate(cr, version).
  - tests/test_dynamic_stylesheets.py: 6 tests for the install-reliability
    behavior (attachments populated on install; regenerate on color write/unlink;
    cache cleared on regenerate; migration URL-rename idempotent; user-created
    colors survive the upgrade).
- Dropped templates/assets.xml and ported dependencies in manifest
- Changed odoo.define in JS into ES module
- Templates adaptations
- Ported dead website_form dependency to website
  - Move the parts my_compassion uses (child web methods and reservation fields,
    payment-mode and contract-origin publish flags, partner matching, child
    security and publish views) into my_compassion.
  - Delete website_sponsorship.
  - Redirect the old public /children and /child routes to the my2 pages.
  - Fix slug import for v18 (env['ir.http']._slug).
  - Filter the title dropdowns (new-sponsorship wizard, contact-us, user-settings,
    and the crowdfunding project form) on the new is_shown_on_public_forms flag.
  Make my_compassion install and upgrade cleanly on v18. Views are left
  parked; their activation and the frontend render pass come in a later commit.

  - R11 python: my_account (local_redirect/content_disposition imports,
    jsonrequest->get_json_data, session.authenticate credential dict);
    res_user flush_all; name_get->_compute_display_name (my2_event_banner,
    my2_website_route); compassion_project pytz.utc.
  - Manifest: drop website_form + website_crm_privacy_policy; assets dict
    (frontend CSS incl login.css); bump 18.0.1.0.0; installable.
  - Data: drop removed ir.cron numbercall/doall.
  - Backend views: <tree>-><list>, attrs=->direct, view_mode tree->list.
  - website.rewrite /shop/confirmation: 308->301 (308 calls routing_map at
    load and must not target an existing route).
  - Drop the removed web/website.assets_frontend template-inheritance
    (login_template, http_error_custom); CSS -> manifest assets.
  - Retire dead MyCompassion-1 pages (write_a_letter, my_children) whose
    /my/* routes already 301-redirect to /my2/*.
  After the website_sponsorship absorb, portal users had a model-read ACL on
  compassion.child but no record rule, so they could read every child. Add a
  portal rule scoped to the public pool (states N/I) plus the partner's own
  sponsored children, active and ended: it traverses the computed
  sponsorship_ids (which keeps terminated contracts) rather than
  child.sponsor_id (cleared on release), so a former sponsor keeps access to
  their child while other sponsors' children stay private.
  - QWeb: t-esc/t-raw -> t-out; Bootstrap 4 -> 5 renames incl. data-bs-*
    attributes, btn-close, form-select/form-check; drop the removed jumbotron;
    contact form action -> /website/form/.
  - Header: rewrite my2_header_menu against the v18 website header (navbar_nav
    injection, mobile offcanvas inherit, t-attf-class cart badge); share the
    menu items via my2_nav_items.
  - Replace removed framework/model surface: has_sponsorships ->
    number_sponsorships, payment.acquirer -> payment.provider (code
    postfinance), gift.threshold.settings gift_type_id, adapt to the dropped
    website_legal_page.acceptance_full, provide current_year/first_year in the
    donations controller.
  - migrations/18.0.1.0.1: re-activate the views the migration parked (xmlid
    views, theme per-website copies, arch-synced website copies), unmask
    template_header_default/footer_custom on theme websites, drop the leftover
    unmanaged sponsor_id portal rule.
  - Theme 18.0.1.0.1: fix the BS3 @extend that failed the frontend CSS bundle
    and the language-selector active_lang access.
  - Toast: rewrite the service as an ES module rendering the existing client
    template via renderToElement; register JS + template in the manifest
    assets; drop the legacy widget file. Add title localization support.
  - Password: mount the theme OWL component declaratively on the login and
    set-password pages; delete the two scripts whose only job was the
    imperative mount. Keep show_password.js as an ES module: it drives the
    eye icons of the plain (non-my2) login and signup pages.
  - Theme validator: add the strictly-positive number rule and wire it to the
    sponsorship wizard custom-amount field.
  - Signup confirmation mail: align the source with the v18 template syntax
    and fix the activation link (res.partner.signup_url no longer exists;
    use partner._get_signup_url()). migrations/18.0.1.0.2 applies the link
    fix to the stored template in every language.
  - Rewrite the 5 donation widgets as ES modules and load them (with the
    donation-flow CSS) from the manifest assets; drop the inline page
    <script>/<link> tags. Bootstrap 5 modal API in the gift package.
  - Replace the forged legacy payment form with the standard payment.form
    embed: the gift-package controller builds the payment values and the
    landing chain reuses the /shop/confirmation rewrite to the thank-you page.
  - Port the donation tours to the v18 tour DSL and the tests to start_tour;
    monthly-donation tests stay skipped while recurring donations are disabled.
  - Fix the donation-form base_name t-set so the suggested-amount input ids
    no longer embed surrounding whitespace.
- Rewrite my2_sponsorships and my2_new_sponsorship_wizard as ES modules
  and load them from the manifest assets; drop the inline <script src>
  tags (sponsorships is also loaded on the child-unavailable page).
- Move the sponsorship + wizard page CSS from inline <link> into manifest
- Mount the theme RangeInput imperatively via mountComponent, reusing the
  frontend env (Component.env); read the age range as {min,max}; fix the
  undefined $spinner reference on the random-choice error path.
- Bootstrap 5 modal API for the Write&Pray age modal; native Promise
  .catch in the wizard step navigation.
- Render the wizard step view by id (ir.qweb._render rejects a view
  recordset in a website context on v18).
  - Rewrite the new-letter and letters-listing JS as ES modules loaded from
    the manifest assets; drop the inline <script src> (incl the raw owl.js)
    and inline <link> CSS (now bundled).
  - Replace the cross-file uploadedAttachmentLetterFiles global with a shared
    module container (my2_letter_attachments).
  - Mount the theme ProgressBar imperatively via mountComponent reusing the
    frontend env (Component.env), driven from the status poll through the live
    instance (app.root.component); Bootstrap 5 modal API throughout.
  - Reduce the OWL1 child-selector to vanilla navigation-only (the portrait is
    server-rendered) and drop its duplicate twin.
  - Route the DOM-ready letter scripts through OWL whenReady: frontend bundles
    execute after DOMContentLoaded, so plain listeners never fired.
- Rewire the new-letter controllers (create/launch/status) to the
  refactored v18 correspondence.s2b.generator: drop the removed
  generation_status/error fields, use action_preview() for the
  synchronous preview and generate_letters() (async queue job) for send,
  and poll the generator state.
- Restructure my2_new_letter.js: preview shows the server-rendered HTML
  letter in the modal (iframe srcdoc); send shows an indeterminate
  flowing progress bar, polls the state, and redirects to the listing.
  - Rewrite profile-tabs, timeline, center-weather, error-redirect and
    user-settings JS as ES modules in web.assets_frontend; drop the inline
    <script src>/<link> (now bundled). Add the X8 Settings link to the
    portal user-dropdown (my2_header_menu.xml).
  - Route raw DOM-ready scripts through OWL whenReady; publicWidgets start
    via the public root. BS5 tab API (window.Tab) for the profile tabs;
    timeline fetch->rpc; user_settings off web.rpc/web.Dialog (rpc()+toast),
    validator bridge preserved.
  - Self-scope the now-site-wide scripts (null/absent-element guards) so they
    no-op off their pages.
  - Drop the obsolete Bootstrap-4 scrollbar-compensate override (no-op on BS5).
  - Re-parent the Compassion theme module category onto base.module_category_theme so Odoo's native per-website isolation excludes the inactive themes (stops the muskathlon
  palette bleed);
  - Reloads svg files from theme's static sources when file is missing on the DB's attachments.
  - Fix the dropdown Bootstrap 5 user menu
  - Drop the legacy MyCompassion 1.0 entries so it shows Settings + Logout only.
  - Remove the leftover "Shop" and "Jobs" website.menu records on the
  MyCompassion website with a post-migration script.
- Center header nav + restore gift-package cart (theme depends website_sale)
- Footer BS5 spacing + drop leaked language selector and stock copyright bar
- Translate portal menu + Settings dropdown (de/fr_CH/it)
- Center the "New sponsorship" button
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown

Too many files changed for review. (290 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

@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 upgrades the 'my_compassion' and 'theme_compassion_2025' modules to Odoo 18.0, converting JavaScript files to ES modules, replacing legacy RPC queries with the modern '@web/core/network/rpc' service, and rewriting several widgets as Owl components. It also merges the core features of the deprecated 'website_sponsorship' module into 'my_compassion' and updates QWeb templates to use Odoo 18 syntax. The review feedback identifies critical runtime issues, including missing imports for 'uuid' and 'urlencode', a missing manifest dependency on 'child_compassion', fragile access to Owl component instances, and a potential 'ReferenceError' when referencing 'Modal' directly.

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 thread my_compassion/controllers/my2_sponsorships.py
Comment thread my_compassion/controllers/my_account.py
Comment thread my_compassion/__manifest__.py
Comment thread my_compassion/static/src/js/my2_new_letter.js Outdated
Comment thread my_compassion/static/src/js/my2_gift_package.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

Integrate origin/18.0 (T2524 forward-port and other 18.0 work). Conflicts
resolved keeping our v18 migration; the mobile shell and my_compassion_native
are left inert/dormant for Daniel G. to port.

Kept via the merge: web_sort_date letter sort, model_safe route fix (T3219).
Ported from the 14.0 gap:
- T3236: validate the gift recipient server-side (only eligible sponsorships)
- T3243: force the MyCompassion website/theme on /my2 routes
- T3241: exclude draft children from the letter list
eslint.config.cjs
- Parse our .js as ES modules (@Odoo-Module)
- Add browser globals
- Allow hoisted-function calls
- Skip unused event args, keep dead-local checks.

Lint fixes:
- Wrap long lines
- Add ids to oe_structure divs (oca-checks).
- priority=99 on the my_account replace so the link removal applies last.
- JS: init vars, drop dead var, flatten if conditions.
@NoeBerdoz NoeBerdoz requested a review from ecino July 1, 2026 14:08
@ecino ecino merged commit f96b997 into 18.0 Jul 2, 2026
1 check passed
@ecino ecino deleted the T3067-my_compassion-18.0-migration branch July 2, 2026 07:38
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.

3 participants