Skip to content

[FIX] document_page: history display_name rendered as tuple - #660

Open
GMImrosell wants to merge 1 commit into
OCA:19.0from
GMImrosell:19.0-fix-document-page-history-display-name
Open

GMImrosell wants to merge 1 commit into
OCA:19.0from
GMImrosell:19.0-fix-document-page-history-display-name

Conversation

@GMImrosell

Copy link
Copy Markdown

Issue

The 19.0 migration of document.page.history from name_get to _compute_display_name kept the (id, name) tuple shape:

rec.display_name = (rec.id, f"{rec.page_id.name} #{rec.id}")

Since display_name is a Char field, assigning a tuple makes the ORM stringify it, so every history record is shown as e.g. (42, 'Test Page #42') instead of Test Page #42. Visible anywhere history versions are referenced (many2one widgets, approval e-mails, etc.).

Fix

Return the plain "<page name> #<id>" string, matching the pre-19.0 name_get behaviour, and add a regression test in test_document_page_history.

Test

TestDocumentPageHistory.test_history_display_name passes locally on a 19.0 scratch database (0 failed, 0 errors).

The 19.0 migration of document.page.history from name_get to
_compute_display_name kept the (id, name) tuple shape, so the Char
display_name is stringified as e.g. "(42, 'Test Page OCA#42')".

Return the plain "<page name> #<id>" string instead, and add a
regression test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants