Skip to content

[ADD] Bootstrap 4 to 5 class renames - #173

Open
bosd wants to merge 1 commit into
OCA:masterfrom
bosd:bootstrap5-classes
Open

bosd wants to merge 1 commit into
OCA:masterfrom
bosd:bootstrap5-classes

Conversation

@bosd

@bosd bosd commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Odoo moved to Bootstrap 5 in 15.0, so the Bootstrap 4 direction classes stop doing anything from that version on. Nothing converts them, so they survive migrations. Counting files in OCA/web:

14.0: BS5=0 BS4=6
15.0: BS5=1 BS4=5
16.0: BS5=7 BS4=4

Four files on 16.0 still carry classes that have no effect.

This adds the 22 renames that have one unambiguous replacement: spacing (ml-, mr-, pl-, pr-), text alignment, float, border and rounded directions, dropdown alignment, the typography helpers, and sr-only, badge-pill, custom-select, no-gutters.

Left out: what Bootstrap 5 dropped without a replacement, like form-group, form-row, btn-block, media, jumbotron, card-deck, input-group-append and custom-control. Those need the markup rethought, so a warning suits them better than a rewrite. Can add that separately if you want it.

.xml only. Renaming a .ml-3 selector in a module's own scss would break that stylesheet instead of fixing it.

I put it in migrate_allways because the classes are inert from 15.0 on, so converting them is safe at any step, and a module that reached 17.0 with them still in place would never see a 14.0 to 15.0 script again. string_attribute_in_tree_view.yaml already works that way. Happy to move it to migrate_140_150, though there is no 14.0 fixture yet.

The renames come from the utilities API of the Bootstrap that Odoo bundles rather than from the changelog, so ms/me, ps/pe, text-start/text-end, float-start/float-end, fw- and fst-.

The fixture runs through the existing test_migration_180_190. It also covers what must not change: o_ml-2, my-ml-3, mt-2, mx-auto, text-lefty, o-text-right and ml-6.

Odoo switched to Bootstrap 5 in 15.0, so the direction-based classes from
Bootstrap 4 silently stop doing anything from that version on. Nothing
converts them today, and they survive migrations: OCA/web still has four
files carrying them on 16.0.

Only the renames with one unambiguous replacement are here. Classes that
Bootstrap 5 dropped without a drop-in replacement (form-group, form-row,
btn-block, media, jumbotron, card-deck, input-group-append/prepend,
custom-control) need the markup rethought and are better reported as
warnings than rewritten.

The rules live in migrate_allways rather than migrate_140_150 because the
classes are inert from 15.0 on, so converting them is safe at any step, and
a module reaching 17.0 with Bootstrap 4 classes left would never see a
14.0 to 15.0 script again.

Every rename is taken from the utilities API of the Bootstrap that Odoo
bundles: margin-start/end are ms/me, padding-start/end are ps/pe,
text-align takes start/end/center, float takes start/end/none, font-weight
is fw and font-style is fst.
@bosd
bosd force-pushed the bootstrap5-classes branch from 75d5243 to f261db9 Compare October 1, 2026 17:49
bosd added a commit to bosd/odoo-lint that referenced this pull request Oct 8, 2026
…rade rules (#19)

The XML data files a module's manifest loads (data, demo, qweb and assets
globs) are now linted, per module: duplicate record and template ids span
files, and version-gated checks follow the module's own manifest version,
as OCA's checks do (a short or missing version is the target version, a
malformed one skips them).

XML001-XML024 reimplement oca-checks-odoo-module's XML checks with the
same names; all 717 findings on its test repository match by file, line
and check, including libxml2's line numbering of multi-line start tags.
Fixes: XML declaration, redundant module name, attribute order (layout
kept), eval for boolean and numeric fields, t-esc/t-raw to t-out,
res.groups category_id removal (unsafe).

XML101 renames Bootstrap 4 classes that Bootstrap 5 renamed (Odoo 15.0+)
in class attributes, with a safe fix; XML102 reports the ones it removed.
The renames follow OCA/odoo-module-migrator#173.

Co-authored-by: bosd <5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant