Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Conocimientos
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Empresa contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Oficios
    • Handyman
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Odoo 17 How to expand attachments by default? (CUSTOM CODE)

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
attachmentodoo17CE
2 Respuestas
2351 Vistas
Avatar
Apiuser

In odoo 15 I used to do this via js via editing this:

isAttachmentBoxVisibleInitially: (
this._getFieldOption('message_ids', 'open_attachments', true) ||
this._getFieldOption('message_follower_ids', 'open_attachments', false)
),

But in odoo 17 this makes no sense. I found this in chatter.js

static defaultProps = {
compactHeight: false,
hasActivities: true,
hasFollowers: true,
hasMessageList: true,
isChatterAside: false,
hasParentReloadOnAttachmentsChanged: false,
hasParentReloadOnFollowersUpdate: false,
hasParentReloadOnMessagePosted: false,
isAttachmentBoxVisibleInitially: false,
isInFormSheetBg: true,
threadId: false,
};

But so far I've been unable to make it work, everytime i try changing the inherited js i get either a blank page with an error (bottom-left) "An error ocurred while loading javascript modules, you may find more information in the devtools console", or odoo loads as usual and the same error appears. And there is no info on the error apart from the js not loading (checked via logs and via f12 in the browser).

Has anyone this or anything similar?

0
Avatar
Descartar
Avatar
Andry Ang
Mejor respuesta

Hi Apiuser,

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,

});

1
Avatar
Descartar
Apiuser
Autor

This solution does work but didn't want to overwrite all the file. But you are right I was looking in the wrong place, I was looking in the chatter.js and needed to check form_compiler.js and overwrite function compileChatter.

Avatar
Apiuser
Autor Mejor respuesta

For anyone wondering, I finally solved it like so:

patch(FormCompiler.prototype, {
compile(node, params) {
const res = super.compile(node, params);
const chatterContainerXml = res.querySelector("t[t-component='__comp__.mailComponents.Chatter']");
if (chatterContainerXml) {
chatterContainerXml.setAttribute("isAttachmentBoxVisibleInitially", "true");
}
return res;
},
});
0
Avatar
Descartar
Andry Ang

Great that it give you a little bit of insights for your challenge.
If you don't mind, you could give an upvote to my answer or mark it as solve I guess.

Good Luck

Apiuser
Autor

Well, I wanted to mark my answer as solved, as it is what I was looking for, but apparently i can't. I upvotted yours.

Andry Ang

sure, thanks!

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
this is my travel agency and we are a travel manager
attachment
Avatar
0
nov 25
3
Odoo Community V17
odoo17CE
Avatar
Avatar
Avatar
2
jul 25
3074
Acounting and, Repporting tabs are missing to my accounting module, How to display them? Resuelto
odoo17CE
Avatar
Avatar
1
mar 25
2223
ReferenceError: ComboConfiguratorPopup is not defined
odoo17CE
Avatar
Avatar
1
dic 24
2000
how to override tools.mail.email_normalize
odoo17CE
Avatar
Avatar
1
dic 24
2559
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones empresariales de código abierto que cubre todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now