You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
1.4 KiB

/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import FormRenderer from 'web.FormRenderer';
var rpc = require('web.rpc');
/**Patched FormRender for hide chatter.*/
patch(FormRenderer.prototype, "parse", {
/** The function to render the chatter once the form view is rendered.**/
_renderNode(node) {
const parsedResult = this._super.apply(this, arguments);
if (node.tag === 'div' && node.attrs.class === 'oe_chatter') {
rpc.query({
model: "ir.model",
method: "search",
args: [[["model", "=", this.state.model]]],
kwargs: { limit: 1 },
}).then((result) => {
const resModelId = result;
rpc.query({
model: "ir.config_parameter",
method: "get_param",
args: ["chatter_enable.model_ids"],
}).then((result) => {
const modelIds = JSON.parse(result);
if (modelIds){
if (modelIds.includes(resModelId[0])) {
if (this._chatterContainerTarget) {
this._chatterContainerTarget.style.display = 'none';
}
}
}
})
})
}
return parsedResult;
},
});