From 20c6e067d00f98eb7a1ec648278b160f8bac696c Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Fri, 28 Jan 2022 12:06:46 +0100
Subject: [PATCH] [FIX] error access rights

---
 report/scop_contribution_report.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py
index d4c0fa3..18c7b37 100644
--- a/report/scop_contribution_report.py
+++ b/report/scop_contribution_report.py
@@ -20,7 +20,7 @@ class ScopContributionReport(models.Model):
             # exclude contribution before 2021 from RIGA
             if contribution.year > '2020':
                 if contribution.type_contribution_id == contrib_cg:
-                    bordereau = self.env['scop.bordereau'].search([
+                    bordereau = self.env['scop.bordereau'].sudo().search([
                         ('partner_id', '=', self.partner_id.id),
                         ('year', '=', self.year),
                     ])
@@ -37,13 +37,13 @@ class ScopContributionReport(models.Model):
     # Button
     # ------------------------------------------------------
     def print_report_with_payment(self):
-        bordereau = self.env['scop.bordereau'].search([
+        bordereau = self.env['scop.bordereau'].sudo().search([
             ('partner_id', '=', self.partner_id.id),
             ('year', '=', self.year),
         ])
         if len(bordereau) == 1:
             return self.env.ref(
                 'cgscop_cotisation_cg.cgscop_bordereau_report_with_payments'
-            ).report_action(bordereau)
+            ).sudo().report_action(bordereau.sudo())
         else:
             raise UserError('Pas de bordereau rattaché à cette cotisation.')
-- 
GitLab