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

[V17] auditlog: Creating new User session or HTTP Request leads to Odoo Error #3003

Open
tosate opened this issue Jul 24, 2024 · 0 comments
Open
Labels

Comments

@tosate
Copy link

tosate commented Jul 24, 2024

Module

auditlog

Describe the bug

When I hit the "New" button under HTTP Requests the following Odoo Error appears.

_compute_display_nameRPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1764, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo-ce/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1791, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1995, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo-ce/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo-ce/odoo/http.py", line 741, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/odoo-ce/addons/web/controllers/dataset.py", line 24, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo-ce/addons/web/controllers/dataset.py", line 20, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo-ce/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo-ce/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1077, in onchange
    snapshot1 = RecordSnapshot(record, fields_spec)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1164, in __init__
    self.fetch(name)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1179, in fetch
    self[field_name] = self.record[field_name]
  File "/opt/odoo/odoo-ce/odoo/models.py", line 6631, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1152, in __get__
    self.recompute(record)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1367, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1340, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1389, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo-ce/odoo/models.py", line 4875, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 102, in determine
    return needle(*args)
  File "/opt/odoo/odoo-addons/ctie-addons/auditlog/models/http_request.py", line 29, in _compute_display_name
    tz_create_date = fields.Datetime.context_timestamp(httprequest, create_date)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 2248, 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)
    OwlError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:684:1
    handleError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:916:101
    handleError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:1543:29
    initiateRender@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:1006:19

Caused by: RPC_ERROR: Odoo Server Error
    RPCError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2871:319
    makeErrorFromResponse@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2874:163
    jsonrpc/promise</<@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2878:34

Same for User sessions. After hitting the New button the following Odoo Error appears:

_compute_display_nameRPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1764, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/opt/odoo/odoo-ce/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1791, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/opt/odoo/odoo-ce/odoo/http.py", line 1995, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/opt/odoo/odoo-ce/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
    result = endpoint(**request.params)
  File "/opt/odoo/odoo-ce/odoo/http.py", line 741, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/opt/odoo/odoo-ce/addons/web/controllers/dataset.py", line 24, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/odoo-ce/addons/web/controllers/dataset.py", line 20, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo-ce/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo-ce/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1077, in onchange
    snapshot1 = RecordSnapshot(record, fields_spec)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1164, in __init__
    self.fetch(name)
  File "/opt/odoo/odoo-ce/addons/web/models/models.py", line 1179, in fetch
    self[field_name] = self.record[field_name]
  File "/opt/odoo/odoo-ce/odoo/models.py", line 6631, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1152, in __get__
    self.recompute(record)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1367, in recompute
    apply_except_missing(self.compute_value, recs)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1340, in apply_except_missing
    func(records)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 1389, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo/odoo-ce/odoo/models.py", line 4875, in _compute_field_value
    fields.determine(field.compute, self)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 102, in determine
    return needle(*args)
  File "/opt/odoo/odoo-addons/ctie-addons/auditlog/models/http_request.py", line 29, in _compute_display_name
    tz_create_date = fields.Datetime.context_timestamp(httprequest, create_date)
  File "/opt/odoo/odoo-ce/odoo/fields.py", line 2248, 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)
    OwlError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:684:1
    handleError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:916:101
    handleError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:1543:29
    initiateRender@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:1006:19

Caused by: RPC_ERROR: Odoo Server Error
    RPCError@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2871:319
    makeErrorFromResponse@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2874:163
    jsonrpc/promise</<@http://localhost:8069/web/assets/83c7a69/web.assets_web.min.js:2878:34

In both cases the error is caused by the missing field create_date in the method _compute_display_name.

I have no idea why the httprequest object and httpsession object don't carry a value for create_date. Could this be a configuration or installation issue?

To Reproduce

Affected versions:
V17

Steps to reproduce the behavior:

  1. Install auditlog
  2. go to Settings
  3. Chose "User sessions" or "HTTP Requests" from the "Technical" menu
  4. Click on the "new" button

Expected behavior
Dialog appears to create a User session or a HTTP Request

Additional context

  • Ubuntu 22.04.4 LTS
  • Python 3.10.12
@tosate tosate added the bug label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant