İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

how to send message(not email) programatically that can be seen by all /some users

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
programaticallymail.message
4 Cevaplar
38293 Görünümler
Avatar
raiye hailu

I am trying to programmatically post a message (not email). But I don't know how. The message for example can show up in the discussion app , #generals channel. I searched the internet but all I get it is how to send email messages to users using the mail.thread object.

in other words how to accomplish the following using python code

<record model="mail.message" id="module_install_notification">
<field name="model">mail.channel</field>
<field name="res_id" ref="mail.channel_all_employees"/>
<field name="message_type">notification</field>
<field name="subtype_id" ref="mail.mt_comment"/>
<field name="subject">Project Management application installed!</field>
<field name="body"><![CDATA[<p>Manage multi-level projects and tasks. You can delegate tasks, track task work, and review your planning.</p>
<p>You can manage todo lists on tasks by installing the <i>Todo Lists</i> application, supporting the Getting Things Done (GTD) methodology.</p>
<p>You can also manage issues/bugs in projects by installing the "Issue Tracker" application.</p>]]></field>
</record>

The above xml code posts the "body" to the #general channel of the Discuss app.

I am using odoo v9.

1
Avatar
Vazgeç
Avatar
Muhammad Younis
En İyi Yanıt

Hello,

First of all, create a channel for a group of users. For example, I want to create for accountant group like this:


Accountant

Message Notifications.

then create a record in mail.message model like this:

def action_send_notification(self):
    self.env['mail.message'].create({
'email_from': self.env.user.partner_id.email, # add the sender email
'author_id': self.env.user.partner_id.id, # add the creator id
'model': 'mail.channel', # model should be mail.channel
'type': 'comment',
'subtype_id': self.env.ref('mail.mt_comment').id, Leave this as it is
'body': "Body of the message", # here add the message body
'channel_ids': [(4, self.env.ref('module_name.channel_accountant_group').id)], # This is the channel where you want to send the message and all the users of this channel will receive message
'res_id': self.env.ref('modulename.channel_accountant_group').id, # here add the channel you created.
})

This code will help you to understand and send messages (not email) programmatically).

Thank You.

6
Avatar
Vazgeç
Avatar
raiye hailu
Üretici En İyi Yanıt

For now I have figured out a way to send messages to followers of a record when a field's value is changed.

Suppose I have a field x.

x=fields.Integer('a var', track_visibility='onchange')
    the track_visibility attribute tells odoo to log any change of x , either from a form view or by a function. The log is posted as an internal note. For this to happen your class must inhert mail.thread and use appropriate widget in the definition of the form view. For that check out  https://www.odoo.com/documentation/10.0/reference/mixins.html


    The internal log note taken by the track_visibility option can be sent as a message to users following the record. On the left of the open chatter you can see that there is a button to add followers for the record. There is also a button which says 'following'. Clicking it gives a list of options with check marks for each. Followers of the record will get messages corresponding to the events represented by each choice in the list. We will first have to add a choice to this list. A choice that corresponds to change of value of x. It is called message sub type.
    In the xml file where you define your form,list...views put the following.
    <record id="mt_x_value_changed" model="mail.message.subtype">
    <field name="name">The value of x changed</field>
    <field name="res_model">modelname</field>
    <field name="default" eval="True"/>
    <field name="description">The value of x changed</field>
    </record>
     Then in your module python file override the _track_subtype(init_values) method. init_values contains a dictionary of changed fields and their previous values. self.x is the current x value. If the option 'The value of x changed' is checked, when x is changed the followers of the record will get a message saying the 'The value of x changed'. In this case it  only when x is < 5 the message is sent.



    def _track_subtype(self,init_values):
    self.ensure_one()
    if (('x' in init_values) and (self.x <= 5)):

    return 'module_name.mt_x_value_changed'
    return super(class_name,self)._track_subtype(init_values)
    1
    Avatar
    Vazgeç
    Avatar
    Jainesh Shah(Aktiv Software)
    En İyi Yanıt

    Hi raiye hailu,

    To post a message that can seen by specific recipients,you can simply write below python code into your model:

     partner_ids = self.env['res.partner'].search(search_domain).ids

     # search domain to filter specific partners

     self.message_post(subject=subject,body=body,partner_ids=[(4, [partner_ids])])

     Hope this will helpful to you!

    Thanks!

    0
    Avatar
    Vazgeç
    raiye hailu
    Üretici

    Thank you Jainesh for the answer. But it did not work. Even if it did, I think your code sends email message to partners using the email address input when the partners were created. I don't want to send email messages. I want to send a message to a user of odoo(or post a message to a channel).

    I expect the solution to contain references to res.users not res.partner(or contain a reference a channel id).

    Avatar
    Obay Abdelgadir
    En İyi Yanıt

    Dude!!! you are commenting python code with //

    0
    Avatar
    Vazgeç
    Enjoying the discussion? Don't just read, join in!

    Create an account today to enjoy exclusive features and engage with our awesome community!

    Üye Ol
    İlgili Gönderiler Cevaplar Görünümler Aktivite
    Invite new users
    mail.message
    Avatar
    Avatar
    Avatar
    Avatar
    4
    Oca 24
    14397
    Displaying an attachement in a mail.message programmatically
    programatically timeline mail_thread attachement mail.message
    Avatar
    0
    Ara 15
    5798
    I cannot add Field to "pos.order" in "modelo.Order"
    pos programatically
    Avatar
    Avatar
    2
    Ara 24
    3675
    Cannot create mail.message even though I have set permissions
    mail.message PERMISSION
    Avatar
    0
    Tem 24
    1908
    How to show message_type = notification in a portal chatter? Çözüldü
    chatter mail.message
    Avatar
    Avatar
    1
    Eyl 21
    7504
    Topluluk
    • Eğitim Araçları
    • Dokümantasyon
    • Forum
    Açık Kaynak
    • İndirin
    • Github
    • Runbot
    • Çeviriler
    Hizmetler
    • Odoo.sh Hosting
    • Destek
    • Sürüm Yükseltme
    • Özel Geliştirmeler
    • Eğitim
    • Muhasebeci Bulun
    • Partner Bulun
    • Partner Olun
    Hakkında
    • Şirketimiz
    • Pazarlama Gereçleri
    • İletişim
    • Kariyer
    • Etkinlikler
    • Podcast
    • Blog
    • Müşteriler
    • Hukuki • Gizlilik
    • Güvenlik
    الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

    Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

    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