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

​hi,

platform odoo 16 enterprise
Could you help my in ph coding automate actions. I'm trying to add followers by code:

​record.message_subscribe([1911,1912])

So far i know it can't work properly because of one of modules, which prevent adding any followers automaticaly by demanding : self._context.get('pushed_follow_button'):

​class MailThread(models.AbstractModel):

"""Extend to disable auto followers."""


_inherit = 'mail.thread'


def message_subscribe(self, partner_ids=None, subtype_ids=None):

​if self._context.get('pushed_follow_button'):

​return super(MailThread, self).message_subscribe(partner_ids=partner_ids, subtype_ids=subtype_ids)

​return True

how to pass context in phyton code automate acions, could you kindly help my to solve my problem?


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

Thank you for an answer. Unfortunately it didn't follow any of User. The followers id numbers are exported from CRM lines, so it shouldn't be a problem. Do you have any other idea why it didn't work?

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

Hi,

You can modify your code as follows:

​record.with_context(pushed_follow_button=True).message_subscribe([1911,1912])

Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.พ. 21
4427
3
มิ.ย. 20
5102
0
มิ.ย. 20
2678
0
ก.พ. 16
3785
automated actions - store code in files แก้ไขแล้ว
2
ก.ค. 18
8154