Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] resource: update default calendar timezone on first admin login (follow-up) #162571

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion addons/resource/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def write(self, vals):
# If the timezone of the admin user gets set on their first login, also update the timezone of the default working calendar
if (vals.get('tz') and len(self) == 1 and not self.env.user.login_date
and self.env.user == self.env.ref('base.user_admin', False) and self == self.env.user):
self.resource_calendar_id.tz = vals['tz']
if self.resource_calendar_id:
self.resource_calendar_id.tz = vals['tz']
else:
self.env.ref('resource.resource_calendar_std', False).tz = vals['tz']

return rslt