Browse Source
[IMP] disable the option to create followers that do not meet the conditions
pull/252/head
[IMP] disable the option to create followers that do not meet the conditions
pull/252/head
Enric Tobella
7 years ago
No known key found for this signature in database
GPG Key ID: 1A2546A1B7BA2451
6 changed files with 75 additions and 6 deletions
-
5mail_restrict_follower_selection/README.rst
-
4mail_restrict_follower_selection/__manifest__.py
-
1mail_restrict_follower_selection/models/__init__.py
-
24mail_restrict_follower_selection/models/mail_followers.py
-
4mail_restrict_follower_selection/models/mail_wizard_invite.py
-
43mail_restrict_follower_selection/tests/test_mail_restrict_follower_selection.py
@ -0,0 +1,24 @@ |
|||
# Copyright (C) 2018 Creu Blanca |
|||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|||
|
|||
from odoo import api, 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): |
|||
domain = self.env[ |
|||
'mail.wizard.invite' |
|||
]._mail_restrict_follower_selection_get_domain() |
|||
partners = self.env['res.partner'].search( |
|||
[('id', 'in', list(partner_data))] + |
|||
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) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue