Skip to content

πŸ›‘οΈ Warracker is an open source, self-hostable warranty tracker to monitor expirations, store receipts, files. You own the data, your rules!

Title Paperless documents with the product name (issue #147)

Omega (QA)999b175527e8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ed430b..b626e3e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@
- _Files: `backend/migrations/052_create_claim_documents_table.sql`, `backend/warranties_routes.py`, `backend/file_routes.py`, `frontend/js/components/claims.js`, `frontend/style.css`, `locales/en/translation.json`_
- **Void warranty status (issue #250):** a warranty can now be manually terminated ("voided") when its conditions are broken before the expiration date β€” physical damage, unauthorized repairs, broken seals β€” without deleting the item or changing its expiration date. Voided warranties stay in the list with a Void status (with a matching filter on the main page and the status dashboard, plus a Void count card), and are excluded from the Total Value card, active/expired/expiring counts, expiration timelines, and expiry notification emails. Voiding is reversible from the same card actions.
- _Files: `backend/migrations/053_add_voided_at_to_warranties.sql`, `backend/warranties_routes.py`, `backend/statistics_routes.py`, `backend/notifications.py`, `frontend/js/components/warrantyActions.js`, `frontend/js/components/warrantyRenderer.js`, `frontend/js/controllers/warrantyListController.js`, `frontend/js/lib/warrantyProcessing.js`, `frontend/script.js`, `frontend/index.html`, `frontend/status.js`, `frontend/status.html`, `frontend/style.css`, `locales/en/translation.json`_
+- **Paperless document titles use the product name (issue #147):** documents uploaded to Paperless-ngx were titled "Warracker invoice - <filename>", which says nothing about the product. They are now titled after the warranty's product name β€” "<Product> - Invoice", "<Product> - Manual", and "<Product> - Claim document" for claim attachments. The old title format remains only as a fallback when no product name is available.
+ - _Files: `frontend/script.js`, `frontend/js/components/paperless.js`, `frontend/js/components/claims.js`_
## 1.0.3 - 2026-10-02
diff --git a/frontend/js/components/claims.js b/frontend/js/components/claims.js
index df4bc1d..d1256cf 100644
--- a/frontend/js/components/claims.js
+++ b/frontend/js/components/claims.js
@@ -461,7 +461,10 @@ async function uploadClaimDocument(claimId, file, storage) {
const paperlessForm = new FormData();
paperlessForm.append('file', file);
paperlessForm.append('document_type', 'claim_document');
- paperlessForm.append('title', `Warracker claim document - ${file.name}`);
+ // Issue #147: title the Paperless document after the product
+ const warranty = (getWarranties() || []).find((w) => w.id === state.currentWarrantyId);
+ const productName = warranty?.product_name;
+ paperlessForm.append('title', productName ? `${productName} - Claim document` : `Warracker claim document - ${file.name}`);
paperlessForm.append('tags', 'warracker,claim');
const uploadResponse = await fetch('/api/paperless/upload', {
method: 'POST',
diff --git a/frontend/js/components/paperless.js b/frontend/js/components/paperless.js
index fbc0c45..960943c 100644
--- a/frontend/js/components/paperless.js
+++ b/frontend/js/components/paperless.js
@@ -133,7 +133,7 @@ export function getStorageOption(documentType, isEdit = false) {
return radio ? radio.value : 'local';
}
-async function uploadToPaperlessNgx(file, documentType) {
+async function uploadToPaperlessNgx(file, documentType, productName) {
try {
const token = getAuthToken();
if (!token) throw new Error('Authentication token not available');
@@ -142,7 +142,11 @@ async function uploadToPaperlessNgx(file, documentType) {
const formData = new FormData();
formData.append('file', file);
formData.append('document_type', documentType);
- formData.append('title', `Warracker ${documentType} - ${file.name}`);
+ // Issue #147: title the Paperless document after the product, not the
+ // generated "Warracker ..." filename-style title
+ const typeLabel = documentType.charAt(0).toUpperCase() + documentType.slice(1);
+ const title = productName ? `${productName} - ${typeLabel}` : `Warracker ${documentType} - ${file.name}`;
+ formData.append('title', title);
formData.append('tags', ['warracker', documentType].join(','));
updatePaperlessUploadStatus(window.t ? window.t('paperless.uploading_to_server') : 'Uploading file to Paperless-ngx...');
@@ -190,7 +194,7 @@ export async function processPaperlessUploads(formData) {
const input = document.getElementById(docType);
const file = input?.files[0];
if (storage === 'paperless' && file) {
- const uploadResult = await uploadToPaperlessNgx(file, docType);
+ const uploadResult = await uploadToPaperlessNgx(file, docType, formData.get('product_name'));
if (uploadResult.success || (uploadResult.error?.includes('duplicate') && uploadResult.document_id)) {
const mapping = {
productPhoto: 'paperless_photo_id',
@@ -227,7 +231,7 @@ export async function processEditPaperlessUploads(formData) {
const input = document.getElementById(`edit${capitalize(docType)}`);
const file = input?.files[0];
if (!file) continue;
- const uploadResult = await uploadToPaperlessNgx(file, docType);
+ const uploadResult = await uploadToPaperlessNgx(file, docType, formData.get('product_name'));
if (uploadResult.success || (uploadResult.error?.includes('duplicate') && uploadResult.document_id)) {
const mapping = {
productPhoto: 'paperless_photo_id',
diff --git a/frontend/script.js b/frontend/script.js
index 2fb4ecb..df5c964 100644
--- a/frontend/script.js
+++ b/frontend/script.js
@@ -7158,7 +7158,7 @@ function getStorageOption(documentType, isEdit = false) {
* @param {string} documentType - The type of document for tagging
* @returns {Promise<Object>} - Upload result with document ID
*/
-async function uploadToPaperlessNgx(file, documentType) {
+async function uploadToPaperlessNgx(file, documentType, productName) {
try {
const token = localStorage.getItem('auth_token');
if (!token) {
@@ -7171,7 +7171,11 @@ async function uploadToPaperlessNgx(file, documentType) {
const formData = new FormData();
formData.append('file', file);
formData.append('document_type', documentType);
- formData.append('title', `Warracker ${documentType} - ${file.name}`);
+ // Issue #147: title the Paperless document after the product, not the
+ // generated "Warracker ..." filename-style title
+ const typeLabel = documentType.charAt(0).toUpperCase() + documentType.slice(1);
+ const title = productName ? `${productName} - ${typeLabel}` : `Warracker ${documentType} - ${file.name}`;
+ formData.append('title', title);
// Add tags for organization
const tags = ['warracker', documentType];
@@ -7180,7 +7184,7 @@ async function uploadToPaperlessNgx(file, documentType) {
console.log('[Paperless-ngx] Upload FormData contents:');
console.log(' - file:', file.name, '(' + file.size + ' bytes, ' + file.type + ')');
console.log(' - document_type:', documentType);
- console.log(' - title:', `Warracker ${documentType} - ${file.name}`);
+ console.log(' - title:', title);
console.log(' - tags:', tags.join(','));
updatePaperlessUploadStatus('Uploading file to Paperless-ngx...');
@@ -7258,7 +7262,7 @@ async function processPaperlessNgxUploads(formData) {
if (file) {
console.log(`[Paperless-ngx] Uploading ${docType} to Paperless-ngx`);
// Upload to Paperless-ngx
- const uploadResult = await uploadToPaperlessNgx(file, docType);
+ const uploadResult = await uploadToPaperlessNgx(file, docType, formData.get('product_name'));
console.log(`[DEBUG][processPaperlessNgxUploads] uploadResult for ${docType}:`, uploadResult);
if (uploadResult.success || (uploadResult.error && uploadResult.error.includes("duplicate") && uploadResult.document_id)) {
// Map frontend document types to database column names
@@ -7327,7 +7331,7 @@ async function processEditPaperlessNgxUploads(formData) {
console.log(`[Paperless-ngx] Uploading ${docType} to Paperless-ngx (edit mode)`);
// Upload to Paperless-ngx
- const uploadResult = await uploadToPaperlessNgx(file, docType);
+ const uploadResult = await uploadToPaperlessNgx(file, docType, formData.get('product_name'));
if (uploadResult.success || (uploadResult.error && uploadResult.error.includes("duplicate") && uploadResult.document_id)) {
// Map frontend document types to database column names