From 8d90a3f394cdaa9291a8c8f1916527c5a750ede1 Mon Sep 17 00:00:00 2001
From: jordan <jordan@le-filament.com>
Date: Tue, 8 Feb 2022 11:37:54 +0100
Subject: [PATCH] [update] report invoice and contribution deal with
 multi-modules (cg, riga, idf)

---
 report/scop_contribution_report.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py
index 18c7b37..f5b1841 100644
--- a/report/scop_contribution_report.py
+++ b/report/scop_contribution_report.py
@@ -47,3 +47,20 @@ class ScopContributionReport(models.Model):
             ).sudo().report_action(bordereau.sudo())
         else:
             raise UserError('Pas de bordereau rattaché à cette cotisation.')
+
+    # ------------------------------------------------------
+    # Business method
+    # ------------------------------------------------------
+    def get_invoice_contribution(self):
+        """
+        If cotiz is type CG, then we filtered on not canceled bordereaux
+        """
+        self.ensure_one()
+        invoice_ids = super(
+            ScopContributionReport, self).get_invoice_contribution()
+        contribution_cg = self.env.ref('cgscop_partner.riga_14397')
+        if self.type_contribution_id == contribution_cg:
+            invoice_ids = invoice_ids.filtered(
+                lambda i: i.bordereau_id.state not in ('cancel',)
+            )
+        return invoice_ids
-- 
GitLab