2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-05 14:58:50 +00:00

154 Commits

Author SHA1 Message Date
Oliver
175d9555b0
Tree query improvements (#3443)
* 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
2022-08-01 13:43:27 +10:00
Oliver
648faf4ed2
Reference fields (#3267)
* 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
2022-07-11 00:01:46 +10:00
Oliver
76aa3a75f2
Merge pull request from GHSA-fr2w-mp56-g4xp
* Enforce file download for attachments table(s)

* Enforce file download for attachment in 'StockItemTestResult' table
2022-06-15 18:31:56 +10:00
Oliver
090f4f4387
Converting more forms to the API (#3181)
* 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
2022-06-11 21:53:26 +10:00
Oliver
258957c14c
SupplierPart availability (#3148)
* Adds new fields to the SupplierPart model:

- available
- availability_updated

* Allow availability_updated field to be blank

* Revert "Remove stat context variables"

This reverts commit 0989c308d0cea9b9405a1338d257b542c6d33d73.

* Increment API version

* Adds availability information to the SupplierPart API serializer

- If the 'available' field is updated, the current date is added to the availability_updated field

* Add 'available' field to SupplierPart table

* More JS refactoring

* Add unit testing for specifying availability via the API

* Display availability data on the SupplierPart detail page

* Add ability to set 'available' quantity from the SupplierPart detail page

* Revert "Revert "Remove stat context variables""

This reverts commit 3f98037f7947aa4c85cf4008c2d216d034987f2e.
2022-06-08 21:49:07 +10:00
Oliver
00b75d792e
Adds API mixin for "bulk delete" (#3146)
* Introduces a BulkDelete API mixin class

- Allows deletion of multiple items against a single API request

* Bump API version

* Adds BulkDelete mixin to StockItemTestResult API class

* refactor "multi BOM Item delete" to use new approach

* Refactor various attachment API endpoints

* Refactor multi delete for StockItem

* Convert remaining enndpoints over

* Fix for API test code
2022-06-07 07:25:12 +10:00
Oliver
2d1776a151
Refactor 'DeleteManufacturerPart' form (#3067)
* Refactor 'DeleteManufacturerPart' form

- Remove duplicated forms
- Update style to match other forms
- Block on each deletion before progressing to the next one

* PEP fix

* Adds deleteSupplierParts function

* Refactor all instances of supplier part deletion

* Refactor tractor : use convenience function for bootstraptable.getSelections

* Add deleter for manufacturerpartparameter.

Refactor existing code into a single function

* Refactor deletion for stock items

* JS linting
2022-05-25 23:35:53 +10:00
Oliver
ea9f2f81f1
Stock available (#3057)
* Fix display of stock labels

- If 'shipped' or 'installed', don't display 'allocated' flag

* Switch stock item data around

* Add 'available' and 'allocation' information to the StockItem detail page

- Cache some context data to the view renderer

* Stock table now also displays allocation informatoin
2022-05-24 15:35:04 +10:00
Matthias Mair
93b6934127 fix trailing 2022-05-20 13:20:55 +02:00
Oliver Walters
adbcd68fe8 Refactor "uninstall stock item" form to use the API 2022-05-04 17:25:24 +10:00
Oliver Walters
96c5a8252c remove dead code 2022-05-03 17:33:03 +10:00
Oliver Walters
1fb94bf04b Allow "tracked" stock items to be installed, rather than just serialized 2022-04-19 20:35:54 +10:00
Oliver Walters
0e67ea8e95 Change ordering of stock item form fields 2022-04-19 20:28:45 +10:00
Oliver Walters
1dfbd30294 Bug fix for displaying batch information 2022-04-19 17:53:58 +10:00
Oliver
5240c60e0b Render part information in stock item tracking table (if provided) 2022-04-19 13:14:54 +10:00
Oliver
e5eb1f4513 Adds button to refresh stock item tracking table 2022-04-19 13:09:14 +10:00
Oliver Walters
6beea0a557 Render batch code in stock adjustment dialog 2022-04-18 22:56:31 +10:00
Oliver Walters
18de4676dc Explicitly mark "parent" field in PartCategory and StockLocation as not required in API form fields 2022-04-15 19:22:06 +10:00
Oliver
dfa3bbf655 Add ability to include test results from "installed items" in table 2022-04-14 12:49:27 +10:00
Oliver
7dae05acc5 Fix for scanItemsIntoLocation function
- Accept list of objects rather than pk values
- Conform to API requirements
2022-04-04 16:20:19 +10:00
Oliver Walters
5b949b6f60 Fix sorting for location column in part table 2022-03-27 07:45:45 +11:00
Oliver
e2179fb4d1 Fixes for display of allocation tables (build order and / or sales order)
- Hide these tables where they do not make sense for a given Part or StockItem
- Remove redundant "loadStockAllocationTable" function
2022-03-16 23:25:51 +11:00
Oliver
d1338e210e Only display "outstanding" sales order allocations in table 2022-03-16 23:01:46 +11:00
Oliver
c699e208cf JS linting 2022-03-09 10:41:07 +11:00
Oliver
d56fed3211 Fixes for "duplicate stock item" form
- Redirect to the new stock item
- Display a success message
2022-03-09 10:34:47 +11:00
Oliver
ba406a4da9 Refactorin'
- Add the "download" button into the "filters" list
- Cuts down on boilerplate code
2022-03-03 21:16:27 +11:00
Oliver
8bf84ec217 Remove calls to "exportStock" 2022-03-03 17:25:31 +11:00
Oliver
7d19b21dff JS linting 2022-02-28 19:22:22 +11:00
Oliver
fd02f1b761 Add option for display of "time" in addition to date 2022-02-28 19:14:20 +11:00
Oliver
040f1805e0 Pass dates displayed in front-end tables through the date formatter 2022-02-28 16:13:08 +11:00
Oliver
88bb0f05e9 URL fixes 2022-02-25 16:00:00 +11:00
Oliver
0604e1a127 Adds API endpoint for installing stock items into other stock items
- Requires more filtering for the Part API
- Adds more BOM related functionality for Part model
- Removes old server-side form
2022-02-17 17:03:17 +11:00
Oliver
6199223636 Adds "refresh" button for stock test table 2022-02-17 13:46:11 +11:00
Oliver
578c161d4f Adds information on test result being deleted 2022-02-17 13:36:00 +11:00
Oliver
0f0325daba Adds a button to quickly "pass" a test 2022-02-16 17:16:17 +11:00
Oliver
22892565ed JS linting fixes 2022-01-28 08:28:52 +11:00
Oliver
f6ffef66e0 Fixes for new "allocation" tab
- Fix broken link
- Add "description" column
- Add thumbnail images
2022-01-27 16:25:26 +11:00
Oliver
5ec1d5aab8 Display allocations for individual stock items 2022-01-27 15:21:04 +11:00
Oliver
60cde7fe13 Includes sales order allocation data 2022-01-27 15:01:26 +11:00
Oliver
c43d1840ea Load table of build order allocations 2022-01-27 14:55:19 +11:00
Oliver
ff7a75266b Fixes for stock location forms 2022-01-08 20:28:57 +11:00
Oliver
46aeafb5da Adds filter for "assigned stock" view on customer page 2021-12-21 16:44:49 +11:00
Oliver
fcb2bb2a46 Fix behaviour on deleting parent stock item 2021-12-21 01:03:37 +11:00
Oliver
552ca8e5c4 Adds javascript function to merge multiple stock items together 2021-12-20 22:09:08 +11:00
Oliver
c060bc0815 Float "depleted" badge to the right 2021-12-20 13:30:54 +11:00
Oliver
c1163b9f6b Adds missing semicolon 2021-12-09 09:07:36 +11:00
Oliver
4a453b0a35 Assign multiple stock items to a customer at one 2021-12-09 00:33:45 +11:00
Oliver
96a885e4e1 client side form for assigning stock items to customers 2021-12-09 00:20:45 +11:00
Oliver
e74e7138a9 More stuff:
- Pass tracking number through when completing a shipment
- Reload tables automatically when certain actions are performed
- Limit stock items to only those with available stock
2021-12-02 21:59:59 +11:00
Oliver
d5ace1a8da Differentiate between "fully allocated" and "partially allocated" in stock item table 2021-12-02 21:46:05 +11:00