From d76e63ad74b0c1de9841dd8b13b606e8ce281147 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Tue, 23 Feb 2021 17:07:06 +0100
Subject: [PATCH]  [update] init commit to send email from bordereau

---
 models/scop_cotisation.py | 30 ++----------------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/models/scop_cotisation.py b/models/scop_cotisation.py
index 2c1bbf2..0af48e4 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))
-- 
GitLab