Files
Odoo-Modules/fusion_portal/rename_module.sql
gsinghpal 747c814249 refactor(fusion_portal): rename from fusion_authorizer_portal + modern photo cards on accessibility selector
Rename module fusion_authorizer_portal -> fusion_portal everywhere:
manifest/assets, controllers, models, views, JS (odoo.define + asset URLs),
migration MODULE constants; plus cross-module refs in fusion_schedule,
fusion_repairs, fusion_quotations (depends + inherit_id) and the pdf_filler
import in fusion_claims. Add rename_module.sql for the one-time in-place DB
rename (ir_module_module, ir_model_data, ir_ui_view.key,
ir_module_module_dependency) required on installed envs before -u fusion_portal.
Document the rename gotcha as rule 16 in CLAUDE.md.

Redesign the Accessibility Assessment selector: replace Font Awesome icon tiles
with photo-banner cards using 7 optimized images (1000x750 PNG -> 800x600 JPEG,
~8MB -> 488KB), per-type colour accent bar + centered pill button, hover
lift/zoom. Images ship as module static files so they deploy/sync with the module.

Drop the regenerable graphify-out cache from the module.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 22:38:14 -04:00

82 lines
4.0 KiB
PL/PgSQL

-- ============================================================================
-- One-time module rename: fusion_authorizer_portal -> fusion_portal
-- ============================================================================
-- WHY THIS IS NEEDED
-- ------------------
-- Odoo identifies an installed module by its TECHNICAL NAME (the addon folder
-- name) and stores that name in many places: the module record itself, every
-- external ID (ir_model_data), each view's `key`, and the dependency rows of
-- every other module that depends on it.
--
-- Renaming only the folder + the in-code references makes Odoo treat
-- `fusion_portal` as a BRAND-NEW, uninstalled module while the old
-- `fusion_authorizer_portal` records stay behind. Installing fresh would then
-- DUPLICATE groups / mail templates / menus and ORPHAN all existing data
-- (assessments, fusion.pdf.template records, portal users' group links, ...).
--
-- This script renames the DB rows in place so the existing install simply
-- "becomes" fusion_portal, after which a normal -u fusion_portal reloads all
-- XML data cleanly under the new external IDs.
--
-- WHEN TO RUN
-- -----------
-- Run ONCE against every database that already has the module installed
-- (e.g. westin, entech), BEFORE the first -u fusion_portal.
-- Fresh databases that never had fusion_authorizer_portal do NOT need this.
-- It is idempotent — re-running after the rename matches nothing and is a no-op.
--
-- HOW TO RUN
-- ----------
-- 1. Stop Odoo (or do it during a maintenance window).
-- 2. psql into the target DB and execute this file:
-- \i rename_module.sql
-- (or paste the BEGIN..COMMIT block).
-- 3. Confirm the four "remaining" counts at the end are all 0.
-- 4. Start Odoo with: -u fusion_portal
-- 5. (optional) hard-refresh browsers / clear bundle cache — the asset paths
-- changed from /fusion_authorizer_portal/... to /fusion_portal/...
-- ============================================================================
BEGIN;
-- 1) The module record itself.
UPDATE ir_module_module
SET name = 'fusion_portal'
WHERE name = 'fusion_authorizer_portal';
-- 2) Every external ID owned by the module (groups, views, templates, menus,
-- server actions, record rules, ACLs, cron, ...).
UPDATE ir_model_data
SET module = 'fusion_portal'
WHERE module = 'fusion_authorizer_portal';
-- 3) View keys are stored ON the view row (not derived from ir_model_data),
-- and the post_init hook / migrations search by this key prefix.
UPDATE ir_ui_view
SET key = replace(key, 'fusion_authorizer_portal.', 'fusion_portal.')
WHERE key LIKE 'fusion_authorizer_portal.%';
-- 4) Dependency rows of OTHER modules that depend on this one
-- (fusion_schedule, fusion_repairs, fusion_quotations, and any future ones).
UPDATE ir_module_module_dependency
SET name = 'fusion_portal'
WHERE name = 'fusion_authorizer_portal';
-- ---------------------------------------------------------------------------
-- Verification — every count below must be 0 after the updates above.
-- ---------------------------------------------------------------------------
SELECT 'ir_module_module' AS table, count(*) AS remaining FROM ir_module_module WHERE name = 'fusion_authorizer_portal'
UNION ALL
SELECT 'ir_model_data', count(*) FROM ir_model_data WHERE module = 'fusion_authorizer_portal'
UNION ALL
SELECT 'ir_ui_view.key', count(*) FROM ir_ui_view WHERE key LIKE 'fusion_authorizer_portal.%'
UNION ALL
SELECT 'ir_module_module_dependency', count(*) FROM ir_module_module_dependency WHERE name = 'fusion_authorizer_portal';
-- If all four show 0, COMMIT. Otherwise ROLLBACK and investigate.
COMMIT;
-- Optional: force a clean recompile of web asset bundles (paths changed).
-- DELETE FROM ir_attachment WHERE url LIKE '/web/assets/%';
-- (safe; Odoo regenerates bundles on next page load / -u.)