Sélectionner une révision Git
scop_contribution_report.py
scop_contribution_report.py 747 o
# © 2022 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
from odoo.exceptions import UserError
class ScopContributionReport(models.Model):
_inherit = "scop.contribution.report"
def print_report_with_payment(self):
bordereau = self.env['scop.bordereau'].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)
else:
raise UserError('Pas de bordereau rattaché à cette cotisation.')