diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py index 18c7b3727b0f630fab1f6b4482868061dd1f0fe6..f5b1841402e24a6f7c230083a9ccafa2fdf69121 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