İç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

[Meeting]How to not send email to attendees?

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
meeting
1 Cevapla
8592 Görünümler
Avatar
Bonnet Denis

If I set a meeting with 2 attendees who are some OpenERP users they receive 2 mails:

  • One at the meeting creation
  • A second when an invitation is validate

this validation create a new meeting with the same attendees and send email to them, again.

How to prevent this second email?

regards

edit: I try this:

class calendar_attendee(osv.osv):
_name = 'calendar.attendee'
_inherit = 'calendar.attendee'

def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
    """
    Send mail for event invitation to event attendees.
    @param email_from: email address for user sending the mail
    @return: True
    """
    company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name
    for att in self.browse(cr, uid, ids, context=context):
        sign = att.sent_by_uid and att.sent_by_uid.signature or ''
        sign = '<br>'.join(sign and sign.split('\n') or [])
        res_obj = att.ref
        if res_obj:
            att_infos = []
            sub = res_obj.name
            other_invitation_ids = self.search(cr, uid, [('ref', '=', res_obj._name + ',' + str(res_obj.id))])
            for att2 in self.browse(cr, uid, other_invitation_ids):
                att_infos.append(((att2.user_id and att2.user_id.name) or \
                             (att2.partner_id and att2.partner_id.name) or \
                                att2.email) + ' - Status: ' + att2.state.title())
            #dates and times are gonna be expressed in `tz` time (local timezone of the `uid`)
            tz = context.get('tz', pytz.timezone('UTC'))
            #res_obj.date and res_obj.date_deadline are in UTC in database so we use context_timestamp() to transform them in the `tz` timezone
            date_start = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context)
            date_stop = False
            if res_obj.date_deadline:
                date_stop = fields.datetime.context_timestamp(cr, uid, datetime.strptime(res_obj.date_deadline, tools.DEFAULT_SERVER_DATETIME_FORMAT), context=context)
            body_vals = {'name': res_obj.name,
                        'start_date': date_start,
                        'end_date': date_stop,
                        'timezone': tz,
                        'description': res_obj.description or '-',
                        'location': res_obj.location or '-',
                        'attendees': '<br>'.join(att_infos),
                        'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User',
                        'sign': sign,
                        'company': company
            }
            body = html_invitation2 % body_vals
            if mail_to and email_from:
                ics_file = self.get_ics_file(cr, uid, res_obj, context=context)
                vals = {'email_from': email_from,
                        'email_to': mail_to,
                        'state': 'outgoing',
                        'subject': sub,
                        'body_html': body,
                        'auto_delete': True}
                if ics_file:
                    vals['attachment_ids'] = [(0,0,{'name': 'invitation.ics',
                                                    'datas_fname': 'invitation.ics',
                                                    'datas': str(ics_file).encode('base64')})]
                self.pool.get('mail.mail').create(cr, uid, vals, context=context)
        return True
def do_accept(self, cr, uid, ids, context=None, *args):
    """
    Update state of invitation as Accepted and if the invited user is other
    then event user it will make a copy of this event for invited user.
    @param cr: the current row, from the database cursor
    @param uid: the current user's ID for security checks
    @param ids: list of calendar attendee's IDs
    @param context: a standard dictionary for contextual values
    @return: True
    """
    if context is None:
        context = {}

    for vals in self.browse(cr, uid, ids, context=context):
        if vals.ref and vals.ref.user_id:
            mod_obj = self.pool.get(vals.ref._name)
            res=mod_obj.read(cr,uid,[vals.ref.id],['duration','class'],context)
            defaults = {'user_id': vals.user_id.id, 'organizer_id': vals.ref.user_id.id,'duration':res[0]['duration'],'class':res[0]['class']}
            if 'already_send' not in context :
                _logger.debug('               pas encore     ')
                context['already_send']=True
                mod_obj.copy(cr, uid, vals.ref.id, default=defaults, context=context)
                del context['already_send']
            else:
                _logger.debug('               oui     ')
        self.write(cr, uid, vals.id, {'state': 'accepted'}, context)

    return True
class crm_meeting(osv.osv):
    _name='crm.meeting'
    _inherit = 'crm.meeting'
def create_attendees(self, cr, uid, ids, context):
        #définition du context
        context = context or {}
        att_obj = self.pool.get('calendar.attendee')
        user_obj = self.pool.get('res.users')
        current_user = user_obj.browse(cr, uid, uid, context=context)
        for event in self.browse(cr, uid, ids, context):
            attendees = {}
            for att in event.attendee_ids:
                attendees[att.partner_id.id] = True
            new_attendees = []
            mail_to = ""
            for partner in event.partner_ids:
                if partner.id in attendees:
                    continue
                att_id = self.pool.get('calendar.attendee').create(cr, uid, {
                    'partner_id': partner.id,
                    'user_id': partner.user_ids and partner.user_ids[0].id or False,
                    'ref': self._name+','+str(event.id),
                    'email': partner.email
                }, context=context)
                if partner.email:
                    mail_to = mail_to + " " + partner.email
                self.write(cr, uid, [event.id], {
                    'attendee_ids': [(4, att_id)]
                }, context=context)
                new_attendees.append(att_id)

            if mail_to and current_user.email and 'already_send' not in context:
                att_obj._send_mail(cr, uid, new_attendees, mail_to,
                    email_from = current_user.email, context=context)
            att_obj.do_accept(cr, uid, new_attendees, context=context)
        return True

And it's working.

2
Avatar
Vazgeç
Franklin

File: <openerp_home>/addons/base_calendar/base_calendar.py

Avatar
Bonnet Denis
Üretici En İyi Yanıt

I found the solution by myself. See question edit for the code.

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
Big problem with the calendar
meeting
Avatar
0
Kas 23
1621
Send meeting request to group
meeting
Avatar
0
Mar 15
3775
#Meeting Scheduling
meeting scheduling
Avatar
Avatar
Avatar
2
May 23
4387
How can i setup ICE servers? Çözüldü
meeting discuss
Avatar
1
Ara 24
8482
meeting analysis
meeting analysis
Avatar
0
Haz 16
3352
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