diff --git a/mail_restrict_follower_selection/__manifest__.py b/mail_restrict_follower_selection/__manifest__.py index bfeb8bf..cba1fe6 100644 --- a/mail_restrict_follower_selection/__manifest__.py +++ b/mail_restrict_follower_selection/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Restrict follower selection", - "version": "11.0.2.0.0", + "version": "12.0.1.0.0", "author": "Therp BV,Creu Blanca,Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Social Network", @@ -16,10 +16,5 @@ "data/ir_config_parameter.xml", "data/ir_actions.xml", ], - "auto_install": False, 'installable': True, - "application": False, - "external_dependencies": { - 'python': [], - }, } diff --git a/mail_restrict_follower_selection/models/mail_followers.py b/mail_restrict_follower_selection/models/mail_followers.py index 15e906e..c096f1f 100644 --- a/mail_restrict_follower_selection/models/mail_followers.py +++ b/mail_restrict_follower_selection/models/mail_followers.py @@ -1,24 +1,31 @@ # Copyright (C) 2018 Creu Blanca # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, models +from odoo import models from odoo.tools.safe_eval import safe_eval class MailFollowers(models.Model): _inherit = 'mail.followers' - @api.model - def _add_follower_command(self, res_model, res_ids, partner_data, - channel_data, force=True): + def _add_followers(self, res_model, res_ids, partner_ids, partner_subtypes, + channel_ids, channel_subtypes, + check_existing=False, existing_policy='skip'): domain = self.env[ 'mail.wizard.invite' ]._mail_restrict_follower_selection_get_domain() partners = self.env['res.partner'].search( - [('id', 'in', list(partner_data))] + + [('id', 'in', partner_ids)] + safe_eval(domain) ) - return super()._add_follower_command( - res_model, res_ids, - {p.id: partner_data[p.id] for p in partners}, - channel_data, force=force) + _res_ids = res_ids.copy() or [0] + new, update = super()._add_followers( + res_model, res_ids, partners.ids, partner_subtypes, channel_ids, + channel_subtypes, check_existing=check_existing, + existing_policy=existing_policy + ) + + for res_id in _res_ids: + if res_id not in new: + new.setdefault(res_id, list()) + return new, update diff --git a/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py index 4bf6410..4eb0bb1 100644 --- a/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py +++ b/mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py @@ -36,7 +36,7 @@ class TestMailRestrictFollowerSelection(TransactionCase): 'partner_ids': [(4, id) for id in self.partner.ids], }) self.assertEqual(compose.partner_ids, self.partner) - compose.send_mail_action() + compose.action_send_mail() def test_followers_meet(self): self.partner.write({'customer': True})