[FIX] web: list: call mounted on subcomponents at reload

Issue was spotted in list views containing the "badge" widget with
decorations (e.g. in the Purchase Order list view). At first, the
decorations were correctly applied, but they weren't anymore after
a reload (e.g. after toggling a filter).

They weren't because the list renderer didn't called
'on_attach_callback' on its subwidgets at reload (thus, 'mounted'
wasn't called on its subcomponents, and the decorations are applied
in the mounted hook).

This commit moves the logic from the FormRenderer to the
BasicRenderer, so that it applies on List, Kanban, and Form views.

This commit also removes the transition scss rule on the badge
field widget as it caused a flickering at reload.

Task 2336440

closes odoo/odoo#57766

X-original-commit: 713bce22e8f412f2c26e663b9e30fdd64933ff0c
Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Aaron Bohy
2020-09-16 05:59:27 +00:00
parent 7ab3443bc5
commit 36da1799b5
7 changed files with 47 additions and 49 deletions
@@ -7606,7 +7606,7 @@ QUnit.module('basic_fields', {
});
QUnit.test('FieldBadge component with decoration-xxx attributes', async function (assert) {
assert.expect(3);
assert.expect(6);
const list = await createView({
View: ListView,
@@ -7623,6 +7623,12 @@ QUnit.module('basic_fields', {
assert.containsOnce(list, '.o_field_badge[name="foo"].bg-danger-light');
assert.containsOnce(list, '.o_field_badge[name="foo"].bg-warning-light');
await list.reload();
assert.containsN(list, '.o_field_badge[name="foo"]', 5);
assert.containsOnce(list, '.o_field_badge[name="foo"].bg-danger-light');
assert.containsOnce(list, '.o_field_badge[name="foo"].bg-warning-light');
list.destroy();
});
});