I create method to update followers in calendar from project module. First i wanna delete all exist followers and nest add new. I have problem with "force=True" in documentation (https://www.odoo.com/documentation/10.0/reference/mixins.html) is :
force -- if True, delete existing followers before creating new one using the subtypes given in the parameters.
So i change to true but my method only add new records without delete old.
@api.multi
def update_calendar_event(self):
partner_list = []
for follower in self.project_id.message_follower_ids:
partner_list.append(follower.partner_id.id)
partner_list.append(self.create_uid.partner_id.id)
calendar_event = self.calendar_id.id
self.calendar_id.message_subscribe(partner_ids=partner_list, force=True)
self.test_field = calendar_event #debug
How to delete all exist records in calendar followers ?
Ok i use to unsubscribe exist records before add new and that fix my problem.
@api.multi
def update_calendar_event(self):
partner_list = []
calendar_partner_list = []
for follower in self.project_id.message_follower_ids:
partner_list.append(follower.partner_id.id)
partner_list.append(self.create_uid.partner_id.id)
for follower in self.calendar_id.message_follower_ids:
calendar_partner_list.append(follower.partner_id.id)
self.calendar_id.message_unsubscribe(calendar_partner_list)
self.calendar_id.message_subscribe(partner_list)
self.test_field = [calendar_partner_list, partner_list] #debug