diff --git a/__init__.py b/__init__.py index 62012537cb5d1b42e6fffb7434dc53e5c483a938..f88059b176b68c16a1a1024c635a43d555e9229c 100755 --- a/__init__.py +++ b/__init__.py @@ -3,4 +3,5 @@ from . import controllers from . import models +from . import report from . import wizard diff --git a/__manifest__.py b/__manifest__.py index 54db846ab3ed89ec29ec6d4d43cd494a2f74f33f..3812e95977c5bdf503b8014f4553548023c1646d 100755 --- a/__manifest__.py +++ b/__manifest__.py @@ -31,6 +31,7 @@ # Views "views/account_invoice.xml", "views/res_config_settings.xml", + "views/res_partner.xml", "views/scop_cotisation_cg.xml", "views/scop_cotisation_simulation.xml", "views/scop_liasse_fiscale.xml", diff --git a/report/__init__.py b/report/__init__.py new file mode 100755 index 0000000000000000000000000000000000000000..530b04980c303e369063f0beec2f53cace402497 --- /dev/null +++ b/report/__init__.py @@ -0,0 +1,4 @@ +# © 2020 Le Filament (<http://www.le-filament.com>) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from . import scop_contribution_report diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py new file mode 100644 index 0000000000000000000000000000000000000000..5f9a450241692aa45beb14812f1f952812e732c6 --- /dev/null +++ b/report/scop_contribution_report.py @@ -0,0 +1,21 @@ +# © 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.') diff --git a/views/res_partner.xml b/views/res_partner.xml new file mode 100644 index 0000000000000000000000000000000000000000..7a94d4751c49a116253a817910b4057fa22b12d9 --- /dev/null +++ b/views/res_partner.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<odoo> + <!-- Copyright 2022 Le Filament + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> + <data> + + <record id="scop_contact_view_form" model="ir.ui.view"> + <field name="name">res.partner.scop.view.form</field> + <field name="model">res.partner</field> + <field name="inherit_id" ref="cgscop_cotisation.scop_contact_view_form"/> + <field name="arch" type="xml"> + <xpath expr="//page[@name='contribution']/field[@name='contribution_report_ids']/tree" position="inside"> + <button name="print_report_with_payment" type="object" + help="Télécharger l'état des paiements" icon="fa-file-pdf-o" + attrs="{'invisible':[('type_contribution_id','!=',%(cgscop_partner.riga_14397)d)]}"/> + </xpath> + </field> + </record> + </data> +</odoo> \ No newline at end of file