Commit Graph

2476 Commits

Author SHA1 Message Date
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
Matt Brown
121c5d107e
Separate unit cost and purchase price in BOM (#3141)
It's possible for a part to have purchase price information, but not supplier
pricing (aka unit prices), but the current BOM price display logic will only
show the purchase prices when supplier prices are also available.

It seems reasonable to separate these two pieces of information - even when no
supplier pricing is available, seeing the purchase prices for BOM components is
useful on its own.
2022-06-06 21:03:15 +10:00
Oliver
1e6bdfbcab
Overdue order notification (#3114)
* 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
2022-06-06 19:12:29 +10:00
Matt Brown
7b4d0605b8
Fix has_complete_bom_pricing logic errors (#3140)
* Fix has_complete_bom_pricing logic errors

There are two logic errors in this property method that have been present since
c6fd228.

1) The get_setting method needs to be called on the InventTreeSetting class in
   common.models, not on the module itself.

2) You cannot call a property method directly passing an argument in Python, so
   the call to has_pricing_info is invalid and always fails. Given that
   has_complete_bom_pricing is/was the only user of that property anyway, fix
   this by just internalising the logic from that property in the method
   directly.

* style nit: use implicit checking for bools

has_complete_bom_pricing is a boolean property, the preferred pythonic style
for if comparisons of this type is not to complete directly to == False, etc
and rely on the implicit truthiness of the type.
2022-06-06 18:57:21 +10:00
Oliver
a066fcc909
Add new global setting to control auto-upload of test reports (#3137)
* 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
2022-06-06 15:20:41 +10:00
Oliver
2b1d8f5b79
Set part category (#3134)
* Refactor function to enable / disable submit button on modal forms

* Category selection now just uses the AP

* Remove unused forms / views

* JS linting fixes

* remove outdated unit test
2022-06-06 13:00:30 +10:00
Oliver
fe8f111a63
Delete part via API (#3135)
* Updates for the PartRelated model

- Deleting a part also deletes the relationships
- Add unique_together requirement
- Bug fixes
- Added unit tests

* Adds JS function to delete a part instance

* Remove legacy delete view

* JS linting
2022-06-06 11:42:22 +10:00
Matthias Mair
f38386b13c
Add more checks to pre-commit (#3132)
* Add bandit to pre-commit checks

* fix catchall exceptions

* remove unused definitons

* remove unuseed ariables

* Add docstring

* fix B006, B008 errors

* fix B007 error

* ignore B009

* Add checks for formatting and naming
2022-06-06 08:56:52 +10:00
Oliver
bbbfd003e0
Convert category parameter forms to use the API (#3130)
* Moving PartCategoryParameterTemplate model to the API

- Add detail API endpoint
- Add 'create' action to LIST endpoint

* Update settings page to use the new API forms

* Remove old views / forms

* Update API version

* Fix table buttons

* Add title to deletion form

* Add unit tests for new API views
2022-06-06 00:25:08 +10:00
Oliver
2e40f3ccf3
Move PartParameterTemplate model to the API (#3123)
* Adds detail API view for the PartParameterTemplate model

* Use API methods rather than server-side forms

* Remove old views / forms

* Update API version
2022-06-03 17:11:19 +10:00
Oliver
5fef6563d8
Bug fix for part category view (#3119) 2022-06-03 00:14:36 +10:00
Oliver
309ed595d7
Queryset annotation refactor (#3117)
* Refactor out 'ordering' serializer annotation field

* Refactor BomItem serializer annotations

* Factor out MPTT OuterRef query

* Add 'available_stock' annotation to SalesOrderLineItem serializer

- Allows for better rendering of stock availability in sales order table

* Improve 'available quantity' rendering of salesorderlineitem table

* Bump API version

* Add docstring
2022-06-02 23:22:47 +10:00
Matthias Mair
0c97a50e47
Docstring checks in QC checks (#3089)
* 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 ca96654622.

* use typing here

* Revert "Make API code cleaner"

This reverts commit 24fb68bd3e.

* 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>
2022-06-02 01:37:39 +10:00
Oliver
a129c650fe
Remove unique-together requirement for BomItem model (#3104)
* Remove unique-together requirement for BomItem model

Ref: https://github.com/inventree/InvenTree/issues/1254

* Update unit test

* Remove unused import
2022-05-31 13:33:23 +10:00
Oliver
02607bd854
Search improvements (#3103)
* 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
2022-05-31 11:51:22 +10:00
Oliver
b9fd263899
Docker improvements (#3042)
* Simplified dockerfile

- Changed from alpine to python:slim
- Removed some database libs (because we *connect* to a db, not host it)

* - Add gettext as required package
- Only create inventree user as part of production build (leave admin access for dev build)

* Tweaks for tasks.py

* Fix user permissions (drop to inventree user)

* Drop to the 'inventree' user level as part of init.sh

- As we have mounted volumes at 'run time' we need to ensure that the inventree user has correct permissions!
- Ref: https://stackoverflow.com/questions/39397548/how-to-give-non-root-user-in-docker-container-access-to-a-volume-mounted-on-the

* Adjust user setup

- Only drop to non-root user as part of "production" build
- Mounted external volumes make it tricky when in the dev build
- Might want to revisit this later on

* More dockerfile changes

- reduce required system packages
-

* Add new docker github workflow

* Print some more debug

* GITHUB_BASE_REF

* Add gnupg to base requirements

* Improve debug output during testing

* Refactoring updates for label printing API

- Update weasyprint version to 55.0
- Generate labels as pdf files
- Provide filename to label printing plugin
- Additional unit testing
- Improve extraction of some hidden debug data during TESTING
- Fix a spelling mistake (notifaction -> notification)

* Working on github action

* More testing

* Add requirement for pdf2image

* Fix label printing plugin and update unit testing

* Add required packages for CI

* Move docker files to the top level directory

- This allows us to build the production image directly from soure
- Don't need to re-download the source code from github
- Note: The docker install guide will need to be updated!

* Fix for docker ci file

* Print GIT SHA

* Bake git information into the production image

* Add some exta docstrings to dockerfile

* Simplify version check script

* Extract git commit info

* Extract docker tag from check_version.py

* Newline

* More work on the docker workflow

* Dockerfile fixes

- Directory / path issues

* Dockerfile fixes

- Directory / path issues

* Ignore certain steps on a pull request

* Add poppler-utils to CI

* Consolidate version check into existing CI file

* Don't run docker workflow on pull request

* Pass docker image tag through to the build

Also check .j2k files

* Add supervisord.conf example file back in

* Remove --no-cache-dir option from pip install
2022-05-29 09:40:37 +10:00
Oliver
643df4761d
Enable 'tree view' for build order table (#3070)
* Enable 'tree view' for build order table

* Ensure we pass locale code to the build table

* Adjust button class based on current context

* Fix display of 'child builds' table on build page

* Force a rebuild of the entire table when the filters are refreshed

* Refactor PurchaseOrder table also

* Refactor existing SalesOrder table also

* JS linting
2022-05-26 15:41:53 +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
Matthias Mair
6247eecf69
Exclude testing exceptions from coverage (#3046)
* exclude testing excetions

* check user str

* check related users

* move no coverage marker

* fix assertation

* add test for filters

* do not cover logs
2022-05-22 15:54:13 +10:00
Matthias Mair
5805685c48 Merge branch 'master' of https://github.com/inventree/InvenTree into style-fixes 2022-05-21 23:57:41 +02:00
Oliver
8eaf172512
Merge pull request #3040 from matmair/test-simplify
Test simplify
2022-05-21 19:41:23 +10:00
Matthias Mair
6ef8c3dc83 run as admin 2022-05-20 19:11:21 +02:00
Matthias Mair
45a9a4d0c5 add in missing class references 2022-05-20 17:55:11 +02:00
Matthias Mair
a148dbf303 refactor 'all' role 2022-05-20 17:43:51 +02:00
Matthias Mair
e1d22f538d resort imports 2022-05-20 17:24:51 +02:00
Matthias Mair
74726f0fda fix endline 2022-05-20 13:35:07 +02:00
Matthias Mair
93b6934127 fix trailing 2022-05-20 13:20:55 +02:00
Matthias Mair
9f922f06ff fix more imports 2022-05-20 12:53:04 +02:00
Matthias Mair
e8287f02d4 rename 2022-05-20 12:33:51 +02:00
Matthias Mair
3a1996dd48 PEP fix 2022-05-20 12:32:25 +02:00
Matthias Mair
0d5dea3e6d refactor test setup 2022-05-20 12:12:32 +02:00
Matthias Mair
e1abdddc4a
Merge branch 'inventree:master' into not-working-tests 2022-05-20 00:28:35 +02:00
Oliver
2ddaa9c04a
Merge pull request #3020 from SchrodingersGat/download-unit-tests
Download unit tests
2022-05-19 13:34:41 +10:00
Matthias
c0ef12f270
only use the user if authenticated 2022-05-18 23:33:04 +02:00
Matthias Mair
67733fa37b
Merge branch 'inventree:master' into not-working-tests 2022-05-18 01:54:00 +02:00
Oliver Walters
b6c2ade940 Add unit test for downloading Part data 2022-05-18 07:52:29 +10:00
Oliver Walters
dc2351748c Merge remote-tracking branch 'inventree/master' into webp-support 2022-05-17 18:48:19 +10:00
Oliver
9bcbaaa5f5 Remove more python2 stuff 2022-05-17 16:57:31 +10:00
Matthias
041128ff9c
pep fix 2022-05-17 01:07:36 +02:00
Matthias
7a2b17e939
do not try to access anon users settings 2022-05-17 01:03:04 +02:00
Matthias Mair
18a263ff75 do a local import 2022-05-16 17:55:45 +02:00
Matthias Mair
a9cfdf8fdb fix import 2022-05-16 17:52:36 +02:00
Matthias Mair
2df049fe05 Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue3005 2022-05-16 17:48:01 +02:00
Matthias Mair
0f5c03e44c use direct import instead of text for offload 2022-05-16 17:45:51 +02:00
Oliver
c51f052f25
Merge pull request #3011 from matmair/matmair/issue2996
Remove python 2 code
2022-05-17 00:51:31 +10:00
Oliver
86c86bf446
Merge pull request #3006 from SchrodingersGat/bom-delete-fix
BOM delete fix
2022-05-16 23:30:22 +10:00
Oliver
042cb021de
Merge pull request #2957 from SchrodingersGat/locate-mixin
Adds plugin mixin to "locate" items
2022-05-16 22:57:20 +10:00
Oliver Walters
6658b89946 Refactor BOM item deletion
- Send delete requests sequentially, rather than simultaneously
- Prevents server overload
- Present a much cleaner dialog to the user
2022-05-16 22:51:34 +10:00
Oliver Walters
7fa83d70ad Fix for broken unit test 2022-05-16 22:14:06 +10:00
Oliver Walters
bd17458f37 Add metadata endpoints for SalesOrder and PurchaseOrder models 2022-05-16 21:40:10 +10:00
Oliver Walters
a52ba05eb7 Add unit test for PartCategory API endpoints 2022-05-16 21:19:01 +10:00
Oliver Walters
37a74dbfef Adds a metadata serializer class for accessing instance metadata via the API
- Adds endpoint for Part
- Adds endpoint for PartCategory
- Adds endpoint for StockItem
- Adds endpoint for StockLocation
2022-05-16 20:59:09 +10:00
Oliver Walters
cd68d5a80e Add metadata mixin to Part and PartCategory models 2022-05-16 19:14:46 +10:00
Matthias
ecccfbd546
Remove encoding header
Fixes #2996
2022-05-15 20:33:00 +02:00
Matthias
136d642703
Merge branch 'fix-boolean' of https://github.com/matmair/InvenTree into fix-boolean 2022-05-15 17:52:34 +02:00
Matthias
77aeecf23a
make operators simpler 2022-05-15 17:52:23 +02:00
Oliver Walters
206da02328 Skip some git hash checks if running tests under docker 2022-05-16 00:21:05 +10:00
Oliver Walters
55f87033b2 Add unit tests for .webp support 2022-05-15 23:36:41 +10:00
Oliver
59cf9825fe Update comment 2022-05-12 15:16:26 +10:00
Oliver
c89547f58c Adds exporter and download functionality for BuildOrder table 2022-05-12 12:44:15 +10:00
Oliver
1b1f7634b7 Adds exporter and download button for PurchaseOrder table 2022-05-12 11:41:25 +10:00
Oliver
465e69c254 Refactor exporters for:
- Part
- PurchaseOrderLineItem
2022-05-12 11:33:17 +10:00
Oliver
db018af0ce Prevent some model based events from triggering during data import 2022-05-10 13:43:16 +10:00
Oliver Walters
db8396564c Further unit test fixes 2022-05-09 20:47:44 +10:00
Oliver Walters
b0d2ece263 Unit test fixes 2022-05-09 20:11:02 +10:00
Oliver Walters
50d8f242bb Fix for unit test 2022-05-07 23:50:41 +10:00
Oliver Walters
06e79ee91b Move view mixin to plugin.views 2022-05-07 22:34:03 +10:00
Oliver Walters
60f799c90a Add plugin view support for most of the remaining views 2022-05-06 23:32:42 +10:00
Oliver Walters
243e3ff37d Fix calls to super() 2022-05-06 23:32:09 +10:00
Oliver Walters
0797e9ebf0 Simplify the new template rendering
- No extra template code is required for any new page
- All loaded in base.html or page_base.html
- Oh, so clean!
2022-05-06 23:19:21 +10:00
Oliver Walters
71128a1c8e Refactor the plugin javascript template
- Can appear in "base.html"
- Only renders anything if there are actually plugins available for the page
2022-05-06 22:57:15 +10:00
Oliver Walters
c80b36fc2f Adds a new InvenTreePluginMixin mixin class for enabling custom plugin rendering on a page
- Any view which needs custom plugin code must implement this mixin
- Initially implement for the PartDetail page
2022-05-06 22:52:52 +10:00
Oliver
9e1d8e52f3
Merge pull request #2805 from matmair/matmair/issue2385
Plugins for notifications
2022-05-06 20:00:56 +10:00
Oliver
1b7172b57e
Merge pull request #2936 from matmair/test_tags
Test more templatetags
2022-05-06 12:16:14 +10:00
Matthias
09ceada639
fix test assertation 2022-05-06 03:03:08 +02:00
Matthias
2261e7a615
PEP fix 2022-05-06 02:20:38 +02:00
Matthias
33e3385830
fix assertations 2022-05-06 02:17:53 +02:00
Matthias
20d552f809
extend tag tests 2022-05-06 02:13:25 +02:00
Matthias
0eff4a4526
can not be covered in testing 2022-05-06 02:07:59 +02:00
Matthias
1676cb8eb8
fix error with anon connections and language check 2022-05-06 00:13:58 +02:00
Matthias
28b8e27698
Merge branch 'matmair/issue2385' of https://github.com/matmair/InvenTree into matmair/issue2385 2022-05-06 00:11:38 +02:00
Matthias
fe4b264ae1
Fix user check 2022-05-06 00:11:26 +02:00
Matthias Mair
6bd997ffad
Merge branch 'inventree:master' into matmair/issue2385 2022-05-05 11:26:25 +02:00
Oliver
1dee578907
Merge pull request #2931 from SchrodingersGat/more-api-functionality
Converting more forms to the API
2022-05-04 23:24:28 +10:00
Matthias Mair
a6bede877a
Merge branch 'inventree:master' into matmair/issue2385 2022-05-04 15:11:56 +02:00
Oliver Walters
82541ede32 More unit tests
- BuildOrderCancel
- StockItemInstall
- StockItemUninstall
2022-05-04 22:49:21 +10:00
Matthias
1a3d482e42
Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2788 2022-05-04 12:33:21 +02:00
Matthias Mair
cf93ba7cf9
Merge branch 'inventree:master' into matmair/issue2385 2022-05-04 12:23:05 +02:00
Oliver Walters
5cf30a850d Prune a lot of dead code 2022-05-04 17:01:19 +10:00
Oliver Walters
f0e8e32c8a More refactoring 2022-05-03 17:27:21 +10:00
Matthias
e7b189ba29
fix templates 2022-05-02 22:41:24 +02:00
Matthias Mair
4125803e6d
Merge branch 'inventree:master' into matmair/issue2385 2022-05-02 21:50:52 +02:00
Oliver Walters
e87a02638e Merge remote-tracking branch 'inventree/master' into order-parts-wizard
# Conflicts:
#	InvenTree/order/serializers.py
#	InvenTree/templates/js/translated/model_renderers.js
2022-05-02 16:11:11 +10:00
Matthias
de6507e918
update translation commands 2022-05-01 22:03:49 +02:00
Matthias
67ab45bdee
update depreciated paths 2022-05-01 22:00:18 +02:00
Matthias
d05472b30c
upgrade to pyhton 3.9 syntax
using pyupgrade
2022-05-01 21:53:12 +02:00
Matthias Mair
c18579088a
Merge branch 'inventree:master' into matmair/issue2385 2022-04-30 19:53:32 +02:00
Oliver
6538ab86cb Bug fix for 'required' filter in PartTestTemplate API 2022-04-28 16:25:04 +10:00
Oliver
e9500e4981
Merge pull request #2892 from SchrodingersGat/build-allocation-fix
Fix part allocation check
2022-04-28 15:21:02 +10:00
Oliver
aec10e0cc7 Fix part allocation check 2022-04-28 14:58:05 +10:00