Commit Graph

147 Commits

Author SHA1 Message Date
Oliver
9e77b9fc56
Parameter filtering (#4823)
* adds new field 'parameter type' to PartParameterTemplate model

* Move part parameter settings onto their own page

* Add "choices" and "regex" template types

* Adds validation for PartParameter based on template type

* javascript cleanup

* Fix for serializers.py

* Add unit testing for parameter validation

* Add filters

* Rename "type" field to "param_type"

- Should have seen that one coming

* Coerce 'boolean' value to True/False

* table update

* js linting

* Add requirement for "pint" package

* Add validator for physical unit types

- Revert a previous migration which adds "parameter type" and "validator" fields
- These will get implemented later, too much scope creep for this PR
- Add unit test for validation of "units" field

* Update PartParameter model

- Add data_numeric field (will be used later)
- Add MinLengthValidator to data field

* Run validation for part parameter data

- Ensure it can be converted to internal units

* Update admin interface to display partparameter values inline for a part

* Adds validation of part parameter data value

- Also converts to base units, and stores as "numeric" value
- Display "numeric" value in tables
- Create new file conversion.py for data conversion

* Update unit tests and fix some bugs

* Update docstring

* Add units to parameter columns in parameteric part table

* Allow part list to be ordered by a particular parameter value

- Annotate queryset with new "order_by_parameter" method
- Skeleton method for future work

* Bump API version

* Adds unit testing for sorting parts by parameter value

* Update historical data migrations

- Turns out RunPython.noop is a thing?

* Cache the unit registry

- Creating the unit registry takes a significant amount of time
- Construct when first called, and then cache for subsequent hits
- Massive improvement in performance

* Throw error on empty values when converting between units

* Data migration for converting existing part parameter values

* Handle more error cases

* Show parameteric table on top-level part page too

* Unit test for data migration

* Update credits in docs

* Improved error checking

* WIP docs updates

* Fix parameteric table filtering

* remove zoom property

* Fix for import path

* Update parameter docs

* Run background task to rebuild parameters when template changes

* Make "data_numeric" field nullable

- Defaulting to zero is not appropriate, as the actual value may be zero
- Sorting still seems to work just fine

* Fixes for unit test

* More unit test fixes

* Further fixes for unit tests

---------

Co-authored-by: Matthias Mair <code@mjmair.com>
2023-05-19 13:24:55 +10:00
Oliver
e2505433a2
Docker build fix (#4811)
* Attempt to fix crypto build on raspbian

* Run CI if requirements files change
2023-05-15 08:27:26 +10:00
Oliver
41cef1a190
Add reload functionality for build item table (#4799)
* Add reload functionality for build item table

* Update requirements.txt file

(cherry picked from commit c976d06ec75d17e4c2fd4e557eb0bda858ae391e)
2023-05-12 14:29:29 +10:00
dependabot[bot]
306f36bff8
Bump django from 3.2.18 to 3.2.19 (#4795)
Bumps [django](https://github.com/django/django) from 3.2.18 to 3.2.19.
- [Commits](https://github.com/django/django/compare/3.2.18...3.2.19)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-05-10 08:21:59 +10:00
Matthias Mair
f5c2591fd4
Add 'Tag' management (#4367)
* 'Tag' management
Fixes #83

* Add for ManufacturerPart, SupplierPart

* Add tags for StockLocation, StockItem

* fix serializer definition

* add migrations

* update pre-commit

* bump dependencies

* revert updates

* set version for bugbear

* remove bugbear

* readd bugbear remove isort

* and remove bugbear again

* remove bugbear

* make tag fields not required

* add ruleset

* Merge migrations

* fix migrations

* add unittest for detail

* test tag add

* order api

* reduce database access

* add tag modification test

* use overriden serializer to ensuer the manager is always available

* fix typo

* fix serializer

* increae query thershold by 1

* move tag serializer

* fix migrations

* content_types are changing between tests - removing them

* remove unneeded fixture

* Add basic docs

* bump API version

* add api access to the docs

* add python code

* Add tags to search and filters for all models
2023-05-04 09:02:48 +10:00
Matthias Mair
660a4f8e39
bump deps (#4692)
* bump deps

* add markuplint setting to disable character-reference
2023-04-28 20:12:13 +10:00
Matthias Mair
9d5522c18c
[FR] Update to OpenAPI from CoreAPI (#4178)
* [FR] Update to OpenAPI from CoreAPI
Fixes #3226

* factor request function out

* add schema export task

* add api-docs

* add action to check if diff occured

* also wait for docstyle

* use full command

* add envs for inventree

* update inventree before running

* use relative path

* remove schema action

* remove tags to fit 3.0 parsers

* fix url base name for reloads

* revert change in plugin resolver

* remove unused tags

* add rapidoc too

* declare api regex

* fix as suggested by @martonmiklos in
https://github.com/inventree/InvenTree/pull/4178#discussion_r1167279443

* set inventree logo

* remove Rapidoc
2023-04-18 23:08:36 +10:00
Oliver
eef303dfea
Cryptography version update (#4568)
* Update required cryptography library version

* remove old env variable from dockerfile

- Was required when we based on alpine linux
- now we use python_slim

* Fix file contents
2023-04-04 07:04:10 +10:00
Matthias Mair
58e9065b41
Update deps (#4559)
* update deps

* fix hash
2023-04-03 07:13:01 +10:00
Matthias Mair
32be1b2035
Update dependencies (#4368)
* update reqs

* bump pre-commit

* remove bugbear
2023-02-19 21:33:04 +11:00
Oliver
c4a8697a5a
Django q sentry (#4296)
* add requirement for django-q-sentry

* Add sentry integration for django-q
2023-02-03 07:14:37 +11:00
Matthias Mair
ccf784d36c
Dep updates (#4176)
* test bumping deps

* bump dep file

* readd old pointer

* update pre-commit

* update req

* update dev req
2023-01-09 08:23:43 +11:00
Matthias Mair
d50bf60826
Issues with maintenance_mode.txt (#4148)
* Issues with maintenance_mode.txt
Fixes #3618

* Update django-maintenance-mode to fix maintenante mode problems

Issues with maintenance_mode.txt
Fixes #3618
2023-01-05 06:46:59 +11:00
Oliver
6fb7c85949
Update django-allauth lib version (#4141)
* Update django-allauth lib version

* Clean up requirements file

* Capital, capital
2023-01-04 06:47:58 +11:00
miggland
fdc4a46b26
Calendar export (#3858)
* Basic implementation of iCal feed

* Add calendar download to API

* Improve comments, remove unused outputs

* Basic implementation of iCal feed

* Add calendar download to API

* Improve comments, remove unused outputs

* Improve comment

* Implement filter include_completed

* update requirements.txt with pip-compile --output-file=requirements.txt requirements.in -U

* Fix less than filter

* Change URL to include calendar.ics

* Fix filtering of orders

* Remove URL/functions for calendar in views

* Lint

* More lint

* Even more style fixes

* Updated requirements-dev.txt because of style fail

* Now?

* Fine, fix it manually

* Gaaah

* Fix with same method as in common/settings.py

* Fix setting name; improve name of calendar endpoint

* Adapt InvenTreeAPITester get function to match post, etc (required for calendar test)

* Merge

* Reduce requirements.txt

* Update requirements-dev.txt

* Update tests

* Set expected codes in API calendar test

* SO completion can not work without line items; set a target date on existing orders instead

* Correct method to PATCH

* Well that didn't work for some reason.. try with cancelled orders instead

* Make sure there are more completed orders than other orders in test

* Correct wrong variable

* Lint

* Use correct status code

* Add test for unauthorized access to calendar

* Add a working test for unauthorised access

* Put the correct test in place, fix Lint

* Revert changes to requirements-dev, which appear magically...

* Lint

* Add test for basic auth

* make sample simpler

* Increment API version

Co-authored-by: Matthias Mair <code@mjmair.com>
2022-12-21 23:17:27 +11:00
Matthias Mair
fb77158496
Add news reader (#3445)
* 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
2022-11-10 12:20:06 +11:00
Matthias Mair
182bc29053
Add db an media backups (#3783)
* [FR] Add backup into inventrees lifecycle
Fixes #3778

* Add env to testing enviros

* block backup from running app commands

* Add more commands

* fix postgres version

* Update used env

* add daily task to run backups

* add installer changes
2022-10-17 00:09:31 +11:00
Matthias Mair
fccbcad63f
Update deps to newest releases (#3782)
* update django to newest release

* security update for oauthlib

* Update possible deps
2022-10-13 11:07:06 +11:00
Oliver
69c3e5e222
Remove hidden characters from form fields (#3597)
* Remove control and non-printable characters from form fields (server side)

* Update regex to properly filter out control characters only

* Add regex lib to requirements flie

* Fix regex in javascript (client side)

* add required unicode flag
2022-08-24 15:12:02 +10:00
Oliver
87e7112326
Fix weasyprint version (#3539)
* Pin weasyprint version

- Revert to 54.3
- Fixes https://github.com/inventree/InvenTree/issues/3528

* Simplify label printing for multiple pages

* Simplify PDF generation for multiple report outputs

* Add content wrapper div for base label template

- Allows more extensibility
2022-08-15 11:27:27 +10:00
Matthias Mair
12a321ed4f
Depenency updates (#3472)
* update requirements

* automate everything
2022-08-06 09:26:27 +10:00
Oliver
67732f8f81
Remove custom 2FA code (#3300)
* Update django-allauth-2fa to latest version

* Remove custom view / form for removing token

* Revert "2FA disable" view to custom view

- Allows specification of custom redirect URL
2022-07-11 10:26:41 +10:00
Oliver
412fdf246a
Bump django version (#3299) 2022-07-06 10:10:09 +10:00
Oliver
830ecd5677
Update package requirements for docker (#3285)
* Include cargo / rustc in the docker image

- Otherwise cryptography library seems to fail

* Revert cryptography lib to older version

- New version requires rust, adds ~300MB to the image size!
2022-07-03 21:44:40 +10:00
Oliver
efbef2dc90
Pin django-stdimage to sub 6.0.0 (#3273)
* Pin django-stdimage to sub 6.0.0

- 6.0.0 breaks model serialization for background worker task
- NFI why it does this

* Fix requirements file

* remove windows deps. and append requirements

* Add unit tests for encoding and offloading tasks

Co-authored-by: Matthias <code@mjmair.com>
2022-06-29 20:47:06 +10:00
Matthias Mair
cf70e4220f
Update requirements (#3228)
* Remove stat context variables

* Revert "Remove stat context variables"

This reverts commit 0989c308d0.

* remove old backport

* move requirements

* move isort

* move migrations-tests

* add pip-tools as req and add hook

* Use hashes and also run when txt files are added

* Update to hashes in requirements

* update requirements install path

* remove allauth-2fa for a test

* install dev-requirements

* re-enable allauth

* remove hashes from pre normal setup

* Remove version bindings if they are the laest

* move depencies to upper bound

* fix django-money

* remove windows specific requirements

* also install dependencies

* update markdownify

* remove django-admin-shell

* remove unneeded packages

* add docs

* remove pins and fix pre-commit pipeline

* pin django-money

* really remove admin shell

* return default behaviour for money serializer

* pip fix

* update filter name

* set decimal for output

* add migrations

* pin coveralls

* update requirements

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-06-28 22:12:00 +10:00
Matthias Mair
7283197bac
MFA remove improvement (#3239)
* temporary fix for GHSA-8j76-mm54-52xq

* return to setting afterwards
2022-06-23 12:21:10 +10:00
Oliver
63b4ff3eb6
Remove reliance on django-markdownx (#3231)
* Remove reliance on django-markdownx

- We are now rendering notes on the client side using easymde
- No longer any need to utilize the markdownx integration
- Adds character limit for notes fields`

* Adjust legacy migrations - remove references to markdownx

* Fix bug for company notes field
2022-06-20 22:20:04 +10:00
Oliver
18cf92ec8b
Update django-allauth to 0.48.0 (#3217)
* Update django-allauth to 0.48.0

* Update allauth settings
2022-06-18 12:30:59 +10:00
Oliver
0d01ea2f2e
Auth forms fix (#3214)
* Improvement and consolidation of various auth forms

* Update "disable 2FA" page to use form fields

Note: Requires merging of https://github.com/valohai/django-allauth-2fa/pull/135

* Update django-allauth-2fa requirements
2022-06-17 11:33:45 +10:00
Matthias Mair
90aa7b8444
Sentry (#3174)
* Add sentry for optional error reporting
Closes https://github.com/inventreedb/org/issues/3
Heavily inspired by https://github.com/netbox-community/netbox/issues/9340

* do not consider optional stuff in coverage

* Add DSN for inventree org

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-06-11 23:13:13 +10:00
dependabot[bot]
bc8777f93c
Bump pillow from 9.1.0 to 9.1.1 (#3113)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.1.0 to 9.1.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.1.0...9.1.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-02 10:40:43 +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
Matthias
3fd5761089
Merge branch 'master' of https://github.com/inventree/InvenTree into devOps 2022-05-18 23:39:58 +02:00
Oliver Walters
dc2351748c Merge remote-tracking branch 'inventree/master' into webp-support 2022-05-17 18:48:19 +10:00
Matthias
545756eacb
add docstring testing 2022-05-16 01:20:04 +02:00
Matthias
af6eac8cc9
Add isort 2022-05-16 01:12:19 +02:00
Matthias
f1553337f7
add pre-commit 2022-05-16 00:15:25 +02:00
Oliver Walters
495798dc98 Install libwebp-dev as part of dockerfile 2022-05-15 23:20:12 +10:00
Kalman Rozsahegyi
32febb010c Fix a wrong merge in requirements.txt 2022-04-28 22:15:11 +02:00
Kalman Rozsahegyi
9e1a143132 Merge branch 'master' into feat-qr-scanner 2022-04-28 22:14:11 +02:00
Kalman Rozsahegyi
5b5a39568b Merge branch 'master' into feat-qr-scanner 2022-04-28 22:09:01 +02:00
Oliver
27c807492d Security patch for django 2022-04-21 11:45:09 +10:00
Oliver Walters
7c126ed712 Added x_forwarded_for middleware
Used to extract remote client IP (when behind balancer / proxy / etc)
2022-04-19 21:19:25 +10:00
Oliver Walters
9e59d90e0e Pin bleach package version
(cherry picked from commit 7af9e9123e)
2022-04-10 20:24:41 +10:00
Kálmán Rózsahegyi
84717f8103 Add secure development server in DEBUG mode 2022-03-26 19:41:51 +01:00
dependabot[bot]
4d2d001879
Bump pillow from 9.0.0 to 9.0.1
Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.0.0 to 9.0.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.0.0...9.0.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-11 23:46:05 +00:00
Oliver
9ad0b66ebc Update base django version 2022-02-10 13:13:51 +11:00
dependabot[bot]
1927daa56d
Bump django from 3.2.10 to 3.2.11
Bumps [django](https://github.com/django/django) from 3.2.10 to 3.2.11.
- [Release notes](https://github.com/django/django/releases)
- [Commits](https://github.com/django/django/compare/3.2.10...3.2.11)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-13 02:26:20 +00:00
dependabot[bot]
f997e092b1
Bump pillow from 8.3.2 to 9.0.0
Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.3.2 to 9.0.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/8.3.2...9.0.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-13 01:11:42 +00:00