OCA / web

Odoo web client UI related addons
GNU Affero General Public License v3.0
937 stars 1.89k forks source link

Web Chatter Position breaks the KB Module #2464

Open nsdadmin opened 1 year ago

nsdadmin commented 1 year ago

Module

web_chatter_position

Describe the bug

Web chatter position module can't move the collapsed chatter when user is set to force to bottom causing an error.

To Reproduce

Affected versions:

Steps to reproduce the behavior:

  1. Install Module.
  2. Set user preference to Bottom.
  3. Clear browser cache.
  4. Try to enter the KB Module.

Expected behavior Be able to open the KB Module.

Additional context

UncaughtPromiseError > OwlError
Uncaught Promise > An error occured in the owl lifecycle (see this Error's "cause" property)
OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1231:101) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1231)
    at owl.App.handleError (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2063:29) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2063)
    at Fiber._render (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1462:19) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1462)
    at Fiber.render (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1460:6) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1460)
    at ComponentNode.initiateRender (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1539:47) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1539)

Caused by: TypeError: Cannot read properties of null (reading 'append')
    at append (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:1352:105) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:1352)
    at KnowledgeFormCompiler.compile (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:14663:714) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:14663)
    at compile (patch web_chatter_position) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:1278:22) (patch web_chatter_position https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:1278)
    at useViewCompiler (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:4638:172) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:4638)
    at KnowledgeArticleFormRenderer.setup (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:3157:1376) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:3157)
    at KnowledgeArticleFormRenderer.setup (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:13299:1191) (https://portal.nsandd.com/web/assets/debug/web.assets_backend.js:13299)
    at new ComponentNode (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1534:202) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1534)
    at https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2061:6 (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2061)
    at KnowledgeArticleFormController.slot5 (eval at compile (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2026:370), <anonymous>:68:32) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:2026)
    at callSlot (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1636:25) (https://portal.nsandd.com/web/assets/debug/web.assets_common.js:1636)
liebana commented 1 year ago

Can you be more specific on "KB Module"? Enterprise? OCA?

nsdadmin commented 1 year ago

The new Knowledge Base Module. Yes, we're in Enterprise on odoo.sh

Matthew Glennon National Security & Door Corp.

Please use the following address for IT support related requests: @. On Mar 31, 2023 at 05:49 -0400, Carlos Liébana Anero @.>, wrote:

Can you be more specific on "KB Module"? Enterprise? OCA? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

BT-jmontero commented 1 year ago

The same thing happens when trying to open a Mailing (from Email Marketing).

In my case, with debug=assets set, the key JS line is this one:

Caused by: TypeError: Cannot read properties of null (reading 'append') at append (http://localhost:8069/web/assets/debug/web.assets_backend.js:18700:12) (/web/static/src/core/utils/xml.js:69) at FormCompiler.compile (http://localhost:8069/web/assets/debug/web.assets_backend.js:237642:17) (/web_chatter_position/static/src/js/web_chatter_position.esm.js:133)

In my case, L128 returns null (sadly the div with the "o_form_sheet_bg" class is not present): const formSheetBgXml = res.querySelector(".o_form_sheet_bg");

As a result, L133 fails: append(formSheetBgXml, sheetBgChatterContainerHookXml);

BT-jmontero commented 1 year ago

In my case, I made a quick test and right after L128

const formSheetBgXml = res.querySelector(".o_form_sheet_bg");

I added an if statement checking for null and only if not null, I executed everything else, and it worked (the error is gone for Mailings and the chatter is properly moved for other records).

                if (formSheetBgXml != null) {
                    const sheetBgChatterContainerHookXml =
                    chatterContainerHookXml.cloneNode(true);
                    sheetBgChatterContainerHookXml.classList.add("o-isInFormSheetBg");
                    sheetBgChatterContainerHookXml.setAttribute("t-if", true);
                    append(formSheetBgXml, sheetBgChatterContainerHookXml);
                    const sheetBgChatterContainerXml =
                        sheetBgChatterContainerHookXml.querySelector("ChatterContainer");
                    sheetBgChatterContainerXml.setAttribute("isInFormSheetBg", "true");
                    chatterContainerHookXml.setAttribute("t-if", false);
                }

FYI @liebana

ksignorini commented 1 year ago

Is there a plan to fix this bug? We are also experiencing it.

pedrobaeza commented 1 year ago

While nobody provides the fix, no.

andreampiovesana commented 1 year ago

also for me

Dg0210 commented 1 year ago

The same thing happens when trying to open a Mailing (from Email Marketing).

In my case, with debug=assets set, the key JS line is this one:

Caused by: TypeError: Cannot read properties of null (reading 'append') at append (http://localhost:8069/web/assets/debug/web.assets_backend.js:18700:12) (/web/static/src/core/utils/xml.js:69) at FormCompiler.compile (http://localhost:8069/web/assets/debug/web.assets_backend.js:237642:17) (/web_chatter_position/static/src/js/web_chatter_position.esm.js:133)

In my case, L128 returns null (sadly the div with the "o_form_sheet_bg" class is not present): const formSheetBgXml = res.querySelector(".o_form_sheet_bg");

As a result, L133 fails: append(formSheetBgXml, sheetBgChatterContainerHookXml);

i have the same issue, did u fix it?

BT-jmontero commented 1 year ago

I have proposed the following PR to fix the issue: https://github.com/OCA/web/pull/2571 Let's see if and when it is accepted

vincent-hatakeyama commented 11 months ago

The issue should be closed as the fix is merged.