* Allow loading of "builtin" plugins, even if "plugins" are not explicitly loaded
* Updates for 'admin' buttons:
- Make them work like proper links
- Hidden if 'hide_admin_link' customization option is set
- Check for user staff status
* Cleanup rendering of "plugins" display
* Consolidate InvenTree barcode plugins into single plugin class
* Hide "install plugin" button if plugins are not enabled
* Add info message is external plugins are not enabled
* Fixes for loading plugins
- Always load 'builtin' plugins
- Refactor calls to "is_active" at various points in codebase
* Various tweaks
- Improve builtin plugin descriptions
- Spelling fixes
* Adjust plugin detail for builtin plugins
* Simplify barcode plugin class
* Simplify template rendering
* Bug fix for inventree barcode plugin
* Revert "Simplify template rendering"
This reverts commit 3a6755a659fe92963b8bee8378638e28271dd369.
* Re-re-improve template rendering
- Required as the template has been refactored for both "active" and "inactive" plugins
* Fixing unit tests for barcode plugin
* Ensure that barcode scan actions do not take a "long time":
- Add a default timeout of 0.1s to any POST or GET request in the testing framework
- Can be overridden by calling method if desired
* Display plugin "builtin" status in admin panel
* Fix unit tests for plugin API
* Further unit testing fixes
* Version number tweaks
* Further tweaks for unit testing
* Allow longer timeout for report printing via API
* Increase default timeout for API tests
- Sometimes CPU spike can cause the test to fail :|
* label printing can take a bit longer
* Remove timeout requirement from API tester
- Too variable to be reliable for CI
* Reorder action buttons for stock location
* Tweak position of "New Location" button
* Tweak loaction of "New Category" button for part category page
* Working on skeleton for new barcode dialog
* Scan location into location
* Add configurable input delay for processing barcode scan data
* Add new settings for controlling how long logged data is retained
* Update existing tasks to use new user-configurable values
- Also add a task to delete failed task logs
* Add background task to remove old notification logs
* Adds new plugin mixin for performing custom validation steps
* Adds simple test plugin for custom validation
* Run part name and IPN validators checks through loaded plugins
* Expose more validation functions to plugins:
- SalesOrder reference
- PurchaseOrder reference
- BuildOrder reference
* Remove custom validation of reference fields
- For now, this is too complex to consider given the current incrementing-reference implementation
- Might revisit this at a later stage.
* Custom validation of serial numbers:
- Replace "checkIfSerialNumberExists" method with "validate_serial_number"
- Pass serial number through to custom plugins
- General code / docstring improvements
* Update unit tests
* Update InvenTree/stock/tests.py
Co-authored-by: Matthias Mair <code@mjmair.com>
* Adds global setting to specify whether serial numbers must be unique globally
- Default is false to preserve behaviour
* Improved error message when attempting to create stock item with invalid serial numbers
* Add more detail to existing serial error message
* Add unit testing for serial number uniqueness
* Allow plugins to convert a serial number to an integer (for optimized sorting)
* Add placeholder plugin methods for incrementing and decrementing serial numbers
* Typo fix
* Add improved method for determining the "latest" serial number
* Remove calls to getLatestSerialNumber
* Update validate_serial_number method
- Add option to disable checking for duplicates
- Don't pass optional StockItem through to plugins
* Refactor serial number extraction methods
- Expose the "incrementing" portion to external plugins
* Bug fixes
* Update unit tests
* Fix for get_latest_serial_number
* Ensure custom serial integer values are clipped
* Adds a plugin for validating and generating hexadecimal serial numbers
* Update unit tests
* Add stub methods for batch code functionality
* remove "hex serials" plugin
- Was simply breaking unit tests
* Allow custom plugins to generate and validate batch codes
- Perform batch code validation when StockItem is saved
- Improve display of error message in modal forms
* Fix unit tests for stock app
* Log message if plugin has a duplicate slug
* Unit test fix
Co-authored-by: Matthias Mair <code@mjmair.com>
* 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
* refactor entrypoint into helpers
* Add lookup by metadata
This is geared towards plugins packaged in pkgs that differ in name from their top module
* Make module lookup predictable in changing pkg-envs
* remove no coverage from plugin packages
* ignore coverage for production loadin
* refactor plugin collection - move assigment out
* do not cover fs errors
* test custom dir loading
* test module meta fetcher
* add a bit more safety
* do not cover sanity checkers
* add folder loading test
* ignore again for cleaner diffs for now
* ignore safety catch
* rename test
* Add test for package installs
* fix docstring name
* depreciate test for now
* Fix for out of BASE_DIR paths
* ignore catch
* remove unneeded complexity
* add testing for outside folders
* more docstrings and simpler methods
* make call simpler
* refactor import
* Add registry with all plugins
* use full registry and make simpler request
* switch path properties to methods
* Add typing to plugin
* Add a checker fnc for is_sample
* Add sample check to admin page
* Make file check a cls
* more cls methods
* Add setting for signature cheks
Fixes#3520
* make property statements simpler
* use same key in all dicts
* Use module name instead of NAME
Fixes#3534
* fix naming
* fix name
* add version checking
Fixes#3478
* fix formatting and typing
* also save reference to full array
* do not cover as we turn on all plugins
* add test for check_version
* Add version e2e test
* make test save
* refactor out assignment
* safe a db reference first
* docstring
* condense code a bit
* rename
* append logging
* rename
* also safe db reference to new object
* docstrings, refactors, typing
* fix key lookup
* 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
* 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
* 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] Duplication of "base URL" setting
Fixes#3196
Adds after_safe key to settings: this action is executed after the setting is saved. The current setting object is supplied to the function as the first argument.
* Add unittests
* fix style
* ammned allowed keys
* Updates for label printing settings:
- Make LABEL_ENABLE a global setting
- Add LABEL_DPI setting (default = 300)
- Add new global settings tab
* Use the configured DPI when printing labels
* Revert "Remove stat context variables"
This reverts commit 0989c308d0cea9b9405a1338d257b542c6d33d73.
* 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 52e6359265226126da7ed6ed2aed2b83aa33de17.
* 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
* Adds a background task to notify users when a PurchaseOrder becomes overdue
* Schedule the overdue purchaseorder check to occur daily
* Allow notifications to be sent to "Owner" instances
- Extract user information from the Owner instance
* add unit test to ensure notifications are sent for overdue purchase orders
* Adds notification for overdue sales orders
* Clean up notification display panel
- Simplify rendering
- Order "newest at top"
- Element alignment tweaks
* style fixes
* More style fixes
* Tweak notification padding
* Fix import order
* Adds task to notify user of overdue build orders
* Adds unit tests for build order notifications
* Refactor subject line for emails:
- Use the configured instance title as a prefix for the subject line
* Add email template for overdue build orders
* Fix unit tests to accommodate new default value
* Logic error fix
* Add new global setting to control auto-upload of test reports
* Adds callback to attach a copy of the test report when printing
* Fix for all attachment API endpoints
- The AttachmentMixin must come first!
- User was not being set, as the custom 'perform_create' function was never called
* Remove duplicated UserSerializer
* display uploading user in attachment table
* Add unit test to check the test report is automatically uploaded
* Add pre-commit to the stack
* exclude static
* Add locales to excludes
* fix style errors
* rename pipeline steps
* also wait on precommit
* make template matching simpler
* Use the same code for python setup everywhere
* use step and cache for python setup
* move regular settings up into general envs
* just use full update
* Use invoke instead of static references
* make setup actions more similar
* use python3
* refactor names to be similar
* fix runner version
* fix references
* remove incidential change
* use matrix for os
* Github can't do this right now
* ignore docstyle errors
* Add seperate docstring test
* update flake call
* do not fail on docstring
* refactor setup into workflow
* update reference
* switch to action
* resturcture
* add bash statements
* remove os from cache
* update input checks
* make code cleaner
* fix boolean
* no relative paths
* install wheel by python
* switch to install
* revert back to simple wheel
* refactor import export tests
* move setup keys back to not disturbe tests
* remove docstyle till that is fixed
* update references
* continue on error
* add docstring test
* use relativ action references
* Change step / job docstrings
* update to merge
* reformat comments 1
* fix docstrings 2
* fix docstrings 3
* fix docstrings 4
* fix docstrings 5
* fix docstrings 6
* fix docstrings 7
* fix docstrings 8
* fix docstirns 9
* fix docstrings 10
* docstring adjustments
* update the remaining docstrings
* small docstring changes
* fix function name
* update support files for docstrings
* Add missing args to docstrings
* Remove outdated function
* Add docstrings for the 'build' app
* Make API code cleaner
* add more docstrings for plugin app
* Remove dead code for plugin settings
No idea what that was even intended for
* ignore __init__ files for docstrings
* More docstrings
* Update docstrings for the 'part' directory
* Fixes for related_part functionality
* Fix removed stuff from merge 99676ee
* make more consistent
* Show statistics for docstrings
* add more docstrings
* move specific register statements to make them clearer to understant
* More docstrings for common
* and more docstrings
* and more
* simpler call
* docstrings for notifications
* docstrings for common/tests
* Add docs for common/models
* Revert "move specific register statements to make them clearer to understant"
This reverts commit ca9665462202c2d63f34b4fd920013b1457bbb6d.
* use typing here
* Revert "Make API code cleaner"
This reverts commit 24fb68bd3e1ccfea2ee398c9e18afb01eb340fee.
* docstring updates for the 'users' app
* Add generic Meta info to simple Meta classes
* remove unneeded unique_together statements
* More simple metas
* Remove unnecessary format specifier
* Remove extra json format specifiers
* Add docstrings for the 'plugin' app
* Docstrings for the 'label' app
* Add missing docstrings for the 'report' app
* Fix build test regression
* Fix top-level files
* docstrings for InvenTree/InvenTree
* reduce unneeded code
* add docstrings
* and more docstrings
* more docstrings
* more docstrings for stock
* more docstrings
* docstrings for order/views
* Docstrings for various files in the 'order' app
* Docstrings for order/test_api.py
* Docstrings for order/serializers.py
* Docstrings for order/admin.py
* More docstrings for the order app
* Add docstrings for the 'company' app
* Add unit tests for rebuilding the reference fields
* Prune out some more dead code
* remove more dead code
Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
* Allow part list API to be searched by SKU
* Enable manufacturer parts and supplier parts search preview
* Increment API version
* Remove whitespace
* Remove more whitespace
- Remove the GenericReferencedSettingsClass mixin
- Each subclass defines a very simple get_kwargs() method
- Now, at object level *and* class level we can perform lookup of settings and actually get proper data back
- Adds "model" option to setting (precursor of things to come)