Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7246 มุมมอง

there is a chatter in CRM app that tracks fields and schedule activities, and there is a button in the task which create a new project form the opportunity, 
how can I get all chatter history with me as context or anything else to the newly created record 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello Mohamed,

To do this, on your button action you would need to copy all items from the "mail.message" model where the "res_id" = opportunity_id and the "model" = "crm.lead". Duplicate these and change the "res_id" to your new project id and "model" to "project.project".

This would look something like this:

# get all messages on crm record
all_messages_crm = self.env["mail.message"].search(["&", ("res_id", "=", original_crm_object.id), ("model", "=", "crm.lead")])

# copy these messages and change the res_id and model
for crm_message in all_messages_crm:
    crm_message.copy({"model": "project.project", "res_id": new_project_object.id})

This function should work, I have not tested but the theory should be there. 

I hope this helps!

Merry Christmas! 

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

your idea is so Great i'll check it and let you know dear

คำตอบที่ดีที่สุด

i try to get all chatter but no success. pls let me know how did you do

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

all_messages_crm = self.env['mail.message'].search(

[('res_id', "=", rec.id), ('model', "=", "crm.lead"),], order='create_date asc')

Can you show detail ? I'm newbie. Thanks

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ต.ค. 22
3769
1
ก.ย. 23
5591
0
มี.ค. 15
3335
2
มี.ค. 21
4704
2
ก.ค. 20
5093