* Unit test speed improvements
- Move from insantiating data in setUp to setUpTestData
* Update UserMixin class for API testing
* Bunch of test updates
* Further test updates
* Test fixes
* Add allowances for exchange rate server not responding
* Fixes for group role test
* Bugfix for auto-backup task
- Dont' mix datetime with timezone
* Use different variable names
- If old names are stuck in the database, error could still occur
* Exclude internal settings from API
* Make INVENTREE_LATEST_VERSION setting an internal one
* Add settings to control upcoming stocktake features
* Adds migration for "cost range" when performing stocktake
* Add cost data to PartStocktakeSerializer
Implement a new custom serializer for currency data type
* Refactor existing currency serializers
* Update stocktake table and forms
* Prevent trailing zeroes in forms
* Calculate cost range when adding manual stocktake entry
* Display interactive chart for part stocktake history
* Ensure chart data are converted to common currency
* Adds new model for building stocktake reports
* Add admin integration for new model
* Adds API endpoint to expose list of stocktake reports available for download
- No ability to edit or delete via API
* Add setting to control automated deletion of old stocktake reports
* Updates for settings page
- Load part stocktake report table
- Refactor function to render a downloadable media file
- Fix bug with forcing files to be downloaded
- Split js code into separate templates
- Make use of onPanelLoad functionalitty
* Fix conflicting migration files
* Adds API endpoint for manual generation of stocktake report
* Offload task to generate new stocktake report
* Adds python function to perform stocktake on a single part instance
* Small bug fixes
* Various tweaks
- Prevent new stocktake models from triggering plugin events when created
- Construct a simple csv dataset
* Generate new report
* Updates for report generation
- Prefetch related data
- Add extra columns
- Keep track of stocktake instances (for saving to database later on)
* Updates:
- Add confirmation message
- Serializer validation checks
* Ensure that background worker is running before manually scheduling a new stocktake report
* Add extra fields to stocktake models
Also move code from part/models.py to part/tasks.py
* Add 'part_count' to PartStocktakeReport table
* Updates for stocktake generation
- remove old performStocktake javascript code
- Now handled by automated server-side calculation
- Generate report for a single part
* Add a new "role" for stocktake
- Allows fine-grained control on viewing / creating / deleting stocktake data
- More in-line with existing permission controls
- Remove STOCKTAKE_OWNER setting
* Add serializer field to limit stocktake report to particular locations
* Use location restriction when generating a stocktake report
* Add UI buttons to perform stocktake for a whole category tree
* Add button to perform stocktake report for a location tree
* Adds a background tasks to handle periodic generation of stocktake reports
- Reports are generated at fixed intervals
- Deletes old reports after certain number of days
* Implement notifications for new stocktake reports
- If manually requested by a user, notify that user
- Cleanup notification table
- Amend PartStocktakeModel for better notification rendering
* Hide buttons on location and category page if stocktake is not enabled
* Cleanup log messages during server start
* Extend functionality of RoleRequired permission mixin
- Allow 'role_required' attribute to be added to an API view
- Useful when using a serializer class that does not have a model defined
* Add boolean option to toggle whether a report will be generated
* Update generateStocktake function
* Improve location filtering
- Don't limit the actual stock items
- Instead, select only parts which exist within a given location tree
* Update API version
* String tweaks
* Fix permissions for PartStocktake API
* More unit testing for stocktake functionality
* QoL fix
* Fix for assigning inherited permissions
* Add basic endpoint for group information
* Add hardcoded api-url lookup function for django models
* Adds JS function for rendering a 'group'
* Fix typo
* Add unit tests for new endpoints
* Increment API version
* JS linting
* Ensure 'retry' is always greater than timeout
* Adds setting for controlling how many days between automated backups
* Adds configuration option for max_attempts
* Update for daily backup task
- Prevent backup attempts from ocurring too frequently
- Add setting for controlling how many days between backups
* Exit early
* Adds an API endpoint for manually updating / refreshing currency data from the server
* Update currency rates manually from the settings page
* Add 'last updated' information to the currency exchange backend
* Load currency exchange data via API (on setings page)
* Bump API version
* Table cleanup
* Automatically update exchange rates when base currency is updated
* Adds API endpoint with currency exchange information
* Add unit testing for new endpoint
* Implement javascript code for client-side conversion
* Adds helper function for calculating total price of a dataset
* javascript cleanup
* Add functionality to sales order tables
* JS linting
* Update API version
* Prevent auto currency updates under certain conditions
* Add setting to control pricing calculation from stock items
* Bug fix for displaying a "null" setting
* Add new fields to PartPricing model
* Add code for calculation of min/max stock item costs
* Update pricing display to use stock item pricing
* Add unit testing for new pricing features
* Automatically update pricing when stock item is created or edited
* Increment API version
* Improvements for price rendering
* Update based on feedback:
- Roll stock item pricing into purchase pricing
- Simplify models
- Update unit tests
* Refactor javascript for creating a new part
* Simplify method of removing create fields from serializer
* Fix bug which resulted in multiple model instances being created
* remove custom code required on Part model
* Reorganize existing Part API test code
* Add child serializer for part duplication options
* Part duplication is now handled by the DRF serializer
- Improved validation options
- API is self-documenting (no more secret fields)
- More DRY
* Initial stock is now handled by the DRF serializer
* Adds child serializer for adding initial supplier data for a Part instance
* Create initial supplier and manufacturer parts as specified
* Adding unit tests
* Add unit tests for part duplication via API
* Bump API version
* Add javascript for automatically extracting info for nested fields
* Improvements for part creation form rendering
- Move to nested fields (using API metadata)
- Visual improvements
- Improve some field name / description values
* Properly format nested fields for sending to the server
* Handle error case for scrollIntoView
* Display errors for nested fields
* Fix bug for filling part category
* JS linting fixes
* Unit test fixes
* Fixes for unit tests
* Further fixes to unit tests
* Move to updated Meta mixin
* [FR] Add last updated column for supplier parts
Fixes#3327
* add updated to table
* bump API version
* add missing migration
* incremetn api ;-)
After this change, the Crowdin key will also change and the following
languages need to be updated
ES
msgstr "Eliminar Noficiaciones"
FR
msgstr "Supprimer les noficiations"
HU
msgstr "Értesítések törlése"
NO
msgstr "Slett varsler"
* [SSO] Separate settings for local and social signup
Fixes#4166
* make registration setting configruable
* extend docstring
* add setting to settigns screen
* update check ref
* both settign most be checked
* [FR] Simplify / optimize setting loading
Cache config.yaml data on load and use cached for get_settings
Fixes#4149
* move the cache setting to config
* add docstring
* spell fix
* Add lookup where settings come from
Fixes#3982
* Fix spelling
* Remove stat context variables
* Revert "Remove stat context variables"
This reverts commit 0989c308d0cea9b9405a1338d257b542c6d33d73.
* Allow longer timeout for image download tests
* Create PartStocktake model
Model for representing stocktake entries against any given part
* Admin interface support for new model
* Adds API endpoint for listing stocktake information
* Bump API version
* Enable filtering and ordering for API endpoint
* Add model to permission group
* Add UI hooks for displaying stocktake data for a particular part
* Fix encoded type for 'quantity' field
* Load stocktake table for part
* Add "stocktake" button
* Add "note" field for stocktake
* Add user information when performing stocktake
* First pass at UI elements for performing stocktake
* Add user information to stocktake table
* Auto-calculate quantity based on available stock items
* add stocktake data as tabular inline (admin)
* js linting
* Add indication that a stock item has not been updated recently
* Display last stocktake information on part page
* js style fix
* Test fix for ongoing CI issues
* Add configurable option for controlling default "delete_on_deplete" behaviour
* Add id values to cells
* Hide action buttons (at least for now)
* Adds refresh button to table
* Add API endpoint to delete or edit stocktake entries
* Adds unit test for API list endpoint
* javascript linting
* More unit testing
* Add Part API filter for stocktake
* Add 'last_stocktake' field to Part model
- Gets filled out automatically when a new PartStocktake instance is created
* Update part table to include last_stocktake date
* Add simple unit test
* Fix test
* Various fixes to the "Download image from URL" functionality
This commit adds an user-agent string to the download request wich prevents some sites from
returning a 403 (forbidden) status.
Clicking the download button on the thumbnail, also showed the thumbnail because the event wasn't stopped.
The parts thumbnail didn't update after a succesfull download of the image, reloadImage was never called.
* Fixed copy and paste errors in previous commit
* Reverted back the user-agent immitation from the previous commit
* Add a user-agent overide setting
Add a setting to allow overiding the default user-agent that is used for downloading images and files from a URL
* Fixed a typo in the description
* Another typo fixed
* Removed cast to string to prevent using 'None' as the user-agent
* Thumbnail delete button not visible after upload
The delete button on the image thumbnails of both parts and companies
isn't showing when we upload a new image. This is fixed by always
including the element on the page, and use javascript to show and hide
the element.
* Test for docker workflow
* Ensure yaml is installed in the local env
* Install the right package
* Debug yaml path
* Check data directory first
* Let them run
* More debug info
* Try reverting a recent change
* Disable test
* Check envvar directory
* Remove debug prints
* Re-enable unit test
* Use os.getenv
* Prevent docker workflow from running on pull requests
* Re-add InvenTree.helpers import
* Adds new option for overriding supplier price break pricing data
* Add logic for overriding supplier part pricing with historical information
* Prevent caching
* Change "build stock needed" to off by default on homepage
* Turn off "BOM requires validation" by default
* Hide depleted stock on homepage by default
* Fix docstring for NotificationMessage class
* Fix for 'refresh' button in notification table
* Simplify API for marking notifications as 'read'
- Simply update the detail serializer
- No requirement for extra API endpoints
- Same updates for news feed entry
- Hide 'read' news on the home page
- Add ability to mark news items as read via table
* Bug fix for build.js
* Fix for part category template
* Create new model for storing Part pricing data
Currently this model does not "do" anything but will be used for caching pre-calculated pricing information
* Define function for accessing pricing information for a specific part
* Adds admin site support for new PartPricing model
* Specify role for PartPricing model
* Allow blank values for PartPricing model fields
* Add some TODO entries
* Update migration files to sync with latest master
* Expose API endpoint for viewing part pricing information
* Update migration file
* Improvements:
- Updated model with new fields
- Code for calculating BOM price
- Code for calculating internal price
- Code for calculating supplier price
- Updated unit testing
* Fix (and test) for API serializer
* Including min/max pricing data in part serializer
* Bump API version
* Add pricing overview information in part table
- Adds helper function for formatting currency data
- No longer pre-render "price strings" on the server
* Overhaul of BOM API
- Pricing data no longer calculated "on the fly"
- Remove expensive annotation operations
- Display cached price range information in BOM table
* Filter BOM items by "has pricing"
* Part API endpoint can be filtered by price range
* Updpated API version notes
* Improvements for price caching calculations
- Handle null price values
- Handle case where conversion rates are missing
- Allow manual update via API
* Button to manually refresh pricing
* Improve rendering of price-break table
* Update supplier part pricing table
* Updated js functions
* Adds background task to update assembly pricing whenever a part price cache is changed
* Updates for task offloading
* HTML tweaks
* Implement calculation of historical purchase cost
- take supplier part pack size into account
- improve unit tests
* Improvements for pricing tab rendering
* Refactor of pricing page
- Move javascript functions out into separate files
- Change price-break tables to use bar graphs
- Display part pricing history table and chart
- Remove server-side rendering for price history data
- Fix rendering of supplier pricing table
- Adds extra filtering options to the SupplierPriceBreak API endpoint
* Refactor BOM pricing chart / table
- Display as bar chart with min/max pricing
- Display simplified BOM table
* Update page anchors
* Improvements for BOM pricing table display
* Refactoring sales data tables
- Add extra data and filter options to sales order API endpoints
- Display sales order history table and chart
* Add extra fields to PartPricing model:
- sale_price_min
- sale_price_max
- sale_history_min
- sale_history_max
* Calculate and cache sale price data
* Update part pricing when PurchaseOrder is completed
* Update part pricing when sales order is completed
* Signals for updating part pricing cache
- Whenever an internal price break is created / edited / deleted
- Whenever a sale price break is created / edited / deleted
* Also trigger part pricing update when BomItem is created / edited / deleted
* Update part pricing whenever a supplier price break is updated
* Remove has_complete_bom_pricing method
* Export min/max pricing data in BOM file
* Fix pricing data in BOM export
- Calculate total line cost
- Use more than two digits
* Add pricing information to part export
Also some improvements to part exporting
* Allow download of part category table
* Allow export of stock location data to file
* Improved exporting of StockItem data
* Add cached variant pricing data
- New fields in part pricing model
- Display variant pricing overview in "pricing" tab
* Remove outdated "PART_SHOW_PRICE_HISTORY" setting
* Adds scheduled background task to periodically update part pricing
* Internal prices can optionally override other pricing
* Update js file checks
* Update price breaks to use 6 decimal places
* Fix for InvenTreeMoneySerializer class
- Allow 6 decimal places through the API
* Update for supplier price break table
* javascript linting fix
* Further js fixes
* Unit test updates
* Improve rendering of currency in templates
- Do not artificially limit to 2 decimal places
* Unit test fixes
* Add pricing information to part "details" tab
* Tweak for money formatting
* Enable sort-by-price in BOM table
* More unit test tweaks
* Update BOM exporting
* Fixes for background worker process
- To determine if worker is running, look for *any* successful task, not just heartbeat
- Heartbeat rate increased to 5 minute intervals
- Small adjustments to django_q settings
Ref: https://github.com/inventree/InvenTree/issues/3921
(cherry picked from commit cb26003b92536f67fba640d84aa2a6596d18b4e0)
* Force background processing of heartbeat task when server is started
- Removes the ~5 minute window in which the server "thinks" that the worker is not actually running
* Adjust strategy for preventing recursion
- Rather than looking for duplicate parts, simply increment a counter
- Add a "scheduled_for_update" flag to prevent multiple updates being scheduled
- Consolidate migration files
* Adds helper function for rendering a range of prices
* Include variant cost in calculations
* Fixes for "has_pricing" API filters
* Ensure part pricing status flags are reset when the server restarts
* Bug fix for BOM API filter
* Include BOM quantity in BOM pricing chart
* Small tweaks to pricing tab
* Prevent caching when looking up settings in background worker
- Caching across mnultiple processes causes issues
- Need to move to something like redis to solve this
- Ref: https://github.com/inventree/InvenTree/issues/3921
* Fixes for /part/pricing/ detail API endpoint
* Update pricing tab
- Consistent naming
* Unit test fixes
* Prevent pricing updates when loading test fixtures
* Fix for Part.pricing
* Updates for "check_missing_pricing"
* Change to pie chart for BOM pricing
* Unit test fix
* Updates
- Sort BOM pie chart correctly
- Simplify PartPricing.is_valid
- Pass "limit" through to check_missing_pricing
- Improved logic for update scheduling
* Add option for changing how many decimals to use when displaying pricing data
* remove old unused setting
* Consolidate settings tabs for pricing and currencies
* Fix CI after changing settings page
* Fix rendering for "Supplier Pricing"
- Take unit pricing / pack size into account
* Extra filtering / ordering options for the SupplierPriceBreak API endpoint
* Fix for purchase price history graph
- Use unit pricing (take pack size into account)
* JS fixes
* add model for feed entries
* add task to update feed entries
* Add API routes
* Fix name in model
* rename model
* fix read endpoint
* reduce duplication in NewsFeed API endpoints
* reduce duplicated code
* add ui elements to index
* add missing migrations
* add ressource route
* add new model to admin
* reorder fields
* format timestamp
* make title linked
* reduce migrations to 1
* fix merge
* fix js style
* add model to ruleset
* Add extra setting to guard whether purchase order items can be edited "after the fact"
* Improvements for "extra" purchase order line table
* Similar changes for sales order table
* Improvements for image download helper
(cherry picked from commit 43b0d3ca55fdcf27ada39ccfca0370029e354da7)
* 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
* Coerce setting value to a boolean
* Ignore inactive users when sending notification emails
* Only send UI notifications to active users
* Fixes for unit tests
* 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>
* fix schedule registration
* add collection step for tasks
* make tasks register configurable
* extend docs
* Also run InvenTree setup in testing
* fix import loading method
* fix wrong task registration
* do not test
* do only distinct testing
* ignore import error for coverage
* add comment where feature should be
* add triggermethod for superusers
* Add plugin version warning
* switch to simple error logging
* switch import mechanism
* move import down
* reintroduce db notifications
* adding mising import
* add db entry
* Only log to DB if plugin was regsitered
* fix merge
* remove db logging
* out-of-scope: refactor plugin lookup
* lookup by settings (runtime not predefined)
* Add registry function to set state of plugin quickly
* Ensure plugin is active before assertations