[FIX] web: setting compile label correctly

- Open Settings;
- In the search write : __comp__.props

Before this commit, some settings are shown. This occurs because of un
error in the compiler, where we add to the search list, the path of the
label, and not the label itself.

closes odoo/odoo#125739

X-original-commit: 2a4dc724d0d791ea52dc73b79e582c726ece21da
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2023-06-20 15:58:40 +02:00
parent d7ec92f349
commit 3b330abd15
@@ -1495,6 +1495,59 @@ QUnit.module("SettingsFormView", (hooks) => {
);
});
QUnit.test("Settings with createLabelFromField", async function (assert) {
serverData.models["res.config.settings"].fields.baz.string = "Zab";
await makeView({
type: "form",
resModel: "res.config.settings",
serverData,
arch: `
<form string="Settings" class="oe_form_configuration o_base_settings" js_class="base_settings">
<app string="CRM" name="crm">
<block title="Title of group Bar">
<setting>
<label for="baz"/>
<field name="baz"/>
</setting>
</block>
</app>
</form>`,
});
await editSearch(target, "__comp__.props.record");
await execTimeouts();
assert.deepEqual(
[...target.querySelectorAll(".o_settings_container .o_setting_box .o_form_label")].map(
(x) => x.textContent
),
[]
);
await editSearch(target, "baz");
await execTimeouts();
assert.deepEqual(
[...target.querySelectorAll(".o_settings_container .o_setting_box .o_form_label")].map(
(x) => x.textContent
),
[]
);
await editSearch(target, "zab");
await execTimeouts();
assert.strictEqual(
target.querySelector(".highlighter").textContent,
"Zab",
"Zab word highlighted"
);
assert.deepEqual(
[...target.querySelectorAll(".o_settings_container .o_setting_box .o_form_label")].map(
(x) => x.textContent
),
["Zab"]
);
});
QUnit.test("standalone field labels with string inside a settings page", async (assert) => {
let compiled = undefined;
patchWithCleanup(SettingsFormCompiler.prototype, {