Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

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

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
developmentdiscuss
1 Odpowiedz
513 Widoki
Awatar
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
Awatar
Odrzuć
Awatar
Christoph Farnleitner
Najlepsza odpowiedź

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
Awatar
Odrzuć
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.

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
How to make all branches for user active automatically after login his account?
development
Awatar
Awatar
Awatar
3
lis 25
285
MrpBom _skip_bom_line skips line of product that has two multi-choice attribute values when both are selected in Apply to variant
development
Awatar
Awatar
1
lis 25
208
How to create a new field have 2 related field by developer mode
development
Awatar
Awatar
2
paź 25
541
i face one error while edit my website
development
Awatar
0
paź 25
658
How to add market price of the product to the Odoo 18 Community POS receipt?
development
Awatar
0
paź 25
576
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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