From 533e12d376e4e5159eb6c6aebbcca1740c98b2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Mon, 9 Nov 2026 00:33:08 +0100 Subject: [PATCH] [REF] project_average_acceptable_time: read posted value once The portal override looked the custom field up twice, once with ``get()`` for the condition and once with ``[]`` for the assignment. Read it once so the code stays safe if the input is absent from the submitted form. --- .../controllers/custom_portal.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project_average_acceptable_time/controllers/custom_portal.py b/project_average_acceptable_time/controllers/custom_portal.py index a95cf86..5b69f39 100644 --- a/project_average_acceptable_time/controllers/custom_portal.py +++ b/project_average_acceptable_time/controllers/custom_portal.py @@ -22,9 +22,8 @@ class CustomCustomerPortal(CustomerPortal): # project.project, and no read access on its default project # unless it follows it project_sudo = request.env.user.sudo().default_project_id - if project_sudo and post.get("average_acceptable_time"): - project_sudo.average_acceptable_time = post[ - "average_acceptable_time" - ] + average_acceptable_time = post.get("average_acceptable_time") + if project_sudo and average_acceptable_time: + project_sudo.average_acceptable_time = average_acceptable_time return response