[UI] Show linked barcode string on stock detail page (#11745) - #12354
[UI] Show linked barcode string on stock detail page (#11745)#12354mahekp05 wants to merge 164 commits into
Conversation
…barcode-ui # Conflicts: # src/frontend/src/pages/stock/StockDetail.tsx
Add a backend API test asserting the read-only barcode_data field is exposed by StockItemSerializer, and a Playwright test covering the link -> display -> unlink flow on the stock detail page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
Restores visibility of the linked (third-party) barcode string on the Stock Item detail page by exposing barcode_data via the StockItem API and rendering it (copyable) in the frontend, with regression coverage across backend and Playwright E2E tests.
Changes:
- Exposes
barcode_dataonStockItemSerializeras a read-only field and bumps the API version. - Displays a conditional “Linked Barcode” (copyable) field on the stock item detail page when
barcode_datais present. - Adds backend and Playwright regression tests for the link → display → unlink flow.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/frontend/tests/pages/pui_stock.spec.ts | Adds Playwright regression test verifying linked barcode visibility toggles with link/unlink actions. |
| src/frontend/src/pages/stock/StockDetail.tsx | Renders “Linked Barcode” detail field (copyable) when stockitem.barcode_data is present. |
| src/backend/InvenTree/stock/test_api.py | Adds API regression test ensuring barcode_data is exposed and remains read-only via PATCH. |
| src/backend/InvenTree/stock/serializers.py | Adds barcode_data to serializer output and marks it read-only. |
| src/backend/InvenTree/InvenTree/api_version.py | Increments API version and documents the change in the API version text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| v520 -> 2026-07-10 : https://github.com/inventree/InvenTree/pull/TODO | ||
| - Adds read-only "barcode_data" field to the StockItem API endpoint |
| // Link a custom barcode via the barcode actions dropdown | ||
| await page.getByLabel('action-menu-barcode-actions').click(); | ||
| await page.getByLabel('action-menu-barcode-actions-link-barcode').click(); | ||
|
|
||
| // Enter the barcode data via the keyboard input and submit | ||
| await page.getByLabel('barcode-input-scanner').click(); | ||
| await page.getByLabel('barcode-scan-keyboard-input').fill('TEST-123'); | ||
| await page.getByRole('button', { name: 'Link', exact: true }).click(); |
|
Hi @mahekp05 thanks for the PR! If we are going to fix this we should do it in the general case - not just for the StockItem detail. There are many other pages which support custom barcode data, so these changes should be applied to those too, and also in a generic way |
Thanks for the feedback! I've reworked this to apply generically across all models that support custom barcodes ( ApproachBackend — one shared serializer mixin Frontend — one shared helper CoverageThe linked barcode string now displays on: Part, StockItem, StockLocation, Build, SupplierPart, ManufacturerPart, PurchaseOrder, SalesOrder, ReturnOrder, TransferOrder, SalesOrderShipment. Files changedBackend
Frontend
Tests
Open to feedback — happy to adjust the placement, naming, or approach if you'd prefer it done differently, or if any other changes are needed. |
| * | ||
| * The field is copyable and only rendered when a barcode is linked to the instance. | ||
| */ | ||
| export function barcodeDataField(instance: any): DetailsField { |
There was a problem hiding this comment.
@SchrodingersGat do we need to do a memo trick here?
|
@SchrodingersGat imo the approach looks good; I think this would be - in general - be ready for a merge @mahekp05 a few merge conflicts have creeped in; please adress these |
* Support initial filters for UseCalendar * [UI] Calendar updates - Allow calendars to display completed / cancelled items also
) Bumps the dependencies group with 3 updates: [actions/cache](https://github.com/actions/cache), [oasdiff/oasdiff-action](https://github.com/oasdiff/oasdiff-action) and [CodSpeedHQ/action](https://github.com/codspeedhq/action). Updates `actions/cache` from 4.3.0 to 5.0.5 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](actions/cache@0057852...27d5ce7) Updates `oasdiff/oasdiff-action` from 0.0.48 to 0.0.51 - [Release notes](https://github.com/oasdiff/oasdiff-action/releases) - [Commits](oasdiff/oasdiff-action@50e6a34...f30668f) Updates `CodSpeedHQ/action` from 4.15.1 to 4.17.0 - [Release notes](https://github.com/codspeedhq/action/releases) - [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md) - [Commits](CodSpeedHQ/action@3194d9a...9d332c4) --- updated-dependencies: - dependency-name: actions/cache dependency-version: 5.0.5 dependency-type: direct:production update-type: version-update:semver-major dependency-group: dependencies - dependency-name: oasdiff/oasdiff-action dependency-version: 0.0.51 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies - dependency-name: CodSpeedHQ/action dependency-version: 4.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…dal (inventree#12128) * add new hotkey registration interface and hotkey modal * fix import * add printing hotkey * add todo * add hotkey for barcode scanning * register spotlight shortcut key * sort keys * render nicer overview * fix props * expose for plugins --------- Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* bump container deps * specific n version * switch to nvm as n is not officially supported * fix bash script * fix corepack * move yarn config inline * revert nvm usage
Add spotlight action to quickly jump to user management panel
- Display last update date - Display updating user - Improved formatting
* Enforce min width for drop-down filters * Pass active filter to owner column * Fix filter name * Add active filter to UserFilter by default
* Check model permissions for printing * Add unit tests * Prevent printing of disabled reports * Updated unit test * Adjust unit test for printing * Update API and CHANGELOG
…ntree#12151) * Make plugin registry hash independent of plugin discovery order calculate_plugin_hash() iterates self.plugins.items() in insertion order, which is the plugin discovery order of the local process. Two processes can hold the same registry state (same plugins, versions, active flags) in a different order and compute different hashes, ping-ponging the _PLUGIN_REGISTRY_HASH setting and triggering endless registry reloads in check_reload(). Sort by slug before hashing so the hash represents the registry state rather than the iteration order of any particular process. Add a regression test that reverses the plugin dict and asserts the hash is unchanged. * Address review comments: explicit sort key, guard against vacuous test --------- Co-authored-by: Nasawa <christopher@anigeek.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Enable in-column filtering for model type * Enable sorting by label size * Enable backend ordering * Improve filtering for report template table * Update API version
* [bug] Check for null line_item when receiving items * Additional unit testing * Additional context * Fix tests
* Robustify playwright tests * More test tweaks
- Ctrl + enter submits the form
* Fix currency choices for PartPricing model - Remove dynamic choices from model definition - Move validation step to the serializer - Add validator to ensure only valid currencies can be used * Add regression test * Bump API version
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* Update plugin name * Backup accessor for plugin name * Add null check for plg_db
* Adjust default behavior of "migrate" command - Does not create new migration files automatically * Add dummy field - ensure detected by CI * Revert "Add dummy field - ensure detected by CI" This reverts commit e7a101f. * Fix typo * Adjust contributing docs * Add CHANGELOG entry
* Enable download from frontend panels * Enable data import for part internal pricing * Bump API version * Update CHANGELOG
* Simplify navigation links * simplify version.py * Simplify docs links * Consolidate
* Enhanced documentation for admin center and django-admin * Fix links and wording * remove placeholders * Fix links * Fix more links
- Ensure currency options are loaded dynamically
* Refactor API form fields - Prevent reconstruction of all fields when single value changes - Memoize components more intelligently - Fix enter key callback ref * memoize other field types too * More memo * Prevent duplicate API calls for related model field * Add aria-label for IconField * add playwright tests for form field coverage
* Parallel initial requests * Remove debouncing * Refactor lazy loading of desktop / mobile view * Reduce initial waiting for loadable components * Fix duplication of API calls * Further reduce duplicate calls * Combine user roles into /user/me/ endpoint * lazy load global import drawer * lazy load table in plugin context * Patch ScanButton * Added playwright tests for login * Adjust thresholds
* Bug fixes for PO receive - Fix shadowed variable - Notify listeners for all received items * Cache part subs
- More useful error messaging if a task fails
Add a backend API test asserting the read-only barcode_data field is exposed by StockItemSerializer, and a Playwright test covering the link -> display -> unlink flow on the stock detail page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fixes bug where imported data headers get out of sync - Additional unit tests
* Refactor StockItem methods - Refactor out common functionality - Code cleanup * Cleanup * Prevent override of existing deltas
…kp05/InvenTree into fix-11745-linked-barcode-ui
…barcode-ui # Conflicts: # src/backend/InvenTree/InvenTree/api_version.py # src/backend/InvenTree/InvenTree/test_serializers.py # src/backend/InvenTree/build/serializers.py # src/backend/InvenTree/stock/test_api.py # src/frontend/src/pages/build/BuildDetail.tsx # src/frontend/src/pages/company/ManufacturerPartDetail.tsx # src/frontend/src/pages/company/SupplierPartDetail.tsx # src/frontend/src/pages/part/PartDetail.tsx # src/frontend/src/pages/purchasing/PurchaseOrderDetail.tsx # src/frontend/src/pages/sales/ReturnOrderDetail.tsx # src/frontend/src/pages/sales/SalesOrderDetail.tsx # src/frontend/src/pages/stock/LocationDetail.tsx # src/frontend/src/pages/stock/StockDetail.tsx # src/frontend/src/pages/stock/TransferOrderDetail.tsx
|
@matmair @SchrodingersGat I just updated the branch with the latest
Branch is now conflict-free. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #12354 +/- ##
=======================================
Coverage 86.73% 86.74%
=======================================
Files 1445 1445
Lines 96340 96395 +55
Branches 11229 11229
=======================================
+ Hits 83561 83615 +54
- Misses 12715 12716 +1
Partials 64 64
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|

Description
Restores the linked (third-party) barcode string on the stock item detail page, which was visible pre-1.0 but lost after the UI rewrite.
Fixes #11745
Changes
barcode_dataas a read-only field onStockItemSerializerTests
barcode_datais exposed and read-only