Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    Real Estate
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    Consulting
    • Accounting Firm
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • Solar Energy Systems
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    Others
    • 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
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

add followers automatically

ติดตาม

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

คำถามนี้ถูกตั้งค่าสถานะ
followermailopenerp
8 ตอบกลับ
38691 มุมมอง
อวตาร
sayed fathy

Hello in crm.lead the responsible user (user_id) is automatically added as follower to the new task. How can I add this functionality to add some users to my custom object?

5
อวตาร
ละทิ้ง
Gopakumar N G

Write to the message_follower_ids field.

sayed fathy
ผู้เขียน

Please, can you explain more!

Matteo Boscolo

You can overwrite the create function and inject the ids on the message_follower_ids

sayed fathy
ผู้เขียน

it returns false

Aldennis

In your custom module, add a field like this: 'user_id': fields.many2one('res.users', 'Anyname', select=True, track_visibility='onchange'), Then create a record and click Save. The user you specified in user_id field will automatically added on the list of followers

sayed fathy
ผู้เขียน

What if i want to add follower not user_id field or the parent of the user_id field

อวตาร
Ray Carnes
คำตอบที่ดีที่สุด

To expand on David's answer, I needed to add the Customer as a follower on a LEAD in v10.

I created an Automated Action that looked for crm.lead records created or updated that also had either a Customer or Email populated.

If the record had a Customer, I needed to just add that Customer as a follower (as long as it wasn't already).

If the record had an Email, I needed to check if a Customer already existed, and if not - create them.

This is the code I used for the Server Action:

if record.partner_id: 
partner = record.partner_id
else:
partner = env['res.partner'].search([('email','=',record.email_from)])
if not partner:
reg = {
'name': record.contact_name or record.email_from,
'email': record.email_from,
'type': 'contact',
}
partner = env['res.partner'].create(reg)
partner_id = partner.id
reg = {
'res_id': record.id,
'res_model': 'crm.lead',
'partner_id': partner_id,
}
if not env['mail.followers'].search([('res_id','=',record.id),('res_model','=','crm.lead'),('partner_id','=',partner_id)]):
follower_id = env['mail.followers'].create(reg)
5
อวตาร
ละทิ้ง
Brandon Lackey

This code works in v16. However, I have to manually add them to "Discussions" to be able to use the "Send message" function in chatter. Is there a way to modify this code to be able to do that with the automation?

Ray Carnes (ray)

You need to specify the Discussions Subtype when creating the mail.follower record on the last line. To do this add the subtype to the reg dictionary being used - the one containing the res_id field (not the first one being used to create the partner). Add a new line: 'subtype_ids': [env.ref('mail.mt_comment').id]

อวตาร
David Todd
คำตอบที่ดีที่สุด

You've probably either already found your answer, or don't need it anymore, but I found myself having the same need to automatically add specific followers on my module written for Odoo v9. Here's my approach for the future people who have a similar question.

Preface: In my module, we do use the mail.message widget on our forms, but we use it as an automatic change tracker for auditing purposes. This allows us to see every change that was made to a form between saves, and which user made these changes. In the module I'm currently making, we want to be able to add specific people as followers when the form is in a specific stage.

First things first, we need a list of users that will become followers depending on the stage. Rather than hardcode them (we have a high turnover rate and it would introduce unnecessary updates), I'm creating a model called stage_followers that only users of the admin group can create/write/unlink. Normal users have only read access to that model.

First my model.py. On your actual form model, make sure you also have a stage selection field that is exactly the same. This will be used later in the write override

from openerp import models, fields
class stage_followers(models.Model):
_name = 'mymodule.stage_followers'
user = fields.Many2one('res.partner', required=True, domain=[('parent_id.name', '=', 'MyCompany')], string='User')
stage = fields.Selection(selection=yourStages, default='initial', string='Stage')

Next, my views.xml

<record model="ir.ui.view" id="mymodule.settings_sfollowers_form">
<field name="name">mymodule.settings_sfollowers.form</field>
<field name="model">mymodule.stage_followers</field>
<field name="arch" type="xml">
<form>
<field name="user" />
<field name="stage" />
</form>
</field>
</record>
<record model="ir.ui.view" id="mymodule.settings_sfollowers_list">
<field name="name">mymodule.settings_sfollowers.list</field>
<field name="model">mymodule.stage_followers</field>
<field name="arch" type="xml">
<tree>
<field name="user" />
<field name="stage" />
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="mymodule.action_view_sfollowers_settings">
<field name="name">MyModule Settings - Stage Followers</field>
<field name="res_model">mymodule.stage_followers</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Stage Followers" groups="mymodule.group_mymodule_admin" id="mymodule.menu_settings_sfollowers" parent="mymodule.menu_settings" action="mymodule.action_view_sfollowers_settings" />

Whew, now that's out of the way, we can get into the nitty gritty. I wrote a method that lives inside the write override, it looks something like this.

def add_follower_id(self, res_id, model, partner_id):
follower_id = False
reg = {
'res_id': res_id,
'res_model': model,
'partner_id': partner_id
}
try:
follower_id = self.env['mail.followers'].create(reg)
except:
# This partner is already following this record
return False
return follower_id

The above should be fairly self explanatory. I've also written a method that will remove followers from specific records

def remove_follower_id(self, res_id, model, partner_id):
env = self.env['mail.followers']
domain = [('partner_id', '=', partner_id), ('res_id', '=', res_id), ('res_model', '=', model)]
try:
env.search(domain).unlink()
return True
except:
# The record was either not found, or the unlink operation was not allowed by the current user
return False

Now I mentioned a write override, I'll provide a small sample of what mine looks like. This is on whatever form you want to add the followers to.

@api.multi
def write(self, vals):
res = super(mymodule, self).write(vals) # Save the form
stage_followers = self.env['mymodule.stage_followers'].search([('stage', '=', vals['state'])])
for i in stage_followers:
add_follower_id(self, self.id, 'mymodule.myform', i['user'])
# Message posting is optional. Add_follower_id will still make the partner follow the record
messages = "Whatever you want to put in the message box."
if messages:
self.message_post(body=messages, partner_ids=self.message_follower_ids)
return res

Removing followers is the same as adding them above, except you might want to do the inverse of the search ( "!=" instead of "=" )

And that's basically it. Tweak this to your needs and it should do what you need. It sure does what I needed it to do.

1
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

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

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Disable Followers แก้ไขแล้ว
follower mail
อวตาร
อวตาร
1
ก.ค. 24
12993
Copy paste multiple email id in recipients form in invite follower
follower mail
อวตาร
0
ก.พ. 20
3378
How to disable auto-add followers in discussion groups - copy solution from mail_thread.py?
follower mail odoo8.0
อวตาร
อวตาร
อวตาร
2
มี.ค. 16
10377
Where is the function that send notification when their are some object's activity?
development follower mail
อวตาร
1
มี.ค. 15
6839
Add followers and send email automatically (Odoo 14.0)
follower mail crm crm.lead
อวตาร
0
มิ.ย. 22
3603
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • 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