Document stores: the kind's name follows whoever triggers the send, so one kind is filed under several names #605
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#605
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on 2026-09-29 in a read-only review of postulo at
95348908dand postulo-paperless at 973969bb7, followingDocumentMetadata.kind_labelfrom where it is resolved to where the Paperless store uses it.Checked again on 2026-10-01 against
mainat0a5cad587: still present. The code is now atdocuments/kinds.py:128(label_for), with the labels declared atdocuments/kinds.py:155-182, and the scheduler's call atnotifications/management/commands/send_due_reminders.py:196; the other locations are unchanged.A store is handed the document's kind in words (
kind_label), and those words are resolved in whatever language happens to be active when the copy is sent. The scheduler has no language, so it usesLANGUAGE_CODE; Send to stores now runs inside a request, so it uses the person's interface language. A store that files by that name files the same kind under two names.documents/stores.py:89(kind_label=kinds.label_for(document.kind)) anddocuments/kinds.py:109(return str(kind.label) if kind else key), with the labels declared throughgettext_lazy(documents/kinds.py:137-164).metadata_foris called fromsend_copy(documents/archiving.py:136), which sets no language;send_copyis reached from the scheduler (notifications/management/commands/send_due_reminders.py:194) and from the Send to stores now view (documents/views.py:714).documents/archiving.pycontains notranslation.override. In postulo-paperless,src/postulo_paperless/store.py:319creates or finds the Paperless document type by that name, andcompose_title(src/postulo_paperless/store.py:100) puts it in the title of every render.LANGUAGE_CODEisen-gb. The cover letters the scheduler sends are filed in Paperless under the document type "Cover letter". One sent with Send to stores now is filed under "Lettre de motivation", whichArchive.ensurecreates because no type of that name exists. Filtering by document type in Paperless then shows part of the letters under each, and the split grows with every manual send. The sentencessend_copystores inlast_error(documents/archiving.py:124-131) and the plugin's own error sentences vary in the same way.kind_labeland would split them the same way.send_copy, wrap the call toplugin.put(...)andmetadata_for(document)intranslation.override(language_for(document.owner)), asnotifyalready does (notifications/service.py:49-50). That makes the name the same whichever path sends the copy, and puts the error sentences in the owner's language as well.Related to #223 (closed), which moved
DocumentMetadata.languageto the document's own language and made notifications speak the recipient's language, but left the kind's label and the store's sentences following the request.Done when
tests/test_stores.pysends one copy withsend_pending()and another of the same kind withsend_now()while a different language is active, for an owner whose profile language is French, and asserts that the store received the samekind_labelboth times, in the owner's language. It fails today.