[FIX] web: FieldTooltip: display component description in debug

In debug, we want to see the field component description in its
tooltip. For instance, for a many2one: `Widget: Many2one (many2one)`,
`Many2one` being the `displayName` attribute of the Component, and
`many2one` the key in the registry (to use with `widget="many2one"`
in archs).

X-original-commit: 39fbb4620b5e846cd597ecbbfefdbda8bc4cb8e1
Part-of: odoo/odoo#101787
This commit is contained in:
Aaron Bohy
2022-09-30 18:42:37 +02:00
parent efad2b1a10
commit 91e7dfd63a
3 changed files with 13 additions and 7 deletions
@@ -9,7 +9,7 @@ export function getTooltipInfo(params) {
const widget = fieldRegistry.get(params.fieldInfo.widget);
widgetDescription = widget.prototype.description;
} else {
widgetDescription = params.fieldInfo.FieldComponent.description;
widgetDescription = params.fieldInfo.FieldComponent.displayName;
}
}
@@ -24,9 +24,9 @@
<li t-if="field.widget" data-item="widget">
<span class="o-tooltip--technical--title">Widget:</span>
<t t-if="field.widgetDescription" t-esc="field.widgetDescription"/>
<t t-if="field.widgetDescription"> (</t>
<t t-esc="field.widget"/>
<t t-if="field.widgetDescription">)</t>
<t t-if="field.widget">
(<t t-esc="field.widget"/>)
</t>
</li>
<li t-if="field.context" data-item="context">
<span class="o-tooltip--technical--title">Context:</span>
@@ -2881,7 +2881,13 @@ QUnit.module("Views", (hooks) => {
assert.verifySteps(["willUpdateProps", "read2", "willUpdateProps", "willUpdateProps"]);
await click(target.querySelector(".o_form_statusbar button.p"));
assert.verifySteps(["willUpdateProps", "willUpdateProps", "read3", "willUpdateProps", "willUpdateProps"]);
assert.verifySteps([
"willUpdateProps",
"willUpdateProps",
"read3",
"willUpdateProps",
"willUpdateProps",
]);
});
QUnit.test("buttons in form view, new record", async function (assert) {
@@ -9534,8 +9540,8 @@ QUnit.module("Views", (hooks) => {
"widget should be present for this field"
);
assert.strictEqual(
target.querySelector('.o-tooltip--technical > li[data-item="widget"]').textContent,
"Widget:many2one",
target.querySelector(".o-tooltip--technical > li[data-item=widget]").textContent.trim(),
"Widget:Many2one (many2one)",
"widget description should be correct"
);
});