Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

Sending emails automatically

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
emailautomatically
1 ตอบกลับ
4090 มุมมอง
อวตาร
Guilherme

Hi guys, hope you are doing well. So i have a custom model like this:


And what i want to do is, depending on the choice of the checkbox, sending the same email for that persons when you click in button "Avançar", for example, i select de "Seguradora 1" and "Seguradora 3" field, and, when i click in "Avançar", i want to send, automatically, an email with the text "testing sending an email with odoo" without the need to write that email, hope you guys can help me with some code or documentation, have a great day and appreciate your time! 

0
อวตาร
ละทิ้ง
m-azzain

You can make your model inherit from 'mail.thread' and use its message_post method to send your emails to different partners. Those selectable names in your screen shot should be partners, so you can pass their ids to the message_post.

To call the message_post you need to have an action method in your model that connect to the form button by their names.

And make sure that your partners are receiving their notification by email.

I have been trying to understand odoo email workflow, and when encountered your question I use it as an exercise, you can check what I explained above here:

https://github.com/m-azzain/mz-addons/blob/master/practice/models/email_demo.py
https://github.com/m-azzain/mz-addons/blob/master/practice/views/email_demo_views.xml

m-azzain

I can't post an answer, do you have any idea why?

Guilherme
ผู้เขียน

But I'm supposed to send an email outside of odoo, that is, odoo sends an email when I press the "Avançar" button, and that email it will be sent to the recipient's mail box as if it were a normal email, what you sent can do this?

Guilherme
ผู้เขียน

I cant even convert your comment to answer, i don't know what i do wrong....

m-azzain

Yes It can do.
It will send an email to the email address of the partners; each partner in your odoo should have an email address. but you should have an outgoing email server that handle the process from odoo to the outside.

To configure an outgoing email server, there are a lot of ways. I've tried only one which I will show you below, but I think this isn't the perfect way to do it. when you figure better ways I hope you share it here.

First you need to have an outlook email, if you don't you can create one at outlook.com
Second change the setting in your aoutlook account to 'Let Devices and Apps Use POP'. You will find the option in Settings>Mail>Sync email
then update your account on odoo by setting this outlook email as your email; so that you will use it to send emails to the others

And Here is (on odoo) how I set the outgoing email server using outlook email
To configure an outgoing email server go to Settings>General Settings>Custom Email Servers>Outgoing Email Servers
create new and fill the form as:

Authenticate with: Username
Connection Encryption: TLS (STARTTLS)
SMTP Server: smtp.office365.com
SMTP Port: 587
Username: <Your outlook email>
Password: <Your outlook email password>

leave the rest as it's

Guilherme
ผู้เขียน

Tried do to what you send me in github and keep giving me this error - > "TypeError: fields_get() takes 1 positional argument but 2 were give"

m-azzain

I think you missed the ** when you tried to call the super method
def fields_get(self, **kwargs):
result = super().fields_get(**kwargs)

m-azzain

by the way it allowed me to post an answer
It looks like, it prefer code more than text :)

m-azzain

If have find it convenient you can email me at m.alzain248@gmail.com

m-azzain

If you find it convenient you can email me at m.alzain248@gmail.com

m-azzain

hello, I am working into something and just stumbled on the same error as the one you mentioned, it is possible we are working into different versions of odoo. so I did minor change to the code, and also don't hesitate to post whatever error you may get, I already tested the code.

อวตาร
m-azzain
คำตอบที่ดีที่สุด

from odoo import api, fields, models


class EmailDemo(models.Model):
_name = 'practice.email.demo'
_inherit = ['mail.thread']
_description = "Email Demo"

res_partner_1 = fields.Boolean(string="Partner 1")
res_partner_2 = fields.Boolean(string="Partner 2")
res_partner_3 = fields.Boolean(string="Partner 3")
res_partner_4 = fields.Boolean(string="Partner 4")

@property
def receivers_selection_map(self):
# These partners are already in the system from demo data,
# You should check they exists in your system,
# Or you can replace them by others
return {'res_partner_1': self.env.ref('base.res_partner_1'),
'res_partner_2': self.env.ref('base.res_partner_2'),
'res_partner_3': self.env.ref('base.res_partner_3'),
'res_partner_4': self.env.ref('practice.practice_partner_1')}

def action_send_mail(self):
selected_partners = [p.id for k, p in self.receivers_selection_map.items() if self[k]]
self.message_post(body='Hello, From the email demo.
Email Demo body'
,
subject='email demo subject', partner_ids=selected_partners)

# To display the fields by partner names in the form
@api.model
def fields_get(self, allfields=None, attributes=None):
result = super().fields_get(allfields=allfields, attributes=attributes)
for k in self.receivers_selection_map:
result[k]['string'] = self.receivers_selection_map[k].display_name
return result

0
อวตาร
ละทิ้ง
Guilherme
ผู้เขียน

I do a copy and past so everything is equals but, i change the res_partners, i put only one to be more easier to me but give me that error, i don't understant the "res_partner" very well, and i don't know what to put in "base.res_partner_1", can you explain that two things to me pls?

m-azzain

You can consider partners as users; any user is a partner but not vice versa. Other things can be partners as addresses.
"base.res_partner_1" is an external id for a partner. It may not be in your system. You can check if it exists or not by going to Settings>Technical>Sequences & Identifiers>External Identifiers. There will be a lot of them you can filter by model name(res.partner).

About the fields_get method, it is actually from odoo.models.Model, you can go to the file odoo.models and find its exact signature and use it, mine is like this:
@api.model
def fields_get(self, allfields=None, attributes=None):

so the new demo method will be like:

@api.model
def fields_get(self, allfields=None, attributes=None):
result = super().fields_get(allfields, attributes)
for k in self.receivers_selection_map:
result[k]['string'] = self.receivers_selection_map[k].display_name
return result

m-azzain

this simple user-partner structure may be of some help:
https://github.com/m-azzain/mz-addons/blob/master/practice/data/res_user_data.xml
This is how most of the external identifiers come to exist

Guilherme
ผู้เขียน

It works, thanks a lot!
Have a nice day!

m-azzain

It's my pleasure

สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
need more felixiblity and inovation on email marketing tools
email
อวตาร
0
พ.ย. 25
151
After editing the Sales Order Confirmation email template, Odoo isn't using it.
email
อวตาร
อวตาร
1
ก.ค. 25
1976
How to remove "Powered by Odoo" in email in the Enterprise version แก้ไขแล้ว
email
อวตาร
อวตาร
อวตาร
อวตาร
อวตาร
5
พ.ค. 25
19923
Email Einstellung "Von" ist die Email vom Postausgansgserver
email
อวตาร
0
เม.ย. 25
1871
EMAIL marketing odoo 17.4+e
email
อวตาร
อวตาร
1
เม.ย. 25
2202
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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