diff --git a/models/scop_cotisation.py b/models/scop_cotisation.py index 2c1bbf2df22b5bafb98a10c3b84e7d6dd5837953..0af48e4891115b08eaf504cbe687d7c002d92059 100644 --- a/models/scop_cotisation.py +++ b/models/scop_cotisation.py @@ -2,6 +2,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api +from odoo.exceptions import UserError + from datetime import date @@ -41,17 +43,6 @@ class ScopCotisation(models.AbstractModel): "Cotisations créées", compute='_compute_invoiced_member_count') - # Emails management - recipient_ids = fields.One2many( - comodel_name='res.partner', - compute='_compute_recipient' - ) - # TODO : Use when email active - # email_count = fields.Integer( - # string='Nombre de mails', - # compute='_compute_emails' - # ) - # ------------------------------------------------------ # Compute fields # ------------------------------------------------------ @@ -71,18 +62,6 @@ class ScopCotisation(models.AbstractModel): cotiz.invoiced_member_count = len( cotiz.invoice_ids.mapped('partner_id')) - @api.multi - def _compute_recipient(self): - tag_cotiz_id = self.env.user.company_id.tag_cotiz_id - for cotiz in self: - child_ids = cotiz.partner_id.child_ids.filtered( - lambda child: (tag_cotiz_id in child.category_id) and child.email - ) - if cotiz.partner_id.email: - cotiz.recipient_ids = cotiz.partner_id + child_ids - else: - cotiz.recipient_ids = child_ids - # ------------------------------------------------------ # Global functions # ------------------------------------------------------ @@ -141,8 +120,3 @@ class ScopCotisation(models.AbstractModel): ('end', '>', date(self.year, 1, 1)) ]).mapped('partner_id') return members - - # TODO : Use when email active - # Email - # def get_recipients(self): - # return ','.join(map(lambda x: str(x), self.recipient_ids.ids))