Skip to content

fix type error, tuple assignment#605

Open
jans23 wants to merge 1 commit into
OCA:18.0from
Nitrokey:18.0-fix-document_page-type-error
Open

fix type error, tuple assignment#605
jans23 wants to merge 1 commit into
OCA:18.0from
Nitrokey:18.0-fix-document_page-type-error

Conversation

@jans23

@jans23 jans23 commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

How to reproduce: Knowledge -> Pages -> Change Requests -> New this causes the following exception:

Traceback (most recent call last):
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 2167, in _transactioning
    return service_model.retrying(func, env=self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/service/model.py", line 157, in retrying
    result = func()
             ^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 2134, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 2382, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/addons/base/models/ir_http.py", line 333, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 754, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/addons/web/controllers/dataset.py", line 36, in call_kw
    return call_kw(request.env[model], method, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/api.py", line 535, in call_kw
    result = getattr(recs, name)(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/addons/web/models/models.py", line 1019, in onchange
    snapshot1 = RecordSnapshot(record, fields_spec)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/addons/web/models/models.py", line 1106, in __init__
    self.fetch(name)
  File "/tmp/addons/web/models/models.py", line 1121, in fetch
    self[field_name] = self.record[field_name]
                       ~~~~~~~~~~~^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/models.py", line 7083, in __getitem__
    return self._fields[key].__get__(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/fields.py", line 1311, in __get__
    self.compute_value(recs)
  File "/srv/odoo/odoo/parts/odoo/odoo/fields.py", line 1493, in compute_value
    records._compute_field_value(self)
  File "/tmp/addons/mail/models/mail_thread.py", line 443, in _compute_field_value
    return super()._compute_field_value(field)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/odoo/odoo/parts/odoo/odoo/models.py", line 5302, in _compute_field_value
    fields.determine(field.compute, self)
  File "/srv/odoo/odoo/parts/odoo/odoo/fields.py", line 110, in determine
    return needle(*args)
           ^^^^^^^^^^^^^
  File "/tmp/addons/document_page/models/document_page_history.py", line 57, in _compute_display_name
    rec.display_name = rec.id, "%s #%i" % (rec.page_id.name, rec.id)
                               ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: %i format: a real number is required, not NewId

@KDRdev

KDRdev commented May 4, 2026

Copy link
Copy Markdown
Contributor

Tested. LGTM

@jans23

jans23 commented May 29, 2026

Copy link
Copy Markdown
Contributor Author

@etobella could you review this, please?

Comment thread document_page/models/document_page_history.py Outdated
@jans23 jans23 force-pushed the 18.0-fix-document_page-type-error branch from cfbdb93 to cef1a1d Compare May 29, 2026 19:17

@Reyes4711-S73 Reyes4711-S73 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@adrip-s73

Copy link
Copy Markdown
Contributor

LGTM

@etobella etobella left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

However, can you use a proper commit name.

Something like [IMP] document_page: Fix tuple assignment error

@jans23 jans23 force-pushed the 18.0-fix-document_page-type-error branch from cef1a1d to af45aee Compare June 10, 2026 04:41
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.

7 participants