Skip to content

Commit

Permalink
[4258][FIX] template_content_swapper (#5)
Browse files Browse the repository at this point in the history
* [FIX] template_content_swapper
  • Loading branch information
AungKoKoLin1997 authored Aug 14, 2024
1 parent ca37f22 commit 130aa54
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions template_content_swapper/models/ir_ui_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ class IrUiView(models.Model):
def _render_template(self, template, values=None):
result = super()._render_template(template, values)
result_str = str(result)
lang_code = "en_US"
request = values.get("request")
if request:
lang_code = self.env.user.lang
if values and values.get("request"):
# For views
lang_code = request.env.lang
lang_code = values.get("request").env.lang
else:
# For reports
lang_match = re.search(r'data-oe-lang="([^"]+)"', result_str)
if lang_match:
# For reports
lang_code = lang_match.group(1)
view = self.browse(self.get_view_id(template)).sudo()
content_mappings = (
Expand Down

0 comments on commit 130aa54

Please sign in to comment.