Would you like to test snippet from me? I tried to replace the default compileChatter function and it works. Maybe you can try with other inheritance that you can do, but this also works. Might not be the best solution, but hopefully it helps.
/* @odoo-module */
import { registry } from "@web/core/registry";
import { evaluateExpr } from "@web/core/py_js/py";
import { append, createElement, setAttributes } from "@web/core/utils/xml";
// rewrite the default compileChatter function to set isAttachmentBoxVisibleInitially to true
function compileChatterOpenAttachments(node, params) {
let hasActivities = false;
let hasFollowers = false;
let hasMessageList = false;
let hasParentReloadOnAttachmentsChanged;
let hasParentReloadOnFollowersUpdate = false;
let hasParentReloadOnMessagePosted = false;
let isAttachmentBoxVisibleInitially = true; // here we change the initial value
for (const childNode of node.children) {
const options = evaluateExpr(childNode.getAttribute("options") || "{}");
switch (childNode.getAttribute("name")) {
case "activity_ids":
hasActivities = true;
break;
case "message_follower_ids":
hasFollowers = true;
hasParentReloadOnFollowersUpdate = Boolean(options["post_refresh"]);
isAttachmentBoxVisibleInitially =
isAttachmentBoxVisibleInitially || Boolean(options["open_attachments"]);
break;
case "message_ids":
hasMessageList = true;
hasParentReloadOnAttachmentsChanged = options["post_refresh"] === "always";
hasParentReloadOnMessagePosted = Boolean(options["post_refresh"]);
isAttachmentBoxVisibleInitially =
isAttachmentBoxVisibleInitially || Boolean(options["open_attachments"]);
break;
}
}
const chatterContainerXml = createElement("t");
setAttributes(chatterContainerXml, {
"t-component": "__comp__.mailComponents.Chatter",
hasActivities,
hasFollowers,
hasMessageList,
hasParentReloadOnAttachmentsChanged,
hasParentReloadOnFollowersUpdate,
hasParentReloadOnMessagePosted,
isAttachmentBoxVisibleInitially,
threadId: "__comp__.props.record.resId or undefined",
threadModel: "__comp__.props.record.resModel",
webRecord: "__comp__.props.record",
saveRecord: "() => __comp__.save and __comp__.save()",
});
const chatterContainerHookXml = createElement("div");
chatterContainerHookXml.classList.add("o-mail-ChatterContainer", "o-mail-Form-chatter");
append(chatterContainerHookXml, chatterContainerXml);
return chatterContainerHookXml;
}
// remove the default chatter_compiler from the registry and add the new one
registry.category("form_compilers").remove("chatter_compiler",)
registry.category("form_compilers").add("chatter_compiler", {
selector: "div.oe_chatter",
fn: compileChatterOpenAttachments,
});