fix(shopfloor): register tokens SCSS in bundle, drop forbidden @import

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) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-18 18:35:00 -04:00
parent 298f5942eb
commit 6d1efc6c43
4 changed files with 14 additions and 7 deletions

View File

@@ -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',

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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;