From dca292b268bf21fc8191fae980428f5983d2164b Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 17 Oct 2016 17:03:57 +0200 Subject: [PATCH] [FIX] base_action_rule: Add followers in automated actions When registering a payment on an account invoice with an automated action which adds a follower "On Creation & Update", the function recompute was triggered(due to the field residual_company_signed) and the same followers was added two times for the invoice. The fix avoid to unlink and create the same followers several times(because it was the case with the function "_add_follower_command") opw:690939 --- addons/base_action_rule/base_action_rule.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index 50456240725..1255dfb3be0 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -194,7 +194,11 @@ class base_action_rule(osv.osv): # subscribe followers if self.act_followers and hasattr(records, 'message_subscribe'): - records.message_subscribe(self.act_followers.ids) + followers = self.env['mail.followers'].sudo().search([ + ('res_model', '=', records._name), ('res_id', 'in', records.ids), + ('partner_id', 'in', self.act_followers.ids)]) + if not len(followers) == len(self.act_followers): + records.message_subscribe(self.act_followers.ids) # execute server actions if self.server_action_ids: