From 83dd765802e4c820622ad0f5bd495b0adcb0cff6 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Mon, 4 Apr 2022 11:25:14 +0200 Subject: [PATCH] [update] payment display --- migration/14.0.1.0.0/pre-migration.py | 1 + report/scop_contribution_report.py | 30 +++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/migration/14.0.1.0.0/pre-migration.py b/migration/14.0.1.0.0/pre-migration.py index e029ec3..b934a5d 100644 --- a/migration/14.0.1.0.0/pre-migration.py +++ b/migration/14.0.1.0.0/pre-migration.py @@ -7,6 +7,7 @@ column_renames = { "scop_cotisation": [("year", None)], } +# TODO: migrer lf_note_ref dans ref @openupgrade.migrate() def migrate(env, version): diff --git a/report/scop_contribution_report.py b/report/scop_contribution_report.py index ab23b67..0601eb5 100644 --- a/report/scop_contribution_report.py +++ b/report/scop_contribution_report.py @@ -198,8 +198,7 @@ class ScopContributionReport(models.Model): payments_html = False if self.source == "odoo": invoice_ids = self.get_invoice_contribution() - # TODO: trouver le nouveau champ payment_move_line_ids - payment_ids = invoice_ids.mapped("payment_move_line_ids") + payment_ids = invoice_ids.mapped("move_line_payment_ids") if payment_ids: payments = payment_ids.mapped( lambda p: { @@ -230,19 +229,7 @@ class ScopContributionReport(models.Model): self.env["account.move"] .sudo() .search( - [ - ("year", "=", int(self.year)), - ("partner_id", "=", self.partner_id.id), - ( - "type_contribution_id", - "=", - self.type_contribution_id.id, - ), - ("type", "=", "out_invoice"), - "|", - ("bordereau_id.state", "not in", ("cancel",)), - ("bordereau_id", "=", False), - ] + self._get_contribution_domain() ) ) return invoice_ids @@ -281,3 +268,16 @@ class ScopContributionReport(models.Model): end_html = "</tbody></table>" return start_html + content_html + end_html + + def _get_contribution_domain(self): + return [ + ("year", "=", int(self.year)), + ("partner_id", "=", self.partner_id.id), + ( + "type_contribution_id", + "=", + self.type_contribution_id.id, + ), + ("move_type", "=", "out_invoice"), + ("state", "=", "posted"), + ] -- GitLab