diff --git a/addons/web/static/src/views/fields/field_tooltip.js b/addons/web/static/src/views/fields/field_tooltip.js index 7c673a24f2d..e17e28b438e 100644 --- a/addons/web/static/src/views/fields/field_tooltip.js +++ b/addons/web/static/src/views/fields/field_tooltip.js @@ -17,7 +17,7 @@ export function getTooltipInfo(params) { widget: params.fieldInfo.widget, widgetDescription, context: params.fieldInfo.context, - domain: params.field.domain, + domain: params.fieldInfo.domain || params.field.domain, invisible: params.fieldInfo.invisible, column_invisible: params.fieldInfo.column_invisible, readonly: params.fieldInfo.readonly, diff --git a/addons/web/static/src/views/fields/field_tooltip.xml b/addons/web/static/src/views/fields/field_tooltip.xml index f6b9f60bc63..99468981daa 100644 --- a/addons/web/static/src/views/fields/field_tooltip.xml +++ b/addons/web/static/src/views/fields/field_tooltip.xml @@ -38,21 +38,21 @@
  • Domain: - +
  • -
  • +
  • Invisible:
  • -
  • +
  • Column invisible:
  • -
  • +
  • Required:
  • -
  • +
  • Readonly:
  • diff --git a/addons/web/static/tests/views/form/form_view_tests.js b/addons/web/static/tests/views/form/form_view_tests.js index 8d11d848c51..c3141979036 100644 --- a/addons/web/static/tests/views/form/form_view_tests.js +++ b/addons/web/static/tests/views/form/form_view_tests.js @@ -10733,7 +10733,7 @@ QUnit.module("Views", (hooks) => { arch: `
    - +
    `, }); @@ -10751,6 +10751,17 @@ QUnit.module("Views", (hooks) => { "{'lang': 'en_US'}", "context should be properly stringified" ); + assert.containsOnce( + target, + ".o-tooltip--technical > li[data-item='domain']", + "domain should be present for this field" + ); + assert.strictEqual( + target.querySelector('.o-tooltip--technical > li[data-item="domain"]').lastChild + .textContent, + "[]", + "domain should be properly stringified" + ); assert.containsOnce( target, ".o-tooltip--technical > li[data-item='invisible']", @@ -10775,6 +10786,64 @@ QUnit.module("Views", (hooks) => { ); }); + QUnit.test("field tooltip in debug mode, on field with domain attr", async function (assert) { + patchWithCleanup(odoo, { debug: true }); + + patchWithCleanup(browser, { + setTimeout: (fn) => fn(), + clearTimeout: () => {}, + }); + + await makeView({ + type: "form", + resModel: "partner", + serverData, + arch: ` +
    + + + +
    `, + }); + + await mouseEnter(target.querySelector("[name='product_id']")); + await nextTick(); + assert.containsOnce(target, ".o-tooltip--technical > li[data-item='domain']"); + assert.strictEqual( + target.querySelector('.o-tooltip--technical > li[data-item="domain"]').lastChild + .textContent, + "[['id', '>', 3]]" + ); + }); + + QUnit.test("do not display unset attributes in debug field tooltip", async function (assert) { + patchWithCleanup(odoo, { debug: true }); + + patchWithCleanup(browser, { + setTimeout: (fn) => fn(), + clearTimeout: () => {}, + }); + + await makeView({ + type: "form", + resModel: "partner", + serverData, + arch: ` +
    + + + +
    `, + }); + + await mouseEnter(target.querySelector("[name='product_id']")); + await nextTick(); + assert.deepEqual( + getNodesTextContent(target.querySelectorAll(".o-tooltip--technical > li")), + ["Field:product_id", "Type:many2one", "Context:{}", "Relation:product"] + ); + }); + QUnit.test("do not change pager when discarding current record", async function (assert) { await makeView({ type: "form",