BreakingHighlight of Weekly #005

Upgrade script migrates icons to Material Symbols

The SCSS that kept fa-* and oi-* classes working was removed when the web client switched to Material Symbols. The new upgrade_code script rewrites icon usages in XML, JS and other files of custom modules. Run it on your addons before upgrading to 20.0.

Versions20.0
AppFramework & technical

On the upgrade checklist: 19.0 → 20.0

Pull requests and commits

BranchPull requestCommit
20.0odoo/odoo#287860 ↗5f1412f2b3 ↗

Commit message

[IMP] upgrade_code: add script to migrate icons to Material Symbols

__Why__

In 19.5 the web client renders icons through the Material Symbols system
(`<i class="oi" data-icon="person"/>`). The SCSS maps that let `fa-*`
and `oi-*` icon classes keep working were removed. Custom and
third-party addons still using those classes would lose their icons, so
they need an automated way to catch up.

__What__

An `upgrade_code` script that rewrites icon usages in `.xml`, `.js`,
`.py`, `.scss` and `.css` files:

- `class="fa fa-star"` becomes `class="oi oi-filled" data-icon="star"`.
  The same applies to `t-att-class` and `t-attf-class` when their
  literals are icon classes. Modifiers carry over (`fa-fw` → `oi-fw`).
- `icon=` attributes of buttons and OWL props, and `'icon': ...` dict
  entries, now hold the icon name. When needed, `icon_class` /
  `iconClass` is added to keep the filled variant.
- CSS and JS selectors `.fa-star` become `[data-icon='star']`. For icons
  that exist in both a filled and an outlined `fa-*` version,
  `.oi-filled` or `:not(.oi-filled)` is added.
- In tests, `toHaveClass("fa-*")` becomes
  `toHaveAttribute("data-icon", ...)`.

The mapping tables come from the removed SCSS maps and live in
`material_symbols_icons_mapping.py`.

This is best-effort. Class names built at runtime, strings mixing icon
and other classes, and icons stored in database records are left alone
and need a manual pass. `web` and vendored code (`lib`, `node_modules`,
`o_spreadsheet`) are skipped.

task-5901783

Related: odoo/enterprise#136695

My stack

Pick the versions and apps you run. Weekly digests, this week's table and All changes then show only what concerns you. Saved in this browser.

Versions
Apps
Modules