From f45fc34110dce1156c78bdfc7c6a74749c030c0c Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 5 Oct 2022 14:12:51 +0000 Subject: [PATCH] [FIX] web: prevent scrollbar in form_nosheet Previously, in form views without a sheet (eg in wizards), there would be a scrollbar on the content. This is caused by the fact that outer groups have gutters of size 5 in desktop which creates negative margins on the row of 1.5rem which is 18px with the default size, but the nosheet form view only has 16px of padding on the sides, causing the groups to be 4 pixels too wide. This commit fixes this by adding the correct padding classes on the form view when it doesn't have a sheet. closes odoo/odoo#102357 X-original-commit: 8d7bcc8eee7a333e8e463469177a1a86f9928254 Signed-off-by: Aaron Bohy (aab) Signed-off-by: Samuel Degueldre --- addons/web/static/src/views/form/form_compiler.js | 2 ++ addons/web/static/tests/views/form/form_compiler_tests.js | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/views/form/form_compiler.js b/addons/web/static/src/views/form/form_compiler.js index eebcdba4b95..19a6a7b3ff9 100644 --- a/addons/web/static/src/views/form/form_compiler.js +++ b/addons/web/static/src/views/form/form_compiler.js @@ -235,6 +235,8 @@ export class FormCompiler extends ViewCompiler { append(form, this.compileNode(child, params)); } form.className = "o_form_nosheet"; + // Compensate for negative margins introduced by gutters on OuterGroups (avoids overflow) + form.className += " p-2 px-lg-5"; } else { let compiledList = []; for (const child of el.childNodes) { diff --git a/addons/web/static/tests/views/form/form_compiler_tests.js b/addons/web/static/tests/views/form/form_compiler_tests.js index ee5fe8a603d..4c66a61ec04 100644 --- a/addons/web/static/tests/views/form/form_compiler_tests.js +++ b/addons/web/static/tests/views/form/form_compiler_tests.js @@ -38,7 +38,7 @@ QUnit.module("Form Compiler", (hooks) => { const arch = /*xml*/ `
lol
`; const expected = /*xml*/ ` -
+
lol
`; @@ -52,7 +52,7 @@ QUnit.module("Form Compiler", (hooks) => { const arch = /*xml*/ `