Skip to content

Conversation

@david-s73
Copy link

  • When attempting to create a new user session, an error message popped up, so I added that it should take the current date if no date is provided.

  • The error message copied from a runboat

Traceback (most recent call last):
File "/opt/odoo/odoo/http.py", line 1971, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/opt/odoo/odoo/service/model.py", line 152, in retrying
result = func()
File "/opt/odoo/odoo/http.py", line 1999, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/opt/odoo/odoo/http.py", line 2203, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 221, in _dispatch
result = endpoint(**request.params)
File "/opt/odoo/odoo/http.py", line 786, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/addons/web/controllers/dataset.py", line 25, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/addons/web/controllers/dataset.py", line 21, in _call_kw
return call_kw(Model, method, args, kwargs)
File "/opt/odoo/odoo/api.py", line 484, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo/api.py", line 469, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/addons/web/models/models.py", line 1083, in onchange
snapshot1 = RecordSnapshot(record, fields_spec)
File "/opt/odoo/addons/web/models/models.py", line 1170, in init
self.fetch(name)
File "/opt/odoo/addons/web/models/models.py", line 1185, in fetch
self[field_name] = self.record[field_name]
File "/opt/odoo/odoo/models.py", line 6695, in getitem
return self._fields[key].get(self, self.env.registry[self._name])
File "/opt/odoo/odoo/fields.py", line 1152, in get
self.recompute(record)
File "/opt/odoo/odoo/fields.py", line 1379, in recompute
apply_except_missing(self.compute_value, recs)
File "/opt/odoo/odoo/fields.py", line 1352, in apply_except_missing
func(records)
File "/opt/odoo/odoo/fields.py", line 1401, in compute_value
records._compute_field_value(self)
File "/opt/odoo/odoo/models.py", line 4923, in _compute_field_value
fields.determine(field.compute, self)
File "/opt/odoo/odoo/fields.py", line 102, in determine
return needle(*args)
File "/mnt/data/odoo-addons-dir/auditlog/models/http_session.py", line 24, in _compute_display_name
tz_create_date = fields.Datetime.context_timestamp(httpsession, create_date)
File "/opt/odoo/odoo/fields.py", line 2269, in context_timestamp
assert isinstance(timestamp, datetime), 'Datetime instance expected'
AssertionError: Datetime instance expected

The above server error caused the following client error:
OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
Error: An error occured in the owl lifecycle (see this Error's "cause" property)
at handleError (http://oca-server-tools-17-0-013a975d296a.runboat.odoo-community.org/web/assets/083efc9/web.assets_web.min.js:938:101)
at App.handleError (http://oca-server-tools-17-0-013a975d296a.runboat.odoo-community.org/web/assets/083efc9/web.assets_web.min.js:1596:29)
at ComponentNode.initiateRender (http://oca-server-tools-17-0-013a975d296a.runboat.odoo-community.org/web/assets/083efc9/web.assets_web.min.js:1030:19)

Caused by: RPC_ERROR: Odoo Server Error
RPC_ERROR
at makeErrorFromResponse (http://oca-server-tools-17-0-013a975d296a.runboat.odoo-community.org/web/assets/083efc9/web.assets_web.min.js:2955:163)
at XMLHttpRequest. (http://oca-server-tools-17-0-013a975d296a.runboat.odoo-community.org/web/assets/083efc9/web.assets_web.min.js:2959:13)

@david-s73 david-s73 changed the title [FIX] auditlog: Unable to create a user session 17.0 [FIX] auditlog: Unable to create a user session Oct 28, 2025
@david-s73
Copy link
Author

@pedrobaeza Can you check the pr, and if you can't, do you know who can?

@pedrobaeza
Copy link
Member

Please check module maintainers/contributors.

@david-s73
Copy link
Author

@hbrunn Can you check the pr?

@StefanRijnhart
Copy link
Member

What is the way to reproduce? Did you go to the user session menu item and click 'New'?

@david-s73
Copy link
Author

@StefanRijnhart You have to go to “User Sessions” and click on the “New” button, then the error message will pop up.

@StefanRijnhart
Copy link
Member

@david-s73 Is there a particular reason to create user sessions manually? Maybe we can improve this change by removing the ability to create new entries in that menu (<tree create="false" />)?

@david-s73
Copy link
Author

@StefanRijnhart Because if there is the option to create one manually, it is best that it does not give an error message when trying to do so.

@StefanRijnhart
Copy link
Member

StefanRijnhart commented Oct 29, 2025

Yes, so we should keep the current change that you proposed. But I also think it does not make any sense to create user sessions manually, so the create button is simply misleading.

@david-s73
Copy link
Author

@StefanRijnhart It's true that it's not normally used, but if it is used for some reason, the error message would pop up, and I think my change doesn't affect anything unless it's created manually, so if you agree, you can go ahead and use it.

@StefanRijnhart
Copy link
Member

Yes, I think we should avoid the error message at all cost so I'm happy you're proposing a fix! I'm just saying we can fix a closely related usability issue at the same time by adding the create='false' attribute to the model's tree view.

@david-s73
Copy link
Author

@StefanRijnhart That's clear, but if I set create=‘false’, the change I made won't work because it only skipped when one was created manually, so I would have to remove my change and just add create=‘false’.

@StefanRijnhart
Copy link
Member

You don't have to remove your fix. If you want to validate that your fix keeps working, you can add a small test checking self.env["auditlog.http.session"].new().display_name.

@david-s73
Copy link
Author

@StefanRijnhart So, do I add the tests and also create=‘false’ in the tree view?

@StefanRijnhart
Copy link
Member

Yes please!

When attempting to create a new user session, an error message popped up, so I added that it should take the current date if no date is provided.
@david-s73 david-s73 force-pushed the 17.0-fix-auditlog_datetime branch from 6e4f312 to 14bb745 Compare October 30, 2025 08:02
@david-s73
Copy link
Author

@StefanRijnhart You have already made the changes, both the tests and the modification in the tree view.

Copy link
Member

@StefanRijnhart StefanRijnhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

@david-s73
Copy link
Author

@StefanRijnhart Merged?

@StefanRijnhart
Copy link
Member

@david-s73 More approvals required, see https://odoo-community.org/resources/code

@david-s73
Copy link
Author

@StefanRijnhart Do you know anyone else who can give the approval?

@StefanRijnhart
Copy link
Member

@david-s73 If there people who volunteered as module maintainers, they would have been invited for review by the OCA Github bot. In this case there are none. It is not considered good practice to ask people for review unless the issue is critical. It can come across as pushy, and have the opposite result. Reviews are posted on a voluntary basis, often in people's spare time. It can help (in the long run...) to do reviews yourself to build up a reputation in the project or in the OCA. And just give it some time.
If you are currently dependent on the merge for the update of your production code, you might want to change your processes.

Copy link

@drkpkg drkpkg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great—thanks for addressing the create_date. Let’s merge this so I can rebase my branch on top of it

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@StefanRijnhart
Copy link
Member

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 17.0-ocabot-merge-pr-3432-by-StefanRijnhart-bump-minor, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 8d7123e. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit 870c8f3 into OCA:17.0 Nov 7, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants