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