From 7e75e01d8db8efffc04b92a621c33fd56dd74e6b Mon Sep 17 00:00:00 2001 From: Jan Suhr Date: Thu, 30 Apr 2026 15:04:16 +0200 Subject: [PATCH] fix checkout of payment_bitcoin --- payment_bitcoin/models/payment_provider.py | 14 ++++++++++++++ payment_bitcoin/models/payment_transaction.py | 6 +++--- .../views/payment_bitcoin_templates.xml | 14 +++++++------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/payment_bitcoin/models/payment_provider.py b/payment_bitcoin/models/payment_provider.py index 61dda87a..a21da3fc 100644 --- a/payment_bitcoin/models/payment_provider.py +++ b/payment_bitcoin/models/payment_provider.py @@ -18,6 +18,20 @@ class BitcoinPaymentProvider(models.Model): ) bitcoin_send_email = fields.Boolean(default=False) + def _get_redirect_form_view(self, is_validation=False): + """Override to always return the bitcoin redirect form view. + + The base implementation simply returns self.redirect_form_view_id, which + may not be set on existing installations because the provider data record + is wrapped in noupdate="1" and the field was added later. By returning + the view via env.ref() we make the redirect flow work regardless of + whether the database field has been populated. + """ + self.ensure_one() + if self.code != "bitcoin": + return super()._get_redirect_form_view(is_validation=is_validation) + return self.env.ref("payment_bitcoin.bitcoin_form") + def _get_default_payment_method_id(self): self.ensure_one() if self.provider == "bitcoin": diff --git a/payment_bitcoin/models/payment_transaction.py b/payment_bitcoin/models/payment_transaction.py index e06ce411..ec677835 100644 --- a/payment_bitcoin/models/payment_transaction.py +++ b/payment_bitcoin/models/payment_transaction.py @@ -147,10 +147,10 @@ def _get_specific_rendering_values(self, processing_values): if self.provider_code != "bitcoin": return res - self.provider_id.get_base_url() + # Only return the values actually used by the bitcoin_form template. + # The /payment/bitcoin/feedback controller resolves the transaction via + # `reference` alone, so no other fields are required in the POST body. return { - "currency_code": self.currency_id.name, "return_url": BitcoinController.accept_url, "reference": self.reference, - "tx_url": "/shop/payment/validate", } diff --git a/payment_bitcoin/views/payment_bitcoin_templates.xml b/payment_bitcoin/views/payment_bitcoin_templates.xml index 94746ead..cb54a375 100644 --- a/payment_bitcoin/views/payment_bitcoin_templates.xml +++ b/payment_bitcoin/views/payment_bitcoin_templates.xml @@ -1,14 +1,14 @@