[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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user