From 6d1efc6c430727543587556994d0fa5c46fad04a Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sat, 18 Apr 2026 18:35:00 -0400 Subject: [PATCH] fix(shopfloor): register tokens SCSS in bundle, drop forbidden @import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Odoo 19 forbids local SCSS @import statements for security reasons and silently falls back to the OLD cached CSS bundle when it sees them. My redesign commit used: @import "./fp_shopfloor_tokens"; in three SCSS files. Odoo logged WARNING Local import './fp_shopfloor_tokens' is forbidden for security reasons. Please remove all @import {your_file} imports in your custom files. ...and the compiled bundle kept rendering the old look. That's what the user saw. Fix: 1. Add _fp_shopfloor_tokens.scss as the FIRST entry in web.assets_backend in the manifest. Odoo concatenates the bundle in order, so variables/mixins in the first file are visible to every later file — native @import is not needed. 2. Strip the @import "./fp_shopfloor_tokens"; line from all three consumer files (tablet, manager, plant overview). Verified: asset bundle regenerated to /web/assets/.../web.assets_backend.min.css (1.45 MB). Grepped the compiled CSS and all five new classes are present: o_fp_tablet_header, o_fp_kpi_strip, o_fp_mgr_card, o_fp_live_dot, o_fp_panel_unassigned. 8 radial-gradients baked in. Zero warnings in the Odoo server log post-rebuild. Co-Authored-By: Claude Opus 4.7 (1M context) --- fusion_plating/fusion_plating_shopfloor/__manifest__.py | 4 ++++ .../static/src/scss/fusion_plating_shopfloor.scss | 6 ++++-- .../static/src/scss/manager_dashboard.scss | 5 +++-- .../static/src/scss/plant_overview.scss | 6 +++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fusion_plating/fusion_plating_shopfloor/__manifest__.py b/fusion_plating/fusion_plating_shopfloor/__manifest__.py index b022fc00..d7d57395 100644 --- a/fusion_plating/fusion_plating_shopfloor/__manifest__.py +++ b/fusion_plating/fusion_plating_shopfloor/__manifest__.py @@ -57,6 +57,10 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved. ], 'assets': { 'web.assets_backend': [ + # Tokens MUST load first — other SCSS files reference its mixins + # and variables directly (Odoo 19 forbids @import in custom SCSS, + # so tokens are resolved via bundle concatenation order). + 'fusion_plating_shopfloor/static/src/scss/_fp_shopfloor_tokens.scss', 'fusion_plating_shopfloor/static/src/scss/fusion_plating_shopfloor.scss', 'fusion_plating_shopfloor/static/src/scss/plant_overview.scss', 'fusion_plating_shopfloor/static/src/scss/process_tree.scss', diff --git a/fusion_plating/fusion_plating_shopfloor/static/src/scss/fusion_plating_shopfloor.scss b/fusion_plating/fusion_plating_shopfloor/static/src/scss/fusion_plating_shopfloor.scss index 8d2c68bc..6bca12a0 100644 --- a/fusion_plating/fusion_plating_shopfloor/static/src/scss/fusion_plating_shopfloor.scss +++ b/fusion_plating/fusion_plating_shopfloor/static/src/scss/fusion_plating_shopfloor.scss @@ -6,10 +6,12 @@ // Modernised 2026-04 design: hero banner, gradient KPI cards, tap-first // action rows. Works in Odoo's light + dark themes because every colour // resolves from CSS custom properties or color-mix'd tokens. +// +// Variables / mixins come from _fp_shopfloor_tokens.scss — loaded FIRST +// in the asset bundle (see __manifest__.py). No @import; Odoo 19 forbids +// local @import statements in custom SCSS. // ============================================================================= -@import "./fp_shopfloor_tokens"; - // ============================================================================= // Global touch / hover suppression (kept from previous rev) diff --git a/fusion_plating/fusion_plating_shopfloor/static/src/scss/manager_dashboard.scss b/fusion_plating/fusion_plating_shopfloor/static/src/scss/manager_dashboard.scss index 153f45c2..2132882b 100644 --- a/fusion_plating/fusion_plating_shopfloor/static/src/scss/manager_dashboard.scss +++ b/fusion_plating/fusion_plating_shopfloor/static/src/scss/manager_dashboard.scss @@ -6,10 +6,11 @@ // Shares design tokens + panel / KPI / chip classes from the Tablet Station // SCSS. Only the manager-specific components live here: hero banner with // live dot, 3-column workload grid, richer MO cards, gradient avatars. +// +// Variables / mixins come from _fp_shopfloor_tokens.scss — loaded FIRST in +// the asset bundle (see __manifest__.py). No @import; Odoo 19 forbids it. // ============================================================================= -@import "./fp_shopfloor_tokens"; - // Touch-device hover suppression @media (hover: none) { diff --git a/fusion_plating/fusion_plating_shopfloor/static/src/scss/plant_overview.scss b/fusion_plating/fusion_plating_shopfloor/static/src/scss/plant_overview.scss index 8747291b..25cef175 100644 --- a/fusion_plating/fusion_plating_shopfloor/static/src/scss/plant_overview.scss +++ b/fusion_plating/fusion_plating_shopfloor/static/src/scss/plant_overview.scss @@ -4,11 +4,11 @@ // License OPL-1 (Odoo Proprietary License v1.0) // // Modernised 2026-04: gradient column headers, card depth, theme-safe -// using shared design tokens. +// using shared design tokens. Variables / mixins come from +// _fp_shopfloor_tokens.scss — loaded FIRST in the asset bundle +// (see __manifest__.py). No @import; Odoo 19 forbids it. // ============================================================================= -@import "./fp_shopfloor_tokens"; - .o_fp_plant_overview { display: flex;