From 3a520564a7d721f868a503cea06149dd961865d1 Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Sun, 17 May 2026 23:36:10 -0400 Subject: [PATCH] =?UTF-8?q?fix(portal):=20account=20summary=20500=20?= =?UTF-8?q?=E2=80=94=20open=5Fbalance=20can't=20use=20t-field?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit t-field requires a record.field_name access pattern. open_balance is a Python float (returned by _fp_account_summary_open_balance), not a recordset attribute, so QWeb threw AssertionError at render time and the page 500'd. Format the value in the controller via tools.formatLang and render it as a plain string with t-out instead. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_portal/controllers/portal.py | 10 ++++++++-- .../views/fp_portal_account_summary.xml | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fusion_plating/fusion_plating_portal/controllers/portal.py b/fusion_plating/fusion_plating_portal/controllers/portal.py index 79e19ed7..884a1c74 100644 --- a/fusion_plating/fusion_plating_portal/controllers/portal.py +++ b/fusion_plating/fusion_plating_portal/controllers/portal.py @@ -10,6 +10,7 @@ from datetime import datetime, time as dt_time from odoo import _, http from odoo.exceptions import AccessError, MissingError from odoo.http import request +from odoo.tools import formatLang from odoo.addons.portal.controllers.portal import ( CustomerPortal, pager as portal_pager, @@ -551,6 +552,11 @@ class FpCustomerPortal(CustomerPortal): step=self._FP_ACCOUNT_SUMMARY_PER_PAGE, ) + currency = ( + commercial.property_account_receivable_id.currency_id + if commercial.property_account_receivable_id + else request.env.company.currency_id + ) values = self._prepare_portal_layout_values() values.update({ 'page_name': 'fp_account_summary', @@ -561,8 +567,8 @@ class FpCustomerPortal(CustomerPortal): 'search': search, 'sort': sort, 'open_balance': open_balance, - 'currency': commercial.property_account_receivable_id.currency_id - if commercial.property_account_receivable_id else request.env.company.currency_id, + 'open_balance_display': formatLang(request.env, open_balance, currency_obj=currency), + 'currency': currency, 'pager': pager, 'total': data['total'], }) diff --git a/fusion_plating/fusion_plating_portal/views/fp_portal_account_summary.xml b/fusion_plating/fusion_plating_portal/views/fp_portal_account_summary.xml index 0e218e9b..8378b765 100644 --- a/fusion_plating/fusion_plating_portal/views/fp_portal_account_summary.xml +++ b/fusion_plating/fusion_plating_portal/views/fp_portal_account_summary.xml @@ -15,8 +15,7 @@
Open Balance: - +