* Display note info
* Support user locale
* Add unit testing for HTML content
* Observe color mode
* Add link between Note and NotesImage
* Ensure image file is deleted when NotesImage is deleted
* Add support for image upload in editor
* Skeleton for data migration
* Updates
* Update data migration
- Find any NoteImage items which do not link to a model
- Try to associate them with an existing note
* Remove validator
* Updated API endpoints for NotesImage model
* Update server side sanitizing
* Specify max field length
* Remove old fields from NotesImage model
* Refactor clean_string
* Remove obsolete task
* Remove legacy "notes" field from older models
* Adjust search params when switching notes
* Remove NotesFieldMixin
* Change editor
* Resizable image support
* Support tables
* Add table style
* Adjust header actions
* Add data migration for SalesOrderShipment notes
* Adjust back-end sanitizing
* Adjust
* Use subtle editor variant
* Move undo/redo
* Enhance editing logic
* Add report tags for notes
* Add unit test for note image cleanup
* Render note to HTML
- Automatically replace images
* Fix migration order
* Adjust migration text
* Fix "dirty" trigger on notes
* Prevent navigate from dirty notes
* Add documentation
* Prevent image clicking if not in editing mode
* Update API
* Update migration files
* Fix migrations
* remove notes from test fixtures
* remove notes field that does not exsist anymore
* add missing ruleset
* fix assertation
* fix assertation
* Update docs/docs/concepts/notes.md
Co-authored-by: Matthias Mair <code@mjmair.com>
* Remove blocknote deps
* Move old helper functions
- Only used for this migration
- Will potentially be removed at some point in the future?
* Revert change
* Fix note image URL
* Fix migration conflicts
* Fix migrations
* Fix delete call
* Fix content mixin
* Fix note duplication
* Make save method atomic
* Fix double-save
* Add "template" field to Note model
* Adjust migrations
* Frontend updates
* Fix for NotesEditor
* Render Note instance in forms
* Fix button-within-button
* Fix migrations
* Fix missing import
* add docs
* docs for rendering notes in reports
* Restrict queryset based on user view permissions
* APi unit tests for note permissions
* Duplicate embedded images when copying notes
* Add unit test for note duplication
* Add CHANGELOG
* Add 'copy_note' option to duplicate serializer
* Add unit tests for data migrations
* implement note duplication serializers
* frontend UI elements
* Fix migration conflicts
* Use branch for playwrigh testing
* Implement duplicate action for stock item
* Fix import
* Updated playwright tests
* Bug fix for receiving stock items
* Add screenshot
* Fix api_version
* Update unit tests
* Fix docs
* Remove defunct tests
* Fix migration order
* Adjust import/export workflow
* Manual cleaning update
* Fix migrations
* Fix migration files
* Fix for note save
* Adjust save ordering
* Skip constraint checking in NoteSerializer
* Custom validate_constraints on Note model
* Revert "Skip constraint checking in NoteSerializer"
This reverts commit b42bc955c1.
* Fix for note search
* Fix for receive_line_items
* Shim model renderer for NoteTemplate
* Fix playwright tests
* Adjust frontend CI
* Fix import/export CI job
* Fix for data migration test
* Fix migration test
* Adjust unit test
* Fix conflicting migration
* Fix unit test
* Run migration tests in parallel
* Robustify migration test
* Disable parallel options
* Fix conflicting migration
* Remove extraneous unit test
* Fix conflicting migrations
* Additional regression tests
* Check permissions before deleting Note instance
* Updated docs
* Validate note model type
* Prevent discard of unsaved changes in note editor
* Clean up dead code
* Fix migration conflict
* Improved data migration
* Prefetch role groups
* UI refactoring
* Refactor permission checking code
* Further code refactoring
* use DuplicateField helper
* Refactoring
* Add prefetch
* Throw exception rather than assert
* Logic fix for notes editor
* reimplement old background task
* Adjust data migration
* Fix notes field when receiving items
* Fix existing report templates
* Fix save action for notes editor
* Refactoring: Add "instance-info" API endpoint for common model properties
* Fix indicator dots
* Tweak nav alert msg
* Adjust layout of buttons
* Sanitize notes during migration
* Fix for NotesImage delete cascade
* Fix caching
* Fix race condition in notes editor
* Fix distinct issue when searching notse
* Fix race condition when saving new note instance
* Fix improper error
* Refactor StockItem duplication
* Refactoring
* Increase query time
* Fix api_version.py
* Additional migration tests
* Fix CI workflow
---------
Co-authored-by: Matthias Mair <code@mjmair.com>
* Fix PurchaseOrderExtraLine admin search and add search fields across admin classes
* Add search fields and autocomplete fields across common admin models
* Add search and autocomplete fields to importer admin models
* Add search fields to MachineConfigAdmin
* Add search fields to LocationTypeAdmin
* Remove search_fields from DataImportRowAdmin per review feedback
The global search endpoint dispatches to viewset-based result types using a bare HttpRequest() with an empty META, so pagination's build_absolute_uri() crashes on the missing SERVER_NAME.
* Add regression test for build complete failure
* Handle offloading of complete_build
* Allow generic offloading of transitions to the background worker
* Refactor cancel_build method
* additional unit test
* feat(frontend): Add filter navigation remove button
* extend docs
* extract and extend labels
* add spacer
* fix test
* small fix
* remove unneeded labels
* add mechanism for not triggering on viewsets
* reduce diff for now
* fix test
---------
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* fix: trigger pricing recalculation when SupplierPart is saved or deleted
When a SupplierPart's pack_quantity is updated after price breaks have
already been created, the Part's pricing (and BOM cost rollups for any
assemblies using that part) was not recalculated. This is because there
was no post_save or post_delete signal handler for the SupplierPart model
to trigger schedule_pricing_update on the linked Part.
Added post_save and post_delete signal handlers for SupplierPart that
mirror the existing SupplierPriceBreak signal handlers. The pricing
cascade (via update_assemblies) ensures BOM line costs in parent
assemblies are also updated.
Fixes#12285
* style: fix ruff format issues
* style: apply ruff format with --preview flag (matching project config)
* fix: resolve PartPricing.DoesNotExist in pack_quantity test
The test captured self.part.pricing before any PartPricing row existed,
yielding an unsaved instance; the later refresh_from_db() then raised
DoesNotExist. Re-fetch self.part.pricing after the price break creates
the row, matching the pattern in test_supplier_part_pricing.
---------
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
Co-authored-by: Aman Jain <jainamn@amazon.com>
* Fix admin search for StockItemTracking and StockItemTestResult
Add search_fields to StockTrackingAdmin and StockItemTestResultAdmin
- item__part__name: search tracking by part name
- item__serial: search tracking by serial number
- notes: search tracking notes
- stock_item__part__name: search test results by part name
- stock_item__serial: search test results by serial number
- template__test_name: search test results by test template name
- value: search test results by output value
- notes: search test result notes
Also adds a unit test to verify search_fields configuration.
* Fix admin search for PartPricing, PartStocktake, PartRelated, and PartTestTemplate
Add search_fields to PartPricingAdmin, PartStocktakeAdmin, PartRelatedAdmin,
and PartTestTemplateAdmin.
- part__name, part__IPN, part__description: search PartPricing
- part__name, part__IPN: search PartStocktake
- part_1__name, part_2__name: search PartRelated
- part__name, test_name, description: search PartTestTemplate
Also adds unit test assertions to verify search_fields configuration.
* Fix admin search for SalesOrderAllocation and ReturnOrderLineItem
Add search_fields to SalesOrderAllocationAdmin and ReturnOrderLineItemAdmin.
SalesOrderAllocationAdmin:
- line__order__reference: search by Sales Order reference
- line__part__name: search by ordered Part name
- item__part__name: search by allocated Stock Item part name
- item__part__IPN: search by allocated Stock Item IPN
- item__serial: search by Stock Item serial number
ReturnOrderLineItemAdmin:
- order__reference: search by Return Order reference
- order__customer__name: search by Customer name
- item__part__name: search by returned Item part name
- item__serial: search by returned Item serial number
- reference: search by line item reference
Also adds list_display improvements and unit tests to verify
search_fields configuration.
* Fix incorrect identity comparison for status validation
Use '!=' (value comparison) instead of 'is not' (identity comparison)
when comparing custom_status.logical_key with self.instance.status.
Python only caches small integers (-5 to 256). For status codes > 256,
'is not' can return True even when values are equal, causing valid
custom status keys to be incorrectly rejected.
Per PEP 8: always use '==' or '!=' for value comparisons.
* Fix wrong super() method call in DataImportColumnMapAdmin
The formfield_for_dbfield method was incorrectly calling
super().formfield_for_choice_field() instead of super().formfield_for_dbfield().
These are different Django admin methods with different expectations.
formfield_for_choice_field expects choice-type fields, but the 'column'
field is a plain CharField. This could cause incorrect form rendering
or errors when viewing DataImportSession detail in Django Admin.
Fix: call the correct parent method formfield_for_dbfield().
* Fix broken delete() method signature on EmailMessage model
The delete() method used '*kwargs' which collects positional arguments
into a tuple named 'kwargs'. This breaks Django's Model.delete()
contract which expects keyword arguments (using=None, keep_parents=False).
When super().delete(*kwargs) was called, keyword arguments passed by
Django internals would be unpacked incorrectly as positional args.
Fix: use standard '*args, **kwargs' signature and pass both to super().
* Fix bare except clause in order status validation
Replace bare 'except:' with 'except Exception:' in
validate_status_custom_key method.
Bare except catches all BaseException subclasses including SystemExit,
KeyboardInterrupt, and MemoryError which should never be silenced.
The get_logical_value() function performs a database .get() call that
can raise ObjectDoesNotExist or MultipleObjectsReturned, both of which
are subclasses of Exception.
This follows PEP 8 (E722: do not use bare except).
* Fix bare except clauses in machine registry and barcode mixins
Replace bare 'except:' with 'except Exception:' in two locations:
- machine/registry.py: hash computation catches AttributeError or
DoesNotExist when a machine config no longer exists
- plugin/base/barcodes/mixins.py: has_barcode_generation property
catches any error from calling generate(None) on a plugin
Bare except catches all BaseException subclasses including SystemExit
and KeyboardInterrupt which should never be silenced.
This follows PEP 8 (E722: do not use bare except).
* Fix readonly_fields typos and add search_fields in admin classes
* Remove redundant admin field test assertions per review feedback
* Fix file formatting and end-of-file newlines per prek style check
---------
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* fix: Show badges for flagged stock items
* Updated badge logic to only display on build order and sales order
* refactor: Remove unused modelRenderer for RenderStockItem in BuildForms and SalesOrderForms
* feat: add piece_count and piece_size fields to BomItem for cut-to-length parts
Manufacturing BOMs frequently require multiple pieces of a specific size
cut from continuous stock (cables, tubing, structural profiles). Currently
the only way to express "10 pieces of 250mm cable" is to enter the total
length (2.5m) as quantity, which loses the piece-count information that
purchasing and production need.
This adds two optional fields to BomItem:
- piece_count: number of discrete pieces required (default: 1)
- piece_size: size/length of each piece (e.g. "250 mm")
When piece_size is specified, the total quantity is auto-calculated as
piece_count × piece_size, maintaining full backward compatibility (existing
items effectively have piece_count=1 and empty piece_size).
Changes:
- Backend: new model fields, migration, updated recalculate_quantity()
logic, hash_fields for BOM validation
- API: serializer exposes piece_count and piece_size
- Frontend: BOM form includes the new fields, BOM table shows them as
optional columns
Addresses #10274
* refactor: simplify to single piece_count field per reviewer feedback
Remove the piece_size field entirely. The existing quantity field already
represents the per-piece size/length, so piece_count multiplied by
quantity gives the total material requirement.
Example: quantity=200mm, piece_count=10 → total 2m of wire in 10 pieces.
Changes:
- Remove piece_size model field, serializer field, and frontend column/form
- Update migration to only add piece_count
- Update get_required_quantity() to multiply by piece_count
- Restore original recalculate_quantity() without piece_size logic
* test/docs: add unit tests and documentation for piece_count field
* style: replace ambiguous × with x to fix RUF002 lint error
* Address review feedback: api_version bump, changelog, style fix
- Bump INVENTREE_API_VERSION to 531 with entry for piece_count field
- Add CHANGELOG.md entry under Unreleased > Added
- Fix RUF001: replace ambiguous × with x in serializers.py help_text
* fix: align piece_count migration help_text with model (RUF001)
The 0153 AddField recorded help_text with a Unicode multiplication sign
(×), while the model field uses plain 'x' after the RUF001 fix. This
mismatch made makemigrations --check flag an unstaged
0154_alter_bomitem_piece_count migration, failing the DB test CI jobs.
Update the original migration's help_text (and docstring) to plain 'x'
so the field definition matches the model, keeping a single clean
migration instead of add-then-alter.
* fix: use set_quantity() in piece_count tests
BomItem.quantity is a derived field, recalculated from raw_amount on
every save() via recalculate_quantity(). Setting item.quantity directly
was overwritten back to the fixture value on save, so the tests computed
against quantity=3 and failed. Use set_quantity() (which sets raw_amount)
to match how quantity is meant to be updated.
* ci: re-trigger CI to confirm Firefox E2E failures are transient
---------
Co-authored-by: Aman Jain <jainamn@amazon.com>