-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T1760 FIX wrong language on payment process page
- 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
Showing
3 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |