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

[Meeting]How to not send email to attendees?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
meeting
1 Odpowiedz
8560 Widoki
Awatar
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
Awatar
Odrzuć
Franklin

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

Awatar
Bonnet Denis
Autor Najlepsza odpowiedź

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

0
Awatar
Odrzuć
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ść
Big problem with the calendar
meeting
Awatar
0
lis 23
1595
Send meeting request to group
meeting
Awatar
0
mar 15
3761
#Meeting Scheduling
meeting scheduling
Awatar
Awatar
Awatar
2
maj 23
4351
How can i setup ICE servers? Rozwiązane
meeting discuss
Awatar
1
gru 24
8452
meeting analysis
meeting analysis
Awatar
0
cze 16
3338
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