Commit Graph

174 Commits

Author SHA1 Message Date
Matthias Mair
f227315ad1
P-UI: Fast language / theme / server selection (#5301)
* added language toggle component

* added language and theme controls onto start page

* moved host selection out of auth

* optimized rendering

* make server option less obvious

* changed EditButton save symbol

* longer welcome text

* removed ColorToggle color schema

* reduced code

* disabled host selection when options are changing

* fix type error

* use GH reporter

* fix tests?

* compile frontend

* fix assertation

* revert unneeded change

* split up into more components

* separated functions / use cases for LanguageToggle more

* moved color toggle to profile

* moved language out of main menu into profile

* remapped settings link
2023-07-22 22:19:19 +10:00
Oliver
45aa8c39b3
React tweaks (#5300)
* Add .gitignore for static web files

* Add invoke task to start frontend dev server
2023-07-21 09:46:44 +10:00
Matthias Mair
9fe77b20e4
P-UI: Adapt translation CI (#5299)
* Fixes up translation for P-UI
Closes [FR/P-UI] Translation integration #5282

* ammended crowdin settings
2023-07-21 09:00:37 +10:00
Matthias Mair
2259de7f31
P UI: Added frontend publishing for bare-metal (git) (#5277)
* Add SPA views for react #2789

* split up frontend urls

* Add settings for frontend url loading

* add new UI scaffold

* remove tracking insert

* add platform app

* ensure static indexes work too

* add lingui

* add lingui config

* add mgmt tasks

* add base locales

* settings for frontend dev

* fix typo

* update deps

* add pre-commit

* add eslint

* add testing scaffold

* fix paths

* remove error - tests trip correctly

* merge workflow

* cleanup samples

* use name inline with other tests

* Add real worl frontend tests

* setup env

* tun migrations first

* optimize setup time

* setup demo dataset

* optimize run setup

* add test for class ui

* rename

* fix typo

* and another typo

* do install

* run migrations first

* fix name

* cleanup

* use other credentials

* use other credentials

* fix qc

* move envs to qc

* remove create_site

* reduce testing env

* fix test

* fix test call

* allaccess user

* add ui plattform check

* add better check

* remove unneeded env

* enable debug

* reduce wait time

* also build frontend on static

* add sort plugin

* fix order

* run pre-commit fixes

* add node min version

* Docker container (#129)

* Fix allocation check for completing build order (#5199)

- Allocation check only applies to untracked line items

* docker dev

Install required node packages to docker development image

* add import order settings

* cleanout built ui

* remove default arg from build

* remove eslint

* optimize svg

* add build step for plattform UI

* fix install command

* use alpine commands

* do not use cache when creating image

* Added release pipeline

* trigger: ci

* Fix ci

* Fix ci

* Fix ci

* fix: workflow

* fix: workflow

* fix: doubble zipping

* fix: doubble zipping

* fix: doubble zipping

* fix: doubble zipping

* fix: doubble zipping

* Added frontend-download helper to tasks.py

* revert unrelated change

* Add frontend step to update task

* add frontend stuff to version info

* small change to trigger ci

* keep terminal output clean

* return found versions

* fix suggested command

* revert small change

* move to multiline

* add flag to stop frontend compile

* make node building optional on static

* add node trans to transalte task

* ammend commands to use new flag

* remove unneeded flag

* add warning

* add yarn bypass

* docstrings

* check for docker env

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
Co-authored-by: wolflu05 <76838159+wolflu05@users.noreply.github.com>
2023-07-20 10:12:08 +10:00
Oliver
cd3d3834be
Update translate task (#5283)
- Allow for skipping of building static files
- CI workflow does not have node / etc / installed
2023-07-19 10:43:40 +10:00
Matthias Mair
3e37469350
Platform UI - React integration (#5011)
* Add SPA views for react #2789

* split up frontend urls

* Add settings for frontend url loading

* add new UI scaffold

* remove tracking insert

* add platform app

* ensure static indexes work too

* add lingui

* add lingui config

* add mgmt tasks

* add base locales

* settings for frontend dev

* fix typo

* update deps

* add pre-commit

* add eslint

* add testing scaffold

* fix paths

* remove error - tests trip correctly

* merge workflow

* cleanup samples

* use name inline with other tests

* Add real worl frontend tests

* setup env

* tun migrations first

* optimize setup time

* setup demo dataset

* optimize run setup

* add test for class ui

* rename

* fix typo

* and another typo

* do install

* run migrations first

* fix name

* cleanup

* use other credentials

* use other credentials

* fix qc

* move envs to qc

* remove create_site

* reduce testing env

* fix test

* fix test call

* allaccess user

* add ui plattform check

* add better check

* remove unneeded env

* enable debug

* reduce wait time

* also build frontend on static

* add sort plugin

* fix order

* run pre-commit fixes

* add node min version

* Docker container (#129)

* Fix allocation check for completing build order (#5199)

- Allocation check only applies to untracked line items

* docker dev

Install required node packages to docker development image

* add import order settings

* cleanout built ui

* remove default arg from build

* remove eslint

* optimize svg

* add build step for plattform UI

* fix install command

* use alpine commands

* do not use cache when creating image

---------

Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
2023-07-18 22:45:49 +10:00
Oliver
3b4e20b54a
Unit Test Improvements (#5087)
* Disable migration testing

- Compare how long the unit tests take

* Change file

- To get unit tests to run

* Fix format

* Consolidate tasks.py

- Remove coverage task
- Add --coverage flag to test task

* Fix typo

* Run migration unit tests if migration files are updated

* Fix

* Touch migration file

- Should cause migration unit tests to be run

* Force migration checks for docker build

* Prevent default report creation in unit tests

- Should save some time

* Add simple profiling for plugin loading

- Display time taken to load each plugin

* Fix to invoke test

* Disable get_git_log (for testing)

* Disable get_git_path in CI

- Might remove this entirely?
- For now, bypass for unit testing

* Add debug for unit registry

- Display time taken to load registry

* Don't full-reload unit registry

* Adjust migration test workflow

- env var updates
- change paths-filter output

* Fix for migration_test.yaml

- Actually need to set the output

* env fix

* db name

* Prevent sleep if in test mode

* Reduce sleep time on wait_for_db
2023-06-23 17:25:59 +10:00
Matthias Mair
21ed4b2081
Fix common spelling mistakes (#4956)
* add codespell

* first fixes

* doc fixes

* fix docstrings and comments

* functional changes

* docstrings again

* and docs again

* rename args

* add ignore

* use pre-commit for filtering instead

* ups

* fix typo in filter
2023-06-04 00:04:52 +10:00
miggland
11c5ce5f80
Test flexibility (#4945)
* Add option to specify which tests to run in invoke test

* Add information on testing in CONTRIBUTING.md
2023-06-01 23:54:06 +10:00
Matthias Mair
fdd4169cd7
Improve cli experience (#4881)
* fix cli call to get a fully running invoke

* use relativ import
This is importend when imported from outside

* Add version command

* Add more information to version command

* make print easier to understand
2023-05-24 16:34:36 +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
27aa16d55d
[Feature] Add RMA support (#4488)
* Adds ReturnOrder and ReturnOrderAttachment models

* Adds new 'role' specific for return orders

* Refactor total_price into a mixin

- Required for PurchaseOrder and SalesOrder
- May not be required for ReturnOrder (remains to be seen)

* Adds API endpoints for ReturnOrder

- Add list endpoint
- Add detail endpoint
- Adds required serializer models

* Adds basic "index" page for Return Order model

* Update API version

* Update navbar text

* Add db migration for new "role"

* Add ContactList and ContactDetail API endpoints

* Adds template and JS code for manipulation of contacts

- Display a table
- Create / edit / delete

* Splits order.js into multiple files

- Javascript files was becoming extremely large
- Hard to debug and find code
- Split into purchase_order / return_order / sales_order

* Fix role name (change 'returns' to 'return_order')

- Similar to existing roles for purchase_order and sales_order

* Adds detail page for ReturnOrder

* URL cleanup

- Use <int:pk> instead of complex regex

* More URL cleanup

* Add "return orders" list to company detail page

* Break JS status codes into new javascript file

- Always difficult to track down where these are rendered
- Enough to warrant their own file now

* Add ability to edit return order from detail page

* Database migrations

- Add new ReturnOrder modeles
- Add new 'contact' field to external orders

* Adds "contact" to ReturnOrder

- Implement check to ensure that the selected "contact" matches the selected "company"

* Adjust filters to limit contact options

* Fix typo

* Expose 'contact' field for PurchaseOrder model

* Render contact information

* Add "contact" for SalesOrder

* Adds setting to enable / disable return order functionality

- Simply hides the navigation elements
- API is not disabled

* Support filtering ReturnOrder by 'status'

- Refactors existing filter into the OrderFilter class

* js linting

* More JS linting

* Adds ReturnOrderReport model

* Add serializer for the ReturnOrderReport model

- A little bit of refactoring along the way

* Admin integration for new report model

* Refactoring for report.api

- Adds generic mixins for filtering queryset (based on updates to label.api)
- Reduces repeated code a *lot*

* Exposes API endpoints for ReturnOrderReport

* Adds default example report file for ReturnOrder

- Requires some more work :)

* Refactor report printing javascript code

- Replace all existing functions with 'printReports'

* Improvements for default StockItem test report template

- Fix bug in template
- Handle potential errors in template tags
- Add more helpers to report tags
- Improve test result rendering

* Reduce logging verbosity from weasyprint

* Refactor javascript for label printing

- Consolidate into a single function
- Similar to refactor of report functions

* Add report print button to return order page

* Record user reference when creating via API

* Refactor order serializers

- Move common code into AbstractOrderSerializer class

* Adds extra line item model for the return order

- Adds serializer and API endpoints as appropriate

* Render extra line table for return order

- Refactor existing functions into a single generic function
- Reduces repeated JS code a lot

* Add ability to create a new extra line item

* Adds button for creating a new lien item

* JS linting

* Update test

* Typo fix

(cherry picked from commit 28ac2be35b)

* Enable search for return order

* Don't do pricing (yet) for returnorder extra line table

- Fixes an uncaught error

* Error catching for api.js

* Updates for order models:

- Add 'target_date' field to abstract Order model
- Add IN_PROGRESS status code for return order
- Refactor 'overdue' and 'outstanding' API queries
- Refactor OVERDUE_FILTER on order models
- Refactor is_overdue on order models
- More table filters for return order model

* JS cleanup

* Create ReturnOrderLineItem model

- New type of status label
- Add TotalPriceMixin to ReturnOrder model

* Adds an API serializer for the ReturnOrderLineItem model

* Add API endpoints for ReturnOrderLineItem model

- Including some refactoring along the way

* javascript: refactor loadTableFilters function

- Pass enforced query through to the filters
- Call Object.assign() to construct a superset query
- Removes a lot of code duplication

* Refactor hard-coded URLS to use {% url %} lookup

- Forces error if the URL is wrong
- If we ever change the URL, will still work

* Implement creation of new return order line items

* Adds 'part_detail' annotation to ReturnOrderLineItem serializer

- Required for rendering part information

* javascript: refactor method for creating a group of buttons in a table

* javascript: refactor common buttons with helper functions

* Allow edit and delete of return order line items

* Add form option to automatically reload a table on success

- Pass table name to options.refreshTable

* JS linting

* Add common function for createExtraLineItem

* Refactor loading of attachment tables

- Setup drag-and-drop as part of core function

* CI fixes

* Refactoring out some more common API endpoint code

* Update migrations

* Fix permission typo

* Refactor for unit testing code

* Add unit tests for Contact model

* Tests for returnorder list API

* Annotate 'line_items' to ReturnOrder serializer

* Driving the refactor tractor

* More unit tests for the ReturnOrder API endpoints

* Refactor "print orders" button for various order tables

- Move into "setupFilterList" code (generic)

* add generic 'label printing' button to table actions buttons

* Refactor build output table

* Refactoring icon generation for js

* Refactoring for Part API

* Fix database model type for 'received_date'

* Add API endpoint to "issue" a ReturnOrder

* Improvements for stock tracking table

- Add new status codes
- Add rendering for SalesOrder
- Add rendering for ReturnOrder
- Fix status badges

* Adds functionality to receive line items against a return order

* Add endpoints for completing and cancelling orders

* Add option to allow / prevent editing of ReturnOrder after completed

* js linting

* Wrap "add extra line" button in setting check

* Updates to order/admin.py

* Remove inline admin for returnorderline model

* Updates to pass CI

* Serializer fix

* order template fixes

* Unit test fix

* Fixes for ReturnOrder.receive_line_item

* Unit testing for receiving line items against an RMA

* Improve example report for return order

* Extend unit tests for reporting

* Cleanup here and there

* Unit testing for order views

* Clear "sales_order" field when returning against ReturnOrder

* Add 'location' to deltas when returning from customer

* Bug fix for unit test
2023-03-29 10:35:43 +11:00
Oliver
db42ffcf7c
Slow tests (#4435)
* Add integration for django-slowtest

* Sample test improvement

- Reduces test from 0.7s to 0.2s

* Run CI tests with slowreport

* Fix requirements file

* Fix test command

* Fix bulk_create in unit tests

* Remove bulk_create entirely

* remove another bulk_create call

* Reduce long test from ~1000 seconds to ~1 second
2023-03-02 13:51:52 +11:00
Matthias Mair
5037e427b6
Auto migrating (#3741)
* base structure for updates

* add base structure

* add settingscheck

* update docstring

* only load plugins if needed

* fix misstyping

* run migration

* check if there are open migrations

* log open migration

* add more logging

* patch in fore reloading on unload

* only run if database is ready

* check every 5 minutes

* remove non implemented feautres  from desc

* add command flag to makr if cmmand runs as worker

* Add tests for migrations

* factor mmigration plan into own function

* Add print statements

* add initial migrations for tests

* remove last assertation

* cleanup migrations after run

* add flag to accept empty source code files

* the flag is enough for reporting

* fix test

* do not run migrations on sqlite3

* make sure migrations don't fail if no plan ran

* increase coverage for  migration

* spell fix

* check for migrations daily

* add a migration check after plugins are installed
2023-02-25 16:52:16 +11:00
Oliver
385ed8277d
Configuration options for dbbackup (#4190)
* Configuration options for dbbackup

Ref: https://github.com/inventree/InvenTree/discussions/4179

* DBBACKUP_SEND_EMAIL is always False

* Cleanup settings file

* Make backup step optional during update

* Change update operation to perform backup by default
2023-01-10 07:54:25 +11:00
Oliver
c4f0fa4d3a
Debug for docker workflow (#4021)
* Debug for docker workflow

* Show docker image hash

* More debug output

* Debug system path

* Disable pty for invoke test

* Disable pty as part of invoke test

* remove debug statements

* Disable docker workflow on pull request
2022-12-09 00:15:26 +11:00
Oliver
06266b48af
Part pricing cache (#3710)
* 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 cb26003b92)

* 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
2022-11-14 15:58:22 +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
Oliver
198ac9b275
Feature: Supplier part pack size (#3644)
* Adds 'pack_size' field to SupplierPart model

* Edit pack_size for SupplierPart via API

* Display pack size in supplier part page template

* Improve table ordering for SupplierPart table

* Fix for API filtering

- Need to use custom filter class

* Adds functionality to duplicate an existing SupplierPart

* Bump API version number

* Display annotation of pack size in purchase order line item table

* Display additional information in part purchase order table

* Add UOM to purchase order table

* Improve receive items functionality

* Indicate quantity which will be received in modal form

* Update the received quantity as the user changes the value

* Take  the pack_size into account when receiving line items

* Take supplierpart pack size into account when receiving line items

* Add "pack size" column to purchase order line item table

* Tweak supplier part table

* Update 'on_order' queryset annotation to take pack_size into account

- May god have mercy on my soul

* Adds a unit test to validate that the on_order queryset annotation is working as expected

* Update Part.on_order method to take pack_size into account

- Check in existing unit test also

* Fix existing unit tests

- Previous unit test was actually in error
- Logic for calculating "on_order" was broked

* More unit tests for receiving items against a purchase order

* Allow pack_size < 1

* Display pack size when adding / editing PurchaseOrderLineItem

* Fix bug in part purchase order table

* Update part purchase order table again

* Exclude notificationmessage when exporting dataset

* Also display pack size when ordering parts from secondary form

* javascript linting

* Change user facing strings to "Pack Quantity"
2022-09-08 09:49:14 +10:00
miggland
858d48afe7
Fix bug in exporting records (#3545)
Introduced in #3392
2022-08-16 12:09:00 +10:00
luwol03
2d63122ebe
vscode devcontainer (#3474)
* Added devcontainer configuration files

* Added launch.json and improved devcontainer

* Added tasks.json

* fix: lint

* fix: lint

* Applied suggestions from codereview

* Added more system dependencies and preserve history

* devcontainer updates

- Add extra environment variables for InvenTree config
- Move venv into dev directory (cleaner structure)
- Ensure base package requirements get installed
- Handle write-permission error for compiling translations
- Install test data inside dev directory

* Auto create plugin dir and added gh cli

* Refactored postCreateCommand into own file

* Applied suggestions from codereview

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-08-09 16:06:32 +10:00
Oliver
e9b0f02ecd
Update demo data hook to copy media files (#3441)
* Simplify settings.py / config.py

- get_setting function has been streamlined
- move some functions into config.py

* Spelling fix: IGNORRED is IGNORED

* Ensure yaml is installed as part of docker image

- invoke path is still mucking us around

* Fix broken migration

* Copy media files from demo dataset when installing test data

* Cleanup settings.py

* Fix for configuration file traversal

* Line fix

* Update quickstart guide for docker

* Allow plugin file and plugin dir to be specified in configuration file

* Cleanup config template file

* Allow secret_key information to be provided in configuration file

* Adjust root paths for CI tests

* resolve paths

* Revert paths for CI step

* remove dead code

* Revert configuration variables to old names

- Prevent breaking changes

* Simplify secret key generation

* Fix default timeout for background worker process

* Revert change for customization options
2022-07-31 23:16:58 +10:00
Oliver
3fc9a36d4b
Simplification of development docker-compose file (#3429)
* Simplification of development docker-compose file

- Rename .env file
- Remove requirement for variable interpolation within the docker-compose file itself

* Add debug flag to CI test

* Additional quick-start docs (for docker)

* docker-compose update

- Introspection did not work quite as expected
- Set project name inside docker-compose file

* Fixes for "setup_test" task

- Check if directory exists before first deleting it
- Parameterize the "path" variable
- Add option to ignore update step

* Add demo data dir to .gitignore

* Remove debug call

* Update CONTRIBUTING.md
2022-07-30 10:34:16 +10:00
Matthias Mair
e461a2c1ef
Development improvements (#3413)
* rename .env to make sure it is not loaded by default

* make sure migrations are run before import

* Add more messaget to setup_test

* add comments to setup-dev

* Add flag to setup-dev for setting up test data

* add flag to setup-test to also run development setup

* extend contributing with the flags

* change flag to tests

* Add option helptexts

* A nicer starter

* add 3 liner

* Revert "rename .env to make sure it is not loaded by default"

This reverts commit 95fa0bbc53.
2022-07-29 14:58:54 +10:00
Matthias Mair
794e375009
Switch to pathlib (#3392)
* switch to pathlib

* more pathlib

* useconvert env to path

* fix typo

* use resolve instead of absolute

* fix gitppod

* also allow parents

* replace more os operations

* fix string replacement feature

* make sure root dirs exsist

* fix replace function

* refactor duplicate code

* reduce code

* make sure dirs exist

* fix typo

* also create parent dirs

* fix match statement

* fix statments expecting string

* return getMigrationFileNames to old behaviour

* fully resolve config file

* make sure comparison works

* use pathlib in tasks

* fix file count test

* reduce code duplication in test + add test for part

* fix test

* re-add os

* Make pathlib usage simpler
2022-07-27 10:42:34 +10:00
Matthias Mair
6c71a26613
make sure pip is upgraded (#3401)
At the beginning of installs
2022-07-26 11:21:25 +10:00
Matthias Mair
864d69d968
Add test command (#3372)
* integrate test loading as task - use with gitpod

* ignore test data with git
2022-07-21 11:41:42 +10:00
Oliver
e383d6e955
Update unit tests to match new docker paths (#3360)
* Update unit tests to match new docker paths

Ref: https://github.com/inventree/InvenTree/pull/3357

* Add "wait" step before running dev server
2022-07-20 11:44:25 +10:00
Oliver
13dc14ce6f
Revert "Use python executable we were invoked with (#3303)" (#3309)
This reverts commit 0d9317addf.
2022-07-08 10:41:42 +10:00
Jakob Haufe
0d9317addf
Use python executable we were invoked with (#3303)
Relying on PATH will disrespect the virtualenv when called from
outside.
2022-07-07 09:02:07 +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
7c28bf1f64
Clean up tasks (#3175)
* Remove shell command
Fixes #3157

* Also run translation stats on updates

* remove style command

* remove import_fixtures command

* remove check

* fix docstirngs regarding D415

* move function up

* move task

* move task

* move tasks

* move task

* add section comments

* Revert "remove import_fixtures command"

This reverts commit e202ff2b80.
2022-06-11 10:07:57 +10:00
miggland
79f498a648
Export records update - allow overwriting existing files without user input (#3156)
* Add flag to overwrite existing file when exporting records

* Remove temp. file at end of export process

* Run flake8 on tasks.py as well

* Fix style

* Change style of default text

* Add type bool

* dev-setup

* Revert "dev-setup"

This reverts commit 789356422a.

* Update tasks.py with new flags to allow choosing where permissions end up, and if temporary files are kept or not
2022-06-09 11:47:29 +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
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
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 Mair
4d8836378b
CI updates (#3087)
* 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

* use relativ action references

* Change step / job docstrings
2022-05-28 10:38:12 +10:00
Matthias Mair
e1d22f538d resort imports 2022-05-20 17:24:51 +02:00
Matthias Mair
ddc4ef3c38 pep fix 2022-05-20 13:37:12 +02:00
Oliver
bd195105e7
Merge pull request #2991 from matmair/not-working-tests
Static test fixes
2022-05-20 20:46:28 +10:00
Matthias Mair
eac6456949
Update tasks.py 2022-05-19 08:04:20 +02:00
Matthias Mair
dfaf7bcad8
Add static into apps 2022-05-19 07:57:45 +02:00
Matthias Mair
b55c76d8ef
test everything 2022-05-19 06:54:24 +02:00
Matthias
e348d05181
update installed apps 2022-05-19 01:02:07 +02:00
Matthias
3fd5761089
Merge branch 'master' of https://github.com/inventree/InvenTree into devOps 2022-05-18 23:39:58 +02:00
Matthias
cc2081bf50
add hook auto-update to setup 2022-05-16 00:19:37 +02:00
Matthias
a67a6c55c2
declare as task 2022-05-16 00:19:03 +02:00
Matthias
f1553337f7
add pre-commit 2022-05-16 00:15:25 +02:00
Matthias
3154a4ebd0
remove old import catching 2022-05-15 21:01:55 +02:00
Oliver
41177f8611
Merge pull request #2918 from SchrodingersGat/translation-adjustment
Translation adjustment
2022-05-02 11:25:56 +10:00
Oliver Walters
d49763bd25 Adjust translation compilation step performed as part of "invoke update" 2022-05-02 10:53:43 +10:00
Oliver Walters
cfb523adec Adds option to delete existing data when importing records 2022-05-02 10:45:26 +10:00
Oliver Walters
ef530956a8 Run translation as part of the update process 2022-05-01 22:38:18 +10:00
Oliver
d8d22e5f38 Refactor code (so that it actually runs)...
- Invoke does not have access to the local virtual environment
- Some functions need to be split out from settings.py
2022-01-06 14:20:26 +11:00
Oliver
836b6275b6 Removes custom plugins directory
- rely on plugins.txt instead
2022-01-06 13:31:04 +11:00
Oliver
5c2121b1a1 Add invoke target to install plugins from file 2022-01-06 12:25:07 +11:00
Matthias
41302398e9
managment and invoke commands to remove mfa 2021-12-11 23:07:37 +01:00
Matthias
a06d91d9a3
fix reference name 2021-11-28 17:21:54 +01:00
Matthias
9454b51866
fix rules 2021-11-28 17:18:46 +01:00
Matthias
5f685f3c2a
fix db sessions in import / export 2021-11-28 16:54:11 +01:00
Matthias
6511a774d1
exclude sessions from imort / exports 2021-11-27 00:04:43 +01:00
Matthias
ba1c396792
reduce regex 2021-11-25 00:49:27 +01:00
Matthias
0f4adb1074
use regex matching and support multiline 2021-11-25 00:46:23 +01:00
Matthias
0448744f56
[FR] testing language
Fixes #2353
2021-11-24 23:07:48 +01:00
Matthias
9abbb6cb5e
PEP fixes for ci / maintenance scripts 2021-11-19 21:50:41 +01:00
Oliver
3a61d11f5a Adds a scheduled task to remove old notification entries from the database 2021-11-04 01:33:26 +11:00
Oliver
0c04bfaa85 Move "rebuild_thumbnails" to being a management command
- Does not run every time the server reboots
- Has to be called manually
- Normally does not need to be run and is a long-running process!
2021-10-05 08:05:26 +11:00
Oliver Walters
d0ccf8647d Add js linting to github workflow 2021-08-28 20:59:41 +10:00
Matthias
575cf87b98
also run static on update 2021-08-19 23:37:38 +02:00
Matthias
ee33de711a
move translation stats into own task 2021-08-19 23:36:54 +02:00
Oliver
41db0ff60d Need to specify python3 2021-08-18 14:58:16 +10:00
Oliver
7bfddd6d51 Simplify init scripts
Single script init.sh which performs the following tasks:
- Creates required directory structure
- Activates python venv (if required)
- Waits for database connection
- Runs command
2021-08-18 09:52:27 +10:00
Oliver
187c9b0971 Add server init script
- Taken (mostly) from https://github.com/inventree/InvenTree/pull/1949
2021-08-17 23:10:57 +10:00
Oliver
92aace1278 Run translation step as part of "update" 2021-08-17 18:22:07 +10:00
Matthias
ae8e58ac12 invoke task for celan_settings 2021-08-01 01:06:17 +02:00
Oliver
5198c5f9fa Fix for delete-data command 2021-06-21 10:38:50 +10:00
Oliver
8e9e04b400 Adds invoke task for deleting all database records 2021-06-21 10:23:53 +10:00
Oliver
5a2227862a Exclude authtoken 2021-06-20 16:36:39 +10:00
Oliver
7cc1c84b4b exclude exchange rate info from import / export tasks 2021-06-20 16:13:07 +10:00
Oliver
9a4ccedf5c Adds a management command to rebuild MPTT models
- Important to do after importing records / fixtures!
- Otherwise very strange things might happen especially when you try to use the API...
2021-06-18 21:53:15 +10:00
Matthias
ec19d77523 fix whitespaces in paths 2021-06-13 20:08:42 +02:00
Matthias
f2b0717d10 removes all lines consisting only of spaces
this really bothers me for some reason - nothing technical
2021-05-06 12:11:38 +02:00
Oliver Walters
7a19145be1 Disable wrapping for translation files
This ensures that the updates pushed back from crowding don't have unnecessary file deltas

Ref: https://docs.djangoproject.com/en/3.2/ref/django-admin/#django-admin-makemessages
2021-05-05 17:34:35 +10:00
Matthias
28a67828e3 [BUG] invoke: too many arguments
Fixes #1543
2021-05-04 22:04:05 +02:00
eeintech
c5ce5c533b Add owner model to imports ignore list 2021-04-27 11:10:46 -04:00
Oliver Walters
b08cd8da20 Remove dbbackup integration
- Data dumping and restoring is now very complex!
- We should use the invoke export-records function now, rather than relying on dbbackup / dbrestore
- Documentation will be updated to match
2021-04-25 12:14:36 +10:00
Oliver Walters
2f2354afdc Pre-process json data before importing
- Removes any unwanted "permissions" entries from data imported from an *older* version of InvenTree
2021-04-25 12:07:58 +10:00
Oliver Walters
f766711838 Add fixture for users / groups 2021-04-25 11:41:48 +10:00
Oliver Walters
d9d6a2392d Custom post-processing step as part of export-records command:
- We must delete the permission objects associated with a user or group, as auth.permissions are *NOT* included in the exported data file
- The permissions will be automatically created on first run of the server
2021-04-25 11:29:07 +10:00
Oliver Walters
dd8c0276c7 Ignore session data when exporting records 2021-04-25 10:52:47 +10:00
Oliver Walters
de720afd0e Exclude unwanted modules from import / export 2021-04-25 10:13:31 +10:00
Oliver Walters
a1e835e01b Add some new (empty) locale translation entries
- fr
- it
- ja
- pl
- ru
- zh

Also fixes the `invoke translate` command (maybe it was changed with the recent update to Django 3.2?)

The CI pipeline now runs the translation and static collection steps, to check those for errors.
2021-04-21 12:33:56 +10:00
Matthias
2943dc6083 initial implementation as in #1485 2021-04-20 13:37:19 +02:00
Oliver Walters
44fe5721e0 Disgusting hack for tasks.py 2021-04-11 14:05:55 +10:00
Oliver Walters
2e8d3b6424 Fix for tasks.py (??) 2021-04-11 13:22:16 +10:00
Oliver Walters
8f626d305e Fix location of entrypoint scripts 2021-04-10 22:35:10 +10:00
Oliver Walters
2436b1f2c9 Entrypoint script - start.sh 2021-04-02 00:40:47 +11:00
Oliver Walters
8d3b9e2ca4 Updates to settings.py
- Create secret_key.txt if it does not exist
- Copy default settings file if it does not exist
2021-04-02 00:06:17 +11:00
Oliver Walters
3a0c68bf5c Add invoke task to start background worker 2021-03-24 22:42:04 +11:00
Oliver Walters
df0ab2359f Remove invoke tasks which perform system commands
- tasks.py is now for InvenTree specific tasks only
2021-03-24 22:24:47 +11:00