Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1434 Vistas

Bonjour,

Je suis en train de commencer un thème pour Odoo 17 (SH).
Dans un premier temps je souhaite personnaliser la palette de 5 couleurs.
Au moment de pousser sur SH, j'ai l'erreur suivante :  odoo.addons.base.models.assetsbundle: Error: Undefined variable: "$o-color-palettes".

J'ai portant bien suivi la doc et je réutilise le nom des variables d'origine.

Une idée ?

Merci pour vos 💡

G.

Avatar
Descartar
Mejor respuesta

Hello Guillaume!

I also faced the same issue, where I needed to create a specific `theme_NAME` module to render the `scss` files. The solution I found was the following:

  1. This error occurs because the `primary_variables.scss` file is being loaded before `bootstrap_overridden.scss`. The solution is to adjust the order in the `__manifest__.py` file, placing the path of the `bootstrap_overridden.scss` file before `primary_variables.scss`. After that, restart Odoo and update the module. With this, the error will no longer appear in the log, but still, the `scss` files will not render correctly. This brings us to the second point.
  2. Check the pre-existing themes in the `ir_asset.xml` file in the `data` directory, as only the `bootstrap_overridden.scss` file is being added with the `prepend` directive. Remove the `prepend` directive from the `primary_variables.scss` file path in the `__manifest__.py` file, restart Odoo and update the module.

This fix confirms that the issue was related to the loading order with `prepend`. When `primary_variables.scss` was loaded before Bootstrap, via `prepend`, it would try to modify `$o-color-palettes` before this value was set, causing a silent failure.

Result:

'assets': {

    'web._assets_frontend_helpers': [

        ('prepend', 'website_NAME/static/src/scss/bootstrap_overridden.scss')

    ],

    'web._assets_primary_variables': [

        'website_NAME/static/src/scss/primary_variables.scss'

    ],

    'web.assets_frontend': [

        'website_NAME/static/src/scss/theme_style.scss'

    ]

}

I hope this solution can help you, as well as other professionals who may be facing the same problem.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 24
2258
2
feb 24
1414
0
mar 24
861
0
ago 25
363
4
may 25
2837