[FIX] payment_hyperpay_tokenization, donation_request: unbound request error

This commit is contained in:
Abdurrahman Saber 2026-01-08 14:32:24 +04:00
parent 50f64185ad
commit 34274cd6ac
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
from odoo import models, fields, api, _ from odoo import models, fields, api, _
from odoo.exceptions import ValidationError,UserError from odoo.exceptions import ValidationError,UserError
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
import traceback
class DonationRecurring(models.Model): class DonationRecurring(models.Model):
@ -311,8 +312,8 @@ class DonationRecurring(models.Model):
date_ref = fields.Date.context_today(self) date_ref = fields.Date.context_today(self)
domain = self._get_donations_to_process_domain(date_ref) domain = self._get_donations_to_process_domain(date_ref)
records = self.search(domain) records = self.search(domain)
try:
for rec in records: for rec in records:
try:
new_line = rec._create_donation_line() new_line = rec._create_donation_line()
unprocessed_lines = rec.recurring_line_ids.filtered(lambda l: not l.sale_order_id) unprocessed_lines = rec.recurring_line_ids.filtered(lambda l: not l.sale_order_id)
for line in unprocessed_lines: for line in unprocessed_lines:
@ -321,7 +322,7 @@ class DonationRecurring(models.Model):
continue continue
rec._advance_next_date() rec._advance_next_date()
except Exception as e: except Exception as e:
self.message_post(body=_("⛔ Unexpected error:<br/><pre>%s</pre>") % str(e)) rec.message_post(body=_("⛔ Unexpected error:<br/><pre>%s</pre>") % traceback.format_exc())
return True return True
@api.model @api.model

View File

@ -47,7 +47,7 @@ class HyperPayTransaction(models.Model):
return self._hyperpay_s2s_validate_transaction(data) return self._hyperpay_s2s_validate_transaction(data)
def _hyperpay_get_s2s_transaction_payload(self, data): def _hyperpay_get_s2s_transaction_payload(self, data):
base_url = request.httprequest.host_url base_url = self.acquirer_id.get_base_url()
payload = { payload = {
"entityId": self.acquirer_id.hyperpay_s2s_entity_id, "entityId": self.acquirer_id.hyperpay_s2s_entity_id,
"amount": '%.2f' % self.amount, "amount": '%.2f' % self.amount,