Skip to content

[refactor] Attachment images#11961

Open
SchrodingersGat wants to merge 20 commits into
inventree:masterfrom
SchrodingersGat:attachment-images
Open

[refactor] Attachment images#11961
SchrodingersGat wants to merge 20 commits into
inventree:masterfrom
SchrodingersGat:attachment-images

Conversation

@SchrodingersGat
Copy link
Copy Markdown
Member

@SchrodingersGat SchrodingersGat commented May 18, 2026

This PR adds / refactors some functionality related to attachments

Changes

  • Adds "thumbnail" for attachments which are images
  • Display thumbnail in attachment table
  • Prevent upload of files above a user-configurable size
  • Data migration for existing uploaded attachments

Rationale

This forms the first part of a re-think of how we might approach generic images against any model instance - see #10484

However, none of that will be implemented here - this is a low-scope change to allow discrimination of attachments which are also images, and display them as such in the UI

Tasks

  • Offload thumbnail generation to the background worker
  • Database migration unit tests
  • Demo dataset migration
  • Unit tests for new features

Future Work (Potentially, TBD)

@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for inventree-web-pui-preview canceled.

Name Link
🔨 Latest commit 0f79a27
🔍 Latest deploy log https://app.netlify.com/projects/inventree-web-pui-preview/deploys/6a0dbe9e3f625e00080d85ce

@SchrodingersGat SchrodingersGat added api Relates to the API refactor migration Data or schema migrations User Interface Related to the frontend / User Interface full-run Always do a full QC CI run labels May 18, 2026
@SchrodingersGat SchrodingersGat added this to the 1.4.0 milestone May 18, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 92.74611% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.31%. Comparing base (9cac925) to head (0f79a27).
⚠️ Report is 1 commits behind head on master.

❌ Your patch check has failed because the patch coverage (92.70%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11961      +/-   ##
==========================================
- Coverage   91.44%   91.31%   -0.14%     
==========================================
  Files         974      969       -5     
  Lines       50704    50074     -630     
==========================================
- Hits        46366    45724     -642     
- Misses       4338     4350      +12     
Flag Coverage Δ
backend 90.32% <89.63%> (+1.05%) ⬆️
migrations 40.69% <45.07%> (-1.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Backend Apps 91.60% <ø> (-0.17%) ⬇️
Backend General 93.37% <92.70%> (-0.12%) ⬇️
Frontend ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SchrodingersGat SchrodingersGat requested a review from matmair May 18, 2026 13:28
Copy link
Copy Markdown
Member

@matmair matmair left a comment

Choose a reason for hiding this comment

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

LGTM overall; if we want to change attachments meaningfully in 1.4.0 I would have some larger points worth adressing

Comment thread src/backend/InvenTree/common/models.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Relates to the API full-run Always do a full QC CI run migration Data or schema migrations refactor User Interface Related to the frontend / User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants