diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py deleted file mode 100644 index 1aabfde9e3b46d7c1316deb3705779a8ac34853c..0000000000000000000000000000000000000000 --- a/report/scop_contribution_report.py +++ /dev/null @@ -1,74 +0,0 @@ -# © 2022 Le Filament (<http://www.le-filament.com>) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import fields, models - - -class ScopContributionReport(models.Model): - _inherit = "scop.contribution.report" - - source = fields.Selection( - selection_add=[("idf", "IDF")], ondelete={"idf": "cascade"} - ) - - # ------------------------------------------------------ - # Query - # ------------------------------------------------------ - def _subquery(self): - contribution_ur_id = self.env.ref("cgscop_partner.riga_14399").id - query = super(ScopContributionReport, self)._subquery() - query += ( - """ - UNION ALL ( - SELECT - 'idf' as source, - year, - %s as type_contribution_id, - partner_id, - debit AS amount_called, - debit - amount_residual AS amount_paid, - amount_residual AS amount_due - FROM - scop_cotisation_idf - WHERE - type = 'inv' - ) - """ - % contribution_ur_id - ) - return query - - # ------------------------------------------------------ - # Business functions - # ------------------------------------------------------ - def _get_payment(self): - self.ensure_one() - if self.source == "idf": - payment_ids = ( - self.env["scop.cotisation.idf"] - .sudo() - .search( - [ - ("year", "=", self.year), - ("partner_id", "=", self.partner_id.id), - ("type", "!=", "inv"), - ] - ) - ) - if payment_ids: - payments = payment_ids.mapped( - lambda p: { - "date": p.writing_date, - "name": p.name, - "ref": p.acc_doc, - "credit": p.credit, - } - ) - payments_html = self._get_html_table(payments) - else: - payments_html = ( - "<p>Il n'y a pas de paiements associés à cette cotisation</p>" - ) - return payments_html - else: - return super(ScopContributionReport, self)._get_payment()