Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

how to call email templates with a custom module

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
v8email_templateselectable
4 Antworten
14617 Ansichten
Avatar
NASHMIN YEGANEH

Hello 

I'm going to add some code to my custom module to be able to call email templates and choose related template with my module through a drop down selector list, so any body know how to start to do that?

i already made 2 template to my custom module inside email.template  and i tested with mail.compose.message module and it worked fine

i watched to some similar modules but actually they made me more confused.. so i just want to call my modules own templates with a Many2one field and nothing more no send mail or other extra task... but saving current content can be effective

the field that template should load in that is note and my custom module is res_correspond_int with ResCorrespondINT class
as i got until now i should add a line for my xml file like below 

<field name="template_id" attrs="{'readonly': [ ('state', 'not in', ['draft'])], 'required': True}"/>

and a code for calling related template (not working )

template_id = fields.Many2one(
    'email.template',
    string='Template',
    track_visibility='onchange',
    default=default_template)

@api.multi
def default_template(self):
    note = ''
    default_template_obj = self.env['email.template']
    template_id = default_template_obj.search([('model', '=', 'res.correspond.int')], limit=5)
    if template_id:
     for i in self:
        note += '\n' + i.note
        default_template_obj.note(template_id.id, self._context.get('active_id'), )
     return


0
Avatar
Verwerfen
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Beste Antwort

I am not sure exactly what you are trying to do but I think you want to show the Email Templates which are related to your model.

Try following code:

template_id = fields.Many2one(
'email.template',
string='Template',
domain=[('model', '=', 'res.correspond.int')],
track_visibility='onchange',
default=default_template)

If you wish send the email from any method, try following code:

@api.multi
def action_send_mail(self):
for rec in self:
rec.template_id.send_mail(rec.id) # Call send_mail method of the mail template obj
return True
4
Avatar
Verwerfen
Avatar
Nitin Kantak
Beste Antwort

This may help you :

# template id is nothing but xml id of that particular template
template = self.env['ir.model.data'].get_object('# object_name',template_id)

# Send out the e-mail template to the user
template_obj = self.env['mail.template'].browse(template.id)
template_obj.send_mail(# record_id)

1
Avatar
Verwerfen
Avatar
NASHMIN YEGANEH
Autor Beste Antwort

@Nitin Kantak 
Hello Nitin, Can you please tell me what do this "template" field below? coz it does not called any where in code.. it just collect data and stop


template = self.env['ir.model.data'].get_object('# object_name',template_id)


for second line i said in first that i won't send mail this template.. just want to load into "note" field inside my class and save .. so do you know any way to putting it inside a field (note) with selecting that from a Many2one drop down list?



# Send out the e-mail template to the user
template_obj = self.env['mail.template'].browse(template.id)
template_obj.send_mail(# record_id)

**********************************************************

@Sudhir Arya

\\
\\\\

Sudhir AryaSudhir AryaSudhir Arya


No, actually i just want to load email.template data inside a field named "note" thats all

0
Avatar
Verwerfen
Balvant Ramani

In that case you have to write onchange event of template_id like this

@api.onchange('template_id')

def onchange_template_id(self):

if self.template_id :

self.notes = self.env['mail.template'].render_template(self.template_id.body, 'hr.employee', self.id)

you can hr.employee with your model name.

Avatar
Hendra
Beste Antwort

Hi, I'm using odoo 10, i already installing project_issue, I want to know where can I find project issue email template.


thanks you

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Email template is failed to render ? [SOLVED] Gelöst
v8 sale.order email_template
Avatar
Avatar
Avatar
Avatar
4
Jan. 19
33086
How to feeding a field with template by selecting a drop down list
v8 dropdownlist email_template
Avatar
0
Nov. 18
5194
is it possible to use QWeb template when define a email template?
v8 qweb email_template
Avatar
Avatar
1
Sept. 16
4637
Default Outgoing server can't be recognize while using email templates in Odoo V8.
v8 email_template outgoing_server
Avatar
0
März 15
4468
How to send Partner Mass Mail to partner and parters contacts, v8. Gelöst
mail v8 emailtemplate email_template
Avatar
Avatar
Avatar
Avatar
4
Juni 18
10934
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Ausbildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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