[REF] project_average_acceptable_time: read posted value once
Some checks failed
pre-commit / pre-commit (pull_request) Failing after 1m30s
tests / test (pull_request) Successful in 2m0s

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.
This commit is contained in:
Stéphan Sainléger
2026-11-09 00:33:08 +01:00
parent 82971af4d4
commit 533e12d376

View File

@@ -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