Skip to content

Commit

Permalink
T1760 FIX wrong language on payment process page
Browse files Browse the repository at this point in the history
- This is a workaround fixing Odoo putting the wrong language in the context in the payment page. It could be removed when Odoo properly does it.
  • Loading branch information
ecino committed Sep 24, 2024
1 parent cdcc7f5 commit 677e700
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions sms_939/models/sms_notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import logging
import traceback

from dateutil import parser

from odoo import _, api, fields, models, tools
Expand Down
1 change: 1 addition & 0 deletions website_switzerland/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from . import res_partner
from . import event_registration
from . import survey_user_input
from . import payment_transaction
16 changes: 16 additions & 0 deletions website_switzerland/models/payment_transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from odoo import models


class PaymentTransaction(models.Model):
_inherit = "payment.transaction"

def _post_process_after_done(self):
# T1760 FIX wrong language in context coming from the payment process page
available_langs = self.env["res.lang"].search([]).mapped("code")
if self.env.lang not in available_langs:
self = self.with_context(lang=None)
for lang in available_langs:
if lang.startswith(self.env.lang.split("_")[0]):
self = self.with_context(lang=lang)
break
return super()._post_process_after_done()

0 comments on commit 677e700

Please sign in to comment.