* Adds 'consumable' field to BomItem model
* Add consumable field to API
* Consumable items always count as "allocated" for a build
* Add new BOM fields to BOM item checksum calculation
* Display 'consumable' status in BOM table
* Fix order of database migrations
* Update unit tests
* Fix for BOM table
* Remove "infinite" field from StockItem model
- Not used anywhere for functionality
- Hidden from the user
- Now replaced by the "consumable" concept in the BuildOrder model
* Update build order allocation table display
* Prevent auto-allocation of stock to consumable BOM items
* Ignore consumable BOM items when allocating stock to a build order
* Reimplmement "footer" row for BOM table
* Fix "can_build" calculation
- Ignore "consumable" BOM items
* Unrelated typo fix
* Tweak BOM table
* More visual tweaks to BOM table
* Add unit test for consumable field
* Hard-code URL fforr loadPartParameterTable function
* Improve API efficiency for including parameter data in Part query
* Fix loading of part parameter data into table
* define a simple model mixin class for barcode
* Adds generic function for assigning a barcode to a model instance
* StockItem model now implements the BarcodeMixin class
* Implement simple unit tests for new code
* Fix unit tests
* Data migration for uid field
* Remove references to old 'uid' field
* Migration for removing old uid field from StockItem model
* Bump API version
* Change lookup_barcode to be a classmethod
* Change barcode_model_type to be a class method
* Cleanup for generic barcode scan and assign API:
- Raise ValidationError as appropriate
- Improved unit testing
- Groundwork for future generic implementation
* Further unit tests for barcode scanning
* Adjust error messages for compatibility
* Unit test fix
* Fix hash_barcode function
- Add unit tests to ensure it produces the same results as before the refactor
* Add BarcodeMixin to Part model
* Remove old format_barcode function from Part model
* Further fixes for unit tests
* Add support for assigning arbitrary barcode to Part instance
- Simplify barcode API
- Add more unit tests
* More unit test fixes
* Update unit test
* Adds generic endpoint for unassigning barcode data
* Update web dialog for unlinking a barcode
* Template cleanup
* Add Barcode mixin to StockLocation class
* Add some simple unit tests for new model mixin
* Support assigning / unassigning barcodes for StockLocation
* remove failing outdated test
* Update template to integrate new barcode support for StockLocation
* Add BarcodeMixin to SupplierPart model
* Adds QR code view for SupplierPart
* Major simplification of barcode API endpoints
- Separate existing barcode plugin into two separate classes
- Simplify and consolidate the response from barcode scanning
- Update unit testing
* Yet more unit test fixes
* Yet yet more unit test fixes
* Hide units on part page if units are null
* Hide null units in stock table
* Hide null units in supplier part table
* Hide null units in part tables
* Template cleanup
* Unit test fix
* Specify serializer label
* Add units to part grid view
* improve display of stock units in part table
* Add units display to stock on part page
* Display units in supplier part table
* Simplify stock quantity display in stock table
* Adds 'pack_size' field to SupplierPart model
* Edit pack_size for SupplierPart via API
* Display pack size in supplier part page template
* Improve table ordering for SupplierPart table
* Fix for API filtering
- Need to use custom filter class
* Adds functionality to duplicate an existing SupplierPart
* Bump API version number
* Display annotation of pack size in purchase order line item table
* Display additional information in part purchase order table
* Add UOM to purchase order table
* Improve receive items functionality
* Indicate quantity which will be received in modal form
* Update the received quantity as the user changes the value
* Take the pack_size into account when receiving line items
* Take supplierpart pack size into account when receiving line items
* Add "pack size" column to purchase order line item table
* Tweak supplier part table
* Update 'on_order' queryset annotation to take pack_size into account
- May god have mercy on my soul
* Adds a unit test to validate that the on_order queryset annotation is working as expected
* Update Part.on_order method to take pack_size into account
- Check in existing unit test also
* Fix existing unit tests
- Previous unit test was actually in error
- Logic for calculating "on_order" was broked
* More unit tests for receiving items against a purchase order
* Allow pack_size < 1
* Display pack size when adding / editing PurchaseOrderLineItem
* Fix bug in part purchase order table
* Update part purchase order table again
* Exclude notificationmessage when exporting dataset
* Also display pack size when ordering parts from secondary form
* javascript linting
* Change user facing strings to "Pack Quantity"
* Adds 'description' field to PartParameterTemplate model
* Add 'description' field to API, update settings table
* Bump API version
* Allow more characters in PartParameterTemplate name
* Remove control and non-printable characters from form fields (server side)
* Update regex to properly filter out control characters only
* Add regex lib to requirements flie
* Fix regex in javascript (client side)
* add required unicode flag
* Gotta make a variable to reference a variable
* Fix scaling issues
* Hey, it's only a suggestion
* Fix quantity display in build order table
* Logic fix for destroying / refreshing chart
* Better handling of edge cases
* Fix issue with "undefined" labels
* Speculative should be a question mark
* Handle case where initial API call fails
* Error if scheduling fails to retrieve
* Visual improvements for scheduling graph:
- Fixes for vertical scales
- Add "minimum stock level" line
* Refactor / improve query for list of BOM items a part can exist in
* Remove stock column from "substitute part" dialog
- Stock quantity no longer available in this serailizer
* Add a button to reload part scheduling information
* Add extra information to part scheduling API
- Include "speculative" quantity drawdown for build orders
* Add table of scheduling data
* Improved chart display
- Adds "minimum" and "maximum" expected values
- Adds table of scheduling information
* Bump API version
* Improve table rendering
* Improve axis scaling
* Add ability to dynamically refresh schedling data
* JS linting
* JS fix
* Added icon to stock location
- added `icon` field to `stock_stocklocation` model
- added input field to stock location form
- added icon to breadcrumb treeview in header
- added icon to sub-locations table
- added icon to location detail information
- added `STOCK_LOCATION_DEFAULT_ICON` setting as default
* Added icon to part category
- added `icon` field to `part_partcategory` model
- added input field to part category form
- added icon to breadcrumb treeview in header
- added icon to sub-categories table
- added icon to category detail information
- added `PART_CATEGORY_DEFAULT_ICON` setting as default
* Added `blocktrans` to allowed tags in ci check
* fix: style
* Added `endblocktrans` to allowed tags in ci check
* fix: missing `,` in ci check allowed tags script
* Removed blocktrans from js and fixed style
* Update bleach clean function
- Invalid tags are stripped out
- & > < characters are accepted
* Throw an error if any field contains HTML tags
* Update unit tests
* Added default max depth and lazy loading to StorageLocation
* Added default max depth and lazy loading to PartCategory
* Update API version
* lint: fix
* Added INVENTREE_TREE_DEPTH setting
* Refactored int conversion into own helper function
* Added tests
* Allow part category table to be ordered by part count
* Add queryset annotation for part-category part-count
- Uses subquery to annotate the part-count for sub-categories
- Huge reduction in number of queries
* Update 'pathstring' property of PartCategory and StockLocation
- No longer a dynamically calculated value
- Constructed when the model is saved, and then written to the database
- Limited to 250 characters
* Data migration to re-construct pathstring for PartCategory objects
* Fix for tree model save() method
* Add unit tests for pathstring construction
* Data migration for StockLocation pathstring values
* Update part API
- Add new annotation to PartLocationDetail view
* Update API version
* Apply similar annotation to StockLocation API endpoints
* Extra tests for PartCategory API
* Unit test fixes
* Allow PartCategory and StockLocation lists to be sorted by 'pathstring'
* Further unit test fixes
* switch to pathlib
* more pathlib
* useconvert env to path
* fix typo
* use resolve instead of absolute
* fix gitppod
* also allow parents
* replace more os operations
* fix string replacement feature
* make sure root dirs exsist
* fix replace function
* refactor duplicate code
* reduce code
* make sure dirs exist
* fix typo
* also create parent dirs
* fix match statement
* fix statments expecting string
* return getMigrationFileNames to old behaviour
* fully resolve config file
* make sure comparison works
* use pathlib in tasks
* fix file count test
* reduce code duplication in test + add test for part
* fix test
* re-add os
* Make pathlib usage simpler
* Pre-fill quantity on part ordering form
- Adds new API endpoint for requirement data
- Load data on the fly when launching ordering form
* Bump API version
* Adds configurable setting for maximum remote image size
* Add helper function for downloading image from remote URL
- Will replace existing function
- Performs more thorough sanity checking
* Replace existing image downloading code
- part image uses new generic function
- company image uses new generic function
* Rearrange settings
* Refactor and cleanup existing views / forms
* Add unit testing for image downloader function
* Refactor image downloader forms
- Part image download now uses the API
- Company image download now uses the API
- Remove outdated forms / views / templates
* Increment API version
* Prevent remote image download via API if the setting is not enabled
* Do not attempt to validate or extract image from blank URL
* Fix custom save() serializer methods
* Refactor template helpers for displaying uploaded images
* Unit test for asset tag
* Unit tests for 'uploaded_image' tag
* Add simple tests for part_image and company_image functions
* Unit test for barcode constructor
* Unit tests for qrcode
* Refactor the 'company_logo.png' to be a new template tag
- Add unit tests
* Adds a new field to the report asset model
- Unique key which can be used to identify particular assets
- e.g. company logo
* Refactor logo image tags
- Make use of existing CUSTOM_LOGO setting
- Adds a "logo_image" template tag for reports
* Remove previous migration - strategy no longer required
* Adds a configurable 'reference pattern' to the IndexingReferenceMixin class
* Expand tests for reference_pattern validator:
- Prevent inclusion of illegal characters
- Prevent multiple groups of hash (#) characters
- Add unit tests
* Validator now checks for valid strftime formatter
* Adds build order reference pattern
* Adds function for creating a valid regex from the supplied pattern
- More unit tests
- Use it to validate BuildOrder reference field
* Refactoring the whole thing again - try using python string.format
* remove datetime-matcher from requirements.txt
* Add some more formatting helper functions
- Construct a regular expression from a format string
- Extract named values from a string, based on a format string
* Fix validator for build order reference field
* Adding unit tests for the new format string functionality
* Adds validation for reference fields
* Require the 'ref' format key as part of a valid reference pattern
* Extend format extraction to allow specification of integer groups
* Remove unused import
* Fix requirements
* Add method for generating the 'next' reference field for a model
* Fix function for generating next BuildOrder reference value
- A function is required as class methods cannot be used
- Simply wraps the existing class method
* Remove BUILDORDER_REFERENCE_REGEX setting
* Add unit test for build order reference field validation
* Adds unit testing for extracting integer values from a reference field
* Fix bugs from previous commit
* Add unit test for generation of default build order reference
* Add data migration for BuildOrder model
- Update reference field with old prefix
- Construct new pattern based on old prefix
* Adds unit test for data migration
- Check that the BuildOrder reference field is updated as expected
* Remove 'BUILDORDER_REFERENCE_PREFIX' setting
* Adds new setting for SalesOrder reference pattern
* Update method by which next reference value is generated
* Improved error handling in api_tester code
* Improve automated generation of order reference fields
- Handle potential errors
- Return previous reference if something goes wrong
* SalesOrder reference has now been updated also
- New reference pattern setting
- Updated default and validator for reference field
- Updated serializer and API
- Added unit tests
* Migrate the "PurchaseOrder" reference field to the new system
* Data migration for SalesOrder and PurchaseOrder reference fields
* Remove PURCHASEORDER_REFERENCE_PREFIX
* Remove references to SALESORDER_REFERENCE_PREFIX
* Re-add maximum value validation
* Bug fixes
* Improve algorithm for generating new reference
- Handle case where most recent reference does not conform to the reference pattern
* Fixes for 'order' unit tests
* Unit test fixes for order app
* More unit test fixes
* More unit test fixing
* Revert behaviour for "extract_int" clipping function
* Unit test value fix
* Prevent build order notification if we are importing records
* Bug fix for "multi delete" form
- Was requesting entire LIST endpoint before launching form
- Could cause extremely long delays before window opened
* Improve rendering of "no stock available" in BOM table
* Adds footer row to BOM table
- Display total number of parts
- Display minimum "can build" amount
* Added extra information to footer row
* Annotate 'ordering' quantity to BOM list
- Display this quantity in the BOM table
* Bump API version
* JS linting
* Allow BOM list to be filtered by "on_order" parameter
* Add information showing amount that can be built once orders are received
* Allow searching of BOM List API endpoint
* Bump API version
* Adds ordering field options to BOM List API endpoint
* Add some unit testing for new API features
* Fixes for unit tests
* Fix API filter 'in_bom_for'
- get_parts_in_bom() returns a list, not a queryset
- Thus, we have to enumerate the ID values, rather than filtering by queryset
* Add unit test for part API filter
* Remove stat context variables
* Revert "Remove stat context variables"
This reverts commit 0989c308d0.
* remove old backport
* move requirements
* move isort
* move migrations-tests
* add pip-tools as req and add hook
* Use hashes and also run when txt files are added
* Update to hashes in requirements
* update requirements install path
* remove allauth-2fa for a test
* install dev-requirements
* re-enable allauth
* remove hashes from pre normal setup
* Remove version bindings if they are the laest
* move depencies to upper bound
* fix django-money
* remove windows specific requirements
* also install dependencies
* update markdownify
* remove django-admin-shell
* remove unneeded packages
* add docs
* remove pins and fix pre-commit pipeline
* pin django-money
* really remove admin shell
* return default behaviour for money serializer
* pip fix
* update filter name
* set decimal for output
* add migrations
* pin coveralls
* update requirements
Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
* Add 'virtual': False requirement to sales order items
* Adds "virtual" filter for part table
* Adds extra validation to the SalesOrderLineItem model
* Prevent creation of stock items for virtual parts
- Add validation check to clean() method of StockItem model
- Improve validation message for StockItemSerializer class
* Hide "new stock item" button for virtual parts
* Hide more buttons for 'virtual' parts
* Adds a custom translation node class to strip dirty characters from translated strings
* Update javascript files to use new template tag
* Override behaviour of {% load i18n %}
- No longer requires custom tag loading
- All templates now use escaped translation values
- Requires re-ordering of app loading
- Revert js_i18n to simply i18n
* CI step now lints JS files compiled in each locale
* Checking that the CI step fails
* Revert "Checking that the CI step fails"
This reverts commit ba2be0470d.
* Remove reliance on django-markdownx
- We are now rendering notes on the client side using easymde
- No longer any need to utilize the markdownx integration
- Adds character limit for notes fields`
* Adjust legacy migrations - remove references to markdownx
* Fix bug for company notes field
* Lazy load the pricing bom table when the "pricing" tab is selected
* Update django-debug-toolbar configuration
* Major refactoring for the 'can_build' function
- Use a single annotated query to the db, rather than a for loop (which is what a caveman would use)
- Query performance is greatly improved
- Also refactors existing variant-part-stock subquery code, to make it re-usable
* Use minified JS and CSS where possible
* Render a 'preview' version of each part image
- Saves load time when the image is quite large
- Adds a data migration to render out the new variation
* Adds 'preview' version of company images
* Defer loading of javascript files
Note: some cannot be deferred - jquery in particular
* Crucial bugfix for user roles context
- Previously was *not* being calculated correctly
- A non-superuser role would most likely display pages incorrectly
* Prevent loading of "about" on every page
- Load dynamically when requested
- Takes ~400ms!
- Cuts out a lot of fat
* Match displayed image size to preview image size
* Utilize caching framework for accessing user "role" information
- Reduces number of DB queries required by rendering framework
* Remove redundant query elements
* Remove 'stock' field from PartBrief serializer
- A calculated field on a serializer is a *bad idea* when that calculation requires a DB hit
* Query improvements for StockItem serializer
- Remove calculated fields
- Fix annotations
* Bug fixes
* Remove JS load test
- Loading of JS files is now deferred, so the unit test does not work as it used to
* Fix broken template for "maintenance" page
* Remove thumbnail generation migrations
- Already performed manually as part of ''invoke migrate"
- Running as a migration causes unit test problems
- Not sensible to run this as a data-migration anyway
* tweak for build table
* use shims for API view inheritation
* Add mixin for input sanitation
* fix clean operation to fix all string values
* Also clean up dicts
this is to future-proof this function
* Update docstirng
* proof custom methods against XSS through authenticated users
* Create custom ModelResource subclass
- Strips illegal starting characters from string cells
- Prevents formula injection
* Update all existing ModelResource classes to base off InvenTreeResource
* Handle more complex case where an illegal char is hidden behind another one
* Adds a Part API filter to limit query to valid conversion options for the specified part
* Refactor 'exclude_tree' filter to use django-filter framework
* Refactor the 'ancestor' filter
* Refactoring more API filtering fields:
- variant_of
- in_bom_for
* Adds API endpoint / view / serializer for converting a StockItem to variant
* stock item conversion now perfomed via the API
* Bump API version
* Add unit tests for new filtering option on the Part list API endpoint
* Adds unit test for "convert" API endpoint functionality
* Revert "Remove stat context variables"
This reverts commit 0989c308d0.
* Add a caching framework for inventree settings
- Actions that use "settings" require a DB hit every time
- For example the part.full_name() method looks at the PART_NAME_FORMAT setting
- This means 1 DB hit for every part which is serialized!!
* Fixes for DebugToolbar integration
- Requires different INTERNAL_IPS when running behind docker
- Some issues with TEMPLATES framework
* Revert "Revert "Remove stat context variables""
This reverts commit 52e6359265.
* Add unit tests for settings caching
* Update existing unit tests to handle cache framework
* Fix for unit test
* Re-enable cache for default part values
* Clear cache for further unit tests
* Delete category via the API
* Delete StockLocation via the API
* Delete StockItem via the API
- Removes the final instance of AjaxDelete
* Remove URL path
* Add missing code
* Ensure an error gets logged when a delivery method fails
- Refactor existing code to log a custom error to the database
- Limit error notifications to UI
* Adjust unit test
* Clear existing notifications before run
* Add some debug to work out what is going on
* Accommodate extra notification