Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita 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
  • Proyectos
  • 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

How to send a private message from OdooBot to a user?

Suscribirse

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

Se marcó esta pregunta
developmentdiscuss
1 Responder
525 Vistas
Avatar
Alex McColm

Hello all,


I am developing an Odoo extension, and I want to send a message from OdooBot to a given partner ID in Discuss. I am attempting to send myself such a message in the Odoo python shell here, and it seems to create a record, but in my browser window with the same DB, and verifying that the partner ID and channel IDs match, I still don't see the message. It even seems to be returned in a search of message records. What is missing for the message to show up properly?


I have assumed the logs about the push notification being deleted can be ignored. I have the chat window open, so it makes sense it would delete the push notification.

>>> odoobot_id = self.env.ref("base.partner_root").id

>>> channel = self.env["discuss.channel"].with_user(1).channel_get([8])

>>> channel.name

'OdooBot, Alex McColm'

>>> channel.message_post(body='HelloWorld!', author_id=odoobot_id, message_type="comment", subtype_xmlid="mail.mt_comment")

2025-10-23 17:54:34,848 1395 WARNING Odoo_Backup_2025-10-22__19-28-55.zip odoo.addons.mail.tools.web_push: Failed push notification https://fcm.googleapis.com/fcm/send/eJ32KjmxmoI:APA91bH8xugL7jxOtyXZqSGbBEaDcW5Ra0e1DD-PWnGWIzyNIhzYytvdrxwD-AvTI93P9XzKBYp8iQt8-_dS4gGywQ5K2EhjGRanBAK41ZobvUv8kx348nrmrqEoEhh51a6x_yJM0POr 410 - push subscription has unsubscribed or expired.

2025-10-23 17:54:35,054 1395 INFO Odoo_Backup_2025-10-22__19-28-55.zip odoo.models.unlink: User #1 deleted mail.push.device records with IDs: [4, 5]

mail.message(1097,)

>>> env['mail.message'].search_read(

...     [('model','=','discuss.channel'), ('res_id','=',4)],

...     ['id','author_id','body','message_type','subtype_id'],

...     limit=5, order='id desc'

... )

[{'id': 1097, 'author_id': (2, 'OdooBot'), 'body': Markup('<p>HelloWorld!</p>'), 'message_type': 'comment', 'subtype_id': (1, 'Discussions')}, {'id': 802, 'author_id': (2, 'OdooBot'), 'body': Markup('<p>Frontdesk Check-In: [redacted] (Foreseeson Technology)</p>'), 'message_type': 'comment', 'subtype_id': (1, 'Discussions')}, {'id': 47, 'author_id': (2, 'OdooBot'), 'body': Markup('<p>Hello,<br>Odoo\'s chat helps employees collaborate efficiently. I\'m here to help you discover its features.<br><b>Try to send me an emoji</b> <span class="o_odoobot_command">:)</span></p>'), 'message_type': 'comment', 'subtype_id': (1, 'Discussions')}]

>>>

0
Avatar
Descartar
Avatar
Christoph Farnleitner
Mejor respuesta

Since your working with the odoo-bin shell:

Without committing to the database, nothing is going to be actually written to your database. Run

self.env.cr.commit()

after channel.message_post(...).

See also https://www.odoo.com/documentation/19.0/developer/reference/cli.html#shell-open-a-shell

Also, ensure you are actually a Member of the given Discuss Channel.

2
Avatar
Descartar
Alex McColm
Autor

Thank you Christoph. This is what I was missing in shell testing.

When I was using this in my extension in a function called send_private_message_as_odoobot(), I had another bug, which I'll record here in case it is useful someday. In the shell, I was passing a partner ID properly, but in the extension I was passing an hr.employee record ID.

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

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

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
How to make all branches for user active automatically after login his account?
development
Avatar
Avatar
Avatar
3
nov 25
289
MrpBom _skip_bom_line skips line of product that has two multi-choice attribute values when both are selected in Apply to variant
development
Avatar
Avatar
1
nov 25
211
How to create a new field have 2 related field by developer mode
development
Avatar
Avatar
2
oct 25
546
i face one error while edit my website
development
Avatar
0
oct 25
659
How to add market price of the product to the Odoo 18 Community POS receipt?
development
Avatar
0
oct 25
583
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • 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 de código abierto que cubren 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