From: Magnus Hagander Date: Fri, 11 Apr 2025 08:49:09 +0000 (+0200) Subject: When deciding to put bank info on invoices, only look at active methods X-Git-Url: http://git.postgresql.org/gitweb/static/%7B%7Bpgdulink%28?a=commitdiff_plain;h=ba184020e65916407ec9aba14578c8fc475a273a;p=pgeu-system.git When deciding to put bank info on invoices, only look at active methods If a payment method that had bank info on it was added to an invoice, we would include the bank data on the PDF even if the method was not marked as active. It would still not show on the webpage of available methods, but if someone forwarded the PDF alone for payment, they would get the bank info for an inactive method. So fix that. --- diff --git a/postgresqleu/invoices/util.py b/postgresqleu/invoices/util.py index 0523fbae..9aa5dd0a 100644 --- a/postgresqleu/invoices/util.py +++ b/postgresqleu/invoices/util.py @@ -104,7 +104,7 @@ class InvoiceWrapper(object): # Include bank info on the invoice if any payment method chosen # provides it. If more than one supports it then the one with # the highest priority (=lowest sortkey) will be used. - for pm in self.invoice.allowedmethods.all(): + for pm in self.invoice.allowedmethods.filter(active=True): if pm.config and 'bankinfo' in pm.config and len(pm.config['bankinfo']) > 1: m = pm.get_implementation() if not (hasattr(m, 'available') and not m.available(self.invoice)):