[IMP]project_average_acceptable_time:fix page crash when the portal user is follower of any project
This commit is contained in:
@@ -17,9 +17,12 @@ class CustomCustomerPortal(CustomerPortal):
|
||||
if post and request.httprequest.method == "POST":
|
||||
error, error_message = self.details_form_validate(post)
|
||||
if not error:
|
||||
user = request.env.user
|
||||
if user.default_project_id and post["average_acceptable_time"]:
|
||||
user.default_project_id.average_acceptable_time = post[
|
||||
# sudo: a portal user has no write access at all on
|
||||
# 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"
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user