diff --git a/web_company_color/__manifest__.py b/web_company_color/__manifest__.py index 1f30c4e8af3..1a2280bed99 100644 --- a/web_company_color/__manifest__.py +++ b/web_company_color/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Web Company Color", "category": "web", - "version": "18.0.1.1.0", + "version": "18.0.1.1.1", "author": "Alexandre Díaz, Odoo Community Association (OCA)", "website": "https://github.com/OCA/web", "depends": ["web", "base_sparse_field"], diff --git a/web_company_color/migrations/18.0.1.1.1/post-migration.py b/web_company_color/migrations/18.0.1.1.1/post-migration.py new file mode 100644 index 00000000000..0e510f76a39 --- /dev/null +++ b/web_company_color/migrations/18.0.1.1.1/post-migration.py @@ -0,0 +1,22 @@ +# Copyright NuoBiT Solutions - Eric Antones +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) +from odoo import SUPERUSER_ID, api + + +def migrate(cr, version): + """Regenerate the per-company color attachments in the current format. + + Databases upgraded from older versions still carry the color + attachments in the legacy format (raw SCSS content, mimetype + ``application/octet-stream``). The current module compiles the SCSS + server-side and serves the attachment URL directly as a stylesheet, + so it needs compiled CSS with mimetype ``text/css`` — browsers refuse + the legacy attachments under strict MIME checking and company colors + silently stop applying. Only the ``post_init_hook`` (fresh installs) + regenerates them; upgrades never did. Idempotent: regenerating an + up-to-date attachment rewrites it with identical semantics. + """ + if not version: + return + env = api.Environment(cr, SUPERUSER_ID, {}) + env["res.company"].search([]).scss_create_or_update_attachment()