* Add BUILDORDER_REQUIRE_RESPONSIBLE setting
- If set, build orders must specify a responsible owner
* Add responsible required setting to other order models:
- PurchaseOrder
- SalesOrder
- ReturnOrder
* Add unit test
* Adjust unit tests
* Settings updates:
- Only check settings for global and user settings
- Plugin settings are not defined at run-time
* typo fix
* More spelling fixes
* Specify responsible owner pk
* Fix stock.js
- Remove incorrect icon code
* Add TEST_STATION_DATA setting
- Controls whether test station fields are added
* Add setting to control test station fields
- Default to off to preserve old behaviour
* Add new setting STOCK_ENFORCE_BOM_INSTALLATION
- Defaults to True (legacy)
* Add logic to bypass BOM check
* Update CUI to reflect new logic
* Render InstalledItemsTable in PUI
* Validate timezone in settings.py
* Add helper functions for timezone information
- Extract server timezone
- Convert provided time to specified timezone
* Add more unit tests
* Remove debug print
* Test fix
* Add report helper tags
- format_date
- format_datetime
- Update report templates
- Unit tests
* Add setting to control report errors
- Only log errors to DB if setting is enabled
* Update example report
* Fixes for to_local_time
* Update type hinting
* Fix unit test typo
* Improve cache loading for setting
- Handle generic exception
- Do not cache if importing data
* More generic exception handling
* Handle more cache exceptions
* Add option to disable the build output completion if required tests not passed
Fixes#5037
* Fix review comments
* Added tests
* Add settinsg option to PUI
* Utilize F" string concatenation
* Add validation to serializer too to being able to generate proper error message in the case if multiple outputs having incomplete tests
* Fix other build tests failing because of the new stock items
* Remove len from array empty check
* Update serializers.py
* Update models.py
Simplify error message
* Update settings.py
Formatting fix
* Update models.py
More style fixes
* Update models.py
Remove empty line
---------
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* Added initial draft for machines
* refactor: isPluginRegistryLoaded check into own ready function
* Added suggestions from codereview
* Refactor: base_drivers -> machine_types
* Use new BaseInvenTreeSetting unique interface
* Fix Django not ready error
* Added get_machines function to driver
- get_machines function on driver
- get_machine function on driver
- initialized attribute on machine
* Added error handeling for driver and machine type
* Extended get_machines functionality
* Export everything from plugin module
* Fix spelling mistakes
* Better states handeling, BaseMachineType is now used instead of Machine Model
* Use uuid as pk
* WIP: machine termination hook
* Remove termination hook as this does not work with gunicorn
* Remove machine from registry after delete
* Added ClassProviderMixin
* Check for slug dupplication
* Added config_type to MachineSettings to define machine/driver settings
* Refactor helper mixins into own file in InvenTree app
* Fixed typing and added required_attributes for BaseDriver
* fix: generic status import
* Added first draft for machine states
* Added convention for status codes
* Added update_machine hook
* Removed unnecessary _key suffix from machine config model
* Initil draft for machine API
* Refactored BaseInvenTreeSetting all_items and allValues method
* Added required to InvenTreeBaseSetting and check_settings method
* check if all required machine settings are defined and refactor: use getattr
* Fix: comment
* Fix initialize error and python 3.9 compability
* Make machine states available through the global states api
* Added basic PUI machine admin implementation that is still in dev
* Added basic machine setting UI to PUI
* Added machine detail view to PUI admin center
* Fix merge issues
* Fix style issues
* Added machine type,machine driver,error stack tables
* Fix style in machine/serializers.py
* Added pui link from machine to machine type/driver drawer
* Removed only partially working django admin in favor of the PUI admin center implementation
* Added required field to settings item
* Added machine restart function
* Added restart requird badge to machine table/drawer
* Added driver init function
* handle error functions for machines and registry
* Added driver errors
* Added machine table to driver drawer
* Added back button to detail drawer component
* Fix auto formatable pre-commit
* fix: style
* Fix deepsource
* Removed slug field from table, added more links between drawers, remove detail drawer blur
* Added initial docs
* Removed description from driver/machine type select and fixed disabled driver select if no machine type is selected
* Added basic label printing implementation
* Remove translated column names because they are now retrieved from the api
* Added printer location setting
* Save last 10 used printer machine per user and sort them in the printing dialog
* Added BasePrintingOptionsSerializer for common options
* Fix not printing_options are not properly casted to its internal value
* Fix type
* Improved machine docs
* Fix docs
* Added UNKNOWN status code to label printer status
* Skip machine loading when running migrations
* Fix testing?
* Fix: tests?
* Fix: tests?
* Disable docs check precommit
* Disable docs check precommit
* First draft for tests
* fix test
* Add type ignore
* Added API tests
* Test ci?
* Add more tests
* Added more tests
* Bump api version
* Changed driver/base driver naming schema
* Added more tests
* Fix tests
* Added setting choice with kwargs and get_machines with initialized=None
* Refetch table after deleting machine
* Fix test
---------
Co-authored-by: Matthias Mair <code@mjmair.com>
* Add basic task for generating apidocs
* Fix SPECTACTULAR_SETTINGS
- Some provided options were not correct
* Update .gitignore
* Fix for duplicated API path
- `/api/plugins/activate` routed to PluginActivate view
- Must be associated with a specific plugin ID
* By default, fail if warnings are raised
* Use GenericAPIView for GetAuthToken
* Use GenericAPIView for RolesDetail endpoint
* Refactor more endpoints to use GenericApiView
* More API cleanup
* Add extra type hints for exposed methods
* Update RoleDetails endpoint
- Specify serializer
- Use RetrieveAPI class type
* More type hints
* Export API docs as part of CI
* add more api views docs
* even more docs
* extend tests to api-version
* simplify serializer
* and more docs
* fix serializer
* added more API docs
* clean diff
* Added APISearch base
* do not assume you know the user
he might be anonymously creating the schema ;-)
* set empty serializer where no input is needed
* Use dummy model for schema generation
* fix OpenAPI docs section
* Update .github/workflows/qc_checks.yaml
Co-authored-by: Matthias Mair <code@mjmair.com>
* REmove duplicate commands
* Ignore warnings in CI
---------
Co-authored-by: Matthias Mair <code@mjmair.com>
* Add method to extract "install name" from a plugin
* Include more information in plugin meta serializer
* Implement better API filtering for PluginConfig list
* Add an "update" button to the plugin table row actions
- Only for "package" plugins
* Adds method to update a plugin:
- Add plugin.installer.update_plugin method
- Add error logging to existing methods
- Add API endpoint and serializer
- Integrate into PUI table
* Implement lazy loading for plugin tables
* Extract package information on registry load
- Info is already available via entrypoint data
- Significantly faster as introspection operation is expensive
- Less code is good code
* Frontend updates
* Add accordion to plugin page
* Add setting to control periodic version check updates
* Update API version info
* Add "package_name" field to PluginConfig
- When the plugin is loaded, save this name to the PluginConfig model
- Update the admin view
* Update API serializer
* Refactor plugin installer code
- Add common functions
* Adds API endpoint for uninstalling an installed plugin
* Allow uninstall of plugin via API
- Add API endpoints
- Add UI elements
* Tweak for admin list display
* Update plugin
* Refactor "update" method
- Just use the "install" function
- Add optional "version" specifier
- UI updates
* Allow deletion of PluginConfig when uninstalling plugin
* Add placeholder for deleting database tables
* Revert code change
- get_object() is required
* Use registry.get_plugin()
- Instead of registry.plugins.get()
- get_plugin checks registry hash
- performs registry reload if necessary
* Add PluginValidationMixin class
- Allows the entire model to be validated via plugins
- Called on model.full_clean()
- Called on model.save()
* Update Validation sample plugin
* Fix for InvenTreeTree models
* Refactor build.models
- Expose models to plugin validation
* Update stock.models
* Update more models
- common.models
- company.models
* Update more models
- label.models
- order.models
- part.models
* More model updates
* Update docs
* Fix for potential plugin edge case
- plugin slug is globally unique
- do not use get_or_create with two lookup fields
- will throw an IntegrityError if you change the name of a plugin
* Inherit DiffMixin into PluginValidationMixin
- Allows us to pass model diffs through to validation
- Plugins can validate based on what has *changed*
* Update documentation
* Add get_plugin_config helper function
* Bug fix
* Bug fix
* Update plugin hash when calling set_plugin_state
* Working on unit testing
* More unit testing
* Fix typo (installing -> uninstalling)
* Reduce default timeout
* set default timeout as part of ApiDefaults
* revert changes to launch.json
* Remove delete_tables field
- Will come back in a future PR
* Fix display of nonFIeldErrors in ApiForm.tsx
* Allow deletion of deleted plugins
- PluginConfig which no longer matches a valid (installed) plugin
* Cleanup
* Move get_plugin_config into registry.py
* Move extract_int into InvenTree.helpers
* Fix log formatting
* Update model definitions
- Ensure there are no changes to the migrations
* Update PluginErrorTable.tsx
Remove unused var
* Update PluginManagementPanel.tsx
remove unused var
* Comment out format line
* Comment out format line
* Fix access to get_plugin_config
* Fix tests for SimpleActionPlugin
* More unit test fixes
* Update plugin/installer.py
- Account for version string
- Remove on uninstall
* Fix
* Use registry.get_plugin()
- Instead of registry.plugins.get()
- get_plugin checks registry hash
- performs registry reload if necessary
* Add PluginValidationMixin class
- Allows the entire model to be validated via plugins
- Called on model.full_clean()
- Called on model.save()
* Update Validation sample plugin
* Fix for InvenTreeTree models
* Refactor build.models
- Expose models to plugin validation
* Update stock.models
* Update more models
- common.models
- company.models
* Update more models
- label.models
- order.models
- part.models
* More model updates
* Update docs
* Fix for potential plugin edge case
- plugin slug is globally unique
- do not use get_or_create with two lookup fields
- will throw an IntegrityError if you change the name of a plugin
* Inherit DiffMixin into PluginValidationMixin
- Allows us to pass model diffs through to validation
- Plugins can validate based on what has *changed*
* Update documentation
* Add get_plugin_config helper function
* Bug fix
* Bug fix
* Update plugin hash when calling set_plugin_state
* Working on unit testing
* More unit testing
* Move get_plugin_config into registry.py
* Move extract_int into InvenTree.helpers
* Fix log formatting
* Update model definitions
- Ensure there are no changes to the migrations
* Comment out format line
* Fix access to get_plugin_config
* Fix tests for SimpleActionPlugin
* More unit test fixes
* bump to dj >4.2
* switch to experimental git release
* bump django-import_export
* bump mptt
* replace is_ajax, which was removed
https://docs.djangoproject.com/en/3.1/releases/3.1/#id2
* Save before accessing values in m2m/fk fields
* move plugin init
* use dev version of django for fix
* update deps
* fix deps
* use django smaller 4.2
* fix reqs
* fix merge
* remove moved code
* another merge fix
* fix ajax call
* fix refs
* change python min v
* fix deps
* bump deps
* fix deps
* pin pillow
* dj 4.1 upgrades
* make diff smaller
* bump all deps
* drop down to py3.9
* bump versions
* merge fix
* fix diff
* more bumping
* diff cleanup
* bump deps
* fix reqs
* use accurate state for model migrations
using apps the historically correct state is used
* try import
* added more logs
* add try here too
* clean up rebuilds
* Dj 4.2 (#161)
* autochanges
* bump
* fix diff
* fix diff
* bump deps
* fix req
* remove select_related to test error influence
* switch to mptt fork
* fix reqs for upstream
* move tracking ensureance into save
* optimize check frequency
* use psycopg instead of psycopg2
* fix header
* just use the values
* switch to dj < 4.2
* fix req
* another req fix
* switch to 4.2 again
* fix merge error
* Check for null pk in calculate_total_price
Cannot access self.lines if pk is Null
* use patched mptt
* try psycopg2 again
* Remove tree rebuild from migrations
* Prevent notify_users if importing or migrating
* Add order_by() to subquery annotations
- Ref: https://stackoverflow.com/a/629691
* Update stock filters
- Append order_by()
* fix error if running without timezones in testing
* add logging to figure this out
* remove tz from self.creation if TZ is off
* add tz?
* move around?
* only run the test i am trying to figure out
not reproducible on my machine
* only run the test i am trying to figure out
not reproducible on my machine
* run all tests again
---------
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
* Fix docs for INVENTREE_SITE_URL
* Adjust default SITE_ID
* Optional support for multi-site
- Disable by default
* Prevent site setting from being changed if set by config parameter
* Update site url setting on server launch
* Update log messages
* Update RULESET_MODELS
* Update unit tests
* More fixes for unit tests
* Update docs
* Update SSO image
* Add option to display full names instead of usernames
* InvenTree Setting added to allow for admins to choose full names
over usernames for display in the web GUI
* Fix FA icon for settings page
* Remove debug print
The use of `else` or `elif` becomes redundant and can be dropped if the last statement under the leading `if` / `elif` block is a `return` statement.
In the case of an `elif` after `return`, it can be written as a separate `if` block.
For `else` blocks after `return`, the statements can be shifted out of `else`. Please refer to the examples below for reference.
Refactoring the code this way can improve code-readability and make it easier to maintain.
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
There shouldn't be any blank lines after the function docstring.
Remove the blank lines to fix this issue.
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
* Update settings API endpoints:
- Use cache to prevent unnecessary hits to db
- Make settings detail endpoints case insensitive
- Update API version
* Remove is_admin and is_superuser
- Contaminated from other commit
* revert seralizers.py
* Revert breaking change to users/api.py
* Improved handling of race condition when saving setting value
* Improvements for managing pending migrations
- Inform user if there are outstanding migrations
- reload plugin registry (if necessary)
* Increase django-q polling time
According to this thread, should reduce multiple workers taking the same task:
https://github.com/Koed00/django-q/issues/183#issuecomment-239676084
* Revert default behavior
* Better logging
* Remove comment
* Update unit test
* Revert maintenance mode behaviour
* raise ValidationError in settings
* Add plugin mixin class for supporting exchange rates
* Split some mixin classes out into their own files
- mixins.py is becoming quite bloated!
* Add some new settings for controlling currency updates
* Adds basic plugin implementation
* Refactor existing implementation
- Builtin plugin uses frankfurter.app API
- Better error / edge case handlign
* Add sample plugin for currency exchange
* Allow user to select which plugin to use for plugin updates
* Observe user-configured setting for how often exchange rates are updated
* Updates for some of the sample plugins
* Fix plugin slug
* Add doc page
* Document simple example
* Improve sample
* Add blank page for currency settings info
* More info in "config" page
* Update docs again
* Updated unit tests
* Fill out default settings values when InvenTree runs
* Add log messages
* Significant improvement in default settings speed
- Use bulk create
- Be efficient
- Dont' be inefficient
* More strict checks
* Refactor default values implementation
- Don't run at startup
- Run on list API
- Implement generic @classmethod
* Allow reload of plugin registry when config changes
- Any global settings which control plugin behaviour trigger reload
- Plugin registry hash includes the value of these settings
- Plugin registry hash is now cached
* typo
* get_setting_object: Handle ProgrammingError
* Improved exception handling
- Address a few cases on application startup if the database is not ready (migrations not applied)
* Fix bug in loading setting from cache
- Need to bring out "cache" key first, otherwise it gets included in the calculated cache key
- Reference: https://github.com/inventree/InvenTree/issues/5586
* Unit test fixes
* Fix missing filters for get settings validator
* merge default model instance filters and kwargs
* Added tests for validators
* Give it a try without the kwargs passed to clean in save function
* Added string for identification for debug statement
* Added more debug comments
* Added more debug prints
* Fix test debug
* Modiefied workflow
* trigger ci
* Fix test and remove unused kwargs
* Added debug prints
* Only run one test in ci
* Added more debug code
* Remove all debug prints and reset workflow
* Reset overlooked file
* Add database model for defining custom units
- Database model
- DRF serializer
- API endpoints
* Add validation hook
* Custom check for the 'definition' field
* Add settings page for custom units
- Table of units
- Create / edit / delete buttons
* Allow "unit" field to be empty
- Not actually required for custom unit definition
* Load custom unit definitions into global registry
* Docs: add core concepts page(s)
* Add some back links
* Update docs
* Add unit test for custom unit conversion
* More unit testing
* remove print statements
* Add missing table rule
* Add skeleton for builtin label printing plugin
* Force selection of plugin when printing labels
* Enhance LabelPrintingMixin class
- Add render_to_pdf method
- Add render_to_html method
* Enhance plugin mixin
- Add class attribute to select blocking or non-blocking printing
- Add render_to_png method
- Add default method for printing multiple labels
- Add method for offloding print job
* Simplify print_label background function
- All arguments now handled by specific plugin
* Simplify label printing API
- Simply pass data to the particular plugin
- Check result type
- Return result
* Updated sample plugin
* Working on client side code
* Cleanup
* Update sample plugin
* Add new model type
- LabelOutput model
- Stores generated label file to the database
- Makes available for download
* Update label printing plugin mixin
* Add background task to remove any old label outputs
* Open file if response contains filename
* Remove "default printer" option which does not specify a plugin
* Delete old labels after 5 days
* Remove debug statements
* Update API version
* Changed default behaviour to background printing
* Update label plugin mixin docs
* Provide default printer if none provided (legacy)
* Update unit test
* unit test updates
* Further fixes for unit tests
* unit test updates
* Added required attribute to settings/plugins, refactor: allValues
- added 'required' attribute to InvenTreeBaseSetting
- added 'check_all_settings'
- added 'all_settings' to get a list of all defined settings
- refactored 'allValues' to use new 'all_settings' function
- added docs for new 'check_setting' function on plugin SettingsMixin
* Fix typing to be compatible with python 3.9
* trigger: ci
* Fixed **kwargs bug and added tests
* Add 'location' filtering option for part.stock_entries
* Add "exclude_external" field to stocktake report
* Add "stocktake_exclude_external" default option
* Implement setting to exclude external stock
* Split stocktake functionality out into separate file
* Change name of internal setting
* Refactoring
* Add 'exclude_external' field to stocktake form
* remove STOCK_RECENT_COUNT parameter
- Now "recent" is set by date
- Tables are paginated by the server
* Display total row count
* remove PART_RECENT_COUNT
- Replace with date filter
- Update Part.api
* Bump API version