Name: [FIX] viin_brand_website, viin_backend_theme: one click into the backend, and type to search

State: Killed finished in 115m

PR State: merged

PR Author: David Tran

PR Author Email:

PR: #683

Committer: David Tran

Committer Email: david.tran@tvtmarine.com

Commit: f3bb3e88748a3c7a00fed2251ac1fcb7c564d43b

Description:

                                            [IMP] viin_brand_website: one click from the site into the backend

Clicking the apps grid on the website used to open a dropdown listing the
internal user's apps, so reaching the backend cost an extra click every time.
The button now links straight to /odoo and no longer toggles anything.

/odoo can take a noticeable moment on an install with many modules, so the icon
swaps to a spinner on click: the user can see the click registered. A
Ctrl/Cmd/Shift or middle click opens the backend in a new tab and leaves the
current page's icon alone, and a Back-button restore from the browser's cache
puts the icon back rather than leaving it spinning for good.

That spinner is wired by a delegated listener on the document, not by a public
Interaction. It was written as an Interaction first and it never ran: the
interaction service scans from #wrapwrap, and this button renders outside it,
under body > .o_frontend_to_backend_nav > .o_frontend_to_backend_buttons. Core
drives this same bar from a plain frontend module for the same reason. Both
click and auxclick are bound, because a non-primary click fires the latter and
core treats the two as a pair.

The spinner is a dedicated child element rather than classes on the anchor,
and that distinction is the whole of the difference. Core renders that anchor
as both the icon and a styled flex box, so a spin class on it rotates the box
- background, padding and all - which is what it did at first. Every pending
indicator in Odoo 19 puts fa fa-circle-o-notch fa-spin on an element whose
only job is to be the spinner, and this now does the same. Measured with the
animation frozen at one angle: the old anchor's bounding box grew from 48x54
to 72x72 as the box turned; the anchor now holds 48x54, identical to an
untouched button, and only the glyph inside it moves. The tour asserts the
anchor carries no spin class, so putting one back there fails loudly instead
of passing.

Core's own dropdown markup beside the button is left exactly as core renders
it, including the ir.ui.menu lookup it performs on every frontend page. Taking
it out looked like a free win and was tried twice; core's
website_backend_menus_redirect tour opens that dropdown and clicks an entry
inside it, and the entry only exists when the lookup runs.

The de-branded title on the button is unchanged.

Tests: the click, modifier and cache-restore behaviour are covered on a real
DOM rather than by matching the text of an inline handler, which an
implementation with the transitions swapped passed just as happily. A tour
drives the button on a real rendered page and asserts both that the icon swaps
and that the button is NOT inside #wrapwrap, so if a future Odoo moves it the
guard fails loudly instead of passing for the wrong reason - a unit test cannot
make that assertion, because the test helper fabricates a #wrapwrap of its own,
which is precisely why nine green unit tests hid a feature that did not work.
Bundle guards assert the module really reaches the browser.

Also here, and separable from the behaviour: comments in this module's tests
cited source by line number. Each now names the symbol instead. One had already
rotted badly, naming a method while pointing fifteen lines above its real
definition.
                                            

Branch: 19.0

Age:

Up-time: