From 93b693412747f3b2dd1b95a6767a6987cc86762a Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 13:20:55 +0200 Subject: [PATCH 1/6] fix trailing --- .github/workflows/check_translations.yaml | 2 +- .github/workflows/qc_checks.yaml | 2 +- .gitpod.yml | 2 +- CONTRIBUTING.md | 5 +- .../static/css/bootstrap-treeview.css | 6 +- .../static/css/color-themes/dark-reader.css | 62 +- InvenTree/InvenTree/static/css/inventree.css | 10 +- .../fontawesome/webfonts/fa-brands-400.svg | 886 ++++---- .../fontawesome/webfonts/fa-regular-400.svg | 304 +-- .../fontawesome/webfonts/fa-solid-900.svg | 1992 ++++++++--------- .../fonts/glyphicons-halflings-regular.svg | 2 +- .../static/fullcalendar/locales-all.js | 2 +- .../InvenTree/static/fullcalendar/main.js | 6 +- .../script/bootstrap/bootstrap-treeview.js | 22 +- .../static/script/inventree/inventree.js | 12 +- InvenTree/InvenTree/static/treegrid/LICENSE | 2 +- .../treegrid/examples/example-basic.html | 10 +- .../examples/example-bootstrap-2.html | 10 +- .../examples/example-bootstrap-3.html | 14 +- .../examples/example-bootstrap-resize.html | 14 +- .../treegrid/examples/example-column.html | 8 +- .../treegrid/examples/example-events.html | 12 +- .../treegrid/examples/example-huge.html | 12 +- .../treegrid/examples/example-save-state.html | 10 +- .../InvenTree/static/treegrid/index.html | 42 +- .../InvenTree/static/treegrid/styles.css | 28 +- InvenTree/InvenTree/static/treegrid/test.html | 4 +- InvenTree/build/fixtures/build.yaml | 2 +- .../build/templates/build/build_base.html | 6 +- InvenTree/build/templates/build/detail.html | 8 +- InvenTree/build/templates/build/index.html | 12 +- .../migrations/0019_auto_20200413_0642.py | 18 +- .../migrations/0026_auto_20201110_1011.py | 8 +- .../migrations/0036_supplierpart_update_2.py | 14 +- .../company/templates/company/detail.html | 14 +- .../company/templates/company/index.html | 8 +- .../templates/company/manufacturer_part.html | 12 +- .../templates/company/supplier_part.html | 4 +- InvenTree/config_template.yaml | 6 +- .../migrations/0055_auto_20211025_0645.py | 2 +- .../order/purchase_order_detail.html | 6 +- .../templates/order/purchase_orders.html | 8 +- .../templates/order/sales_order_detail.html | 6 +- .../order/templates/order/sales_orders.html | 8 +- InvenTree/part/fixtures/part.yaml | 2 +- .../migrations/0034_auto_20200404_1238.py | 2 +- .../migrations/0056_auto_20201110_1125.py | 8 +- InvenTree/part/templates/part/bom.html | 2 +- InvenTree/part/templates/part/category.html | 10 +- InvenTree/part/templates/part/detail.html | 94 +- InvenTree/part/templates/part/part_base.html | 8 +- InvenTree/part/templates/part/prices.html | 33 +- InvenTree/stock/fixtures/stock.yaml | 13 +- .../migrations/0061_auto_20210511_0911.py | 20 +- InvenTree/stock/templates/stock/item.html | 12 +- .../stock/templates/stock/item_base.html | 10 +- InvenTree/stock/templates/stock/location.html | 18 +- .../templates/stock/location_delete.html | 4 +- InvenTree/templates/503.html | 2 +- InvenTree/templates/InvenTree/search.html | 2 +- .../templates/InvenTree/settings/part.html | 2 +- .../templates/InvenTree/settings/plugin.html | 6 +- .../InvenTree/settings/plugin_settings.html | 2 +- .../InvenTree/settings/settings.html | 2 +- .../InvenTree/settings/user_display.html | 4 +- .../InvenTree/settings/user_search.html | 4 +- InvenTree/templates/account/base.html | 4 +- InvenTree/templates/base.html | 8 +- InvenTree/templates/js/dynamic/nav.js | 10 +- InvenTree/templates/js/dynamic/settings.js | 6 +- InvenTree/templates/js/translated/api.js | 8 +- .../templates/js/translated/attachment.js | 8 +- InvenTree/templates/js/translated/barcode.js | 8 +- InvenTree/templates/js/translated/bom.js | 40 +- InvenTree/templates/js/translated/build.js | 54 +- InvenTree/templates/js/translated/company.js | 22 +- InvenTree/templates/js/translated/filters.js | 19 +- InvenTree/templates/js/translated/forms.js | 168 +- InvenTree/templates/js/translated/helpers.js | 19 +- InvenTree/templates/js/translated/label.js | 4 +- InvenTree/templates/js/translated/modals.js | 60 +- .../js/translated/model_renderers.js | 36 +- .../templates/js/translated/notification.js | 16 +- InvenTree/templates/js/translated/order.js | 126 +- InvenTree/templates/js/translated/part.js | 70 +- InvenTree/templates/js/translated/report.js | 2 +- InvenTree/templates/js/translated/search.js | 22 +- InvenTree/templates/js/translated/stock.js | 40 +- InvenTree/templates/js/translated/tables.js | 22 +- InvenTree/templates/navbar.html | 4 +- InvenTree/templates/page_base.html | 4 +- InvenTree/templates/search.html | 1 - .../socialaccount/snippets/provider_list.html | 6 +- InvenTree/templates/status_codes.html | 2 +- README.md | 8 +- docker/nginx.dev.conf | 2 +- docker/production/docker-compose.yml | 2 +- docker/production/nginx.prod.conf | 2 +- setup.cfg | 2 +- 99 files changed, 2341 insertions(+), 2347 deletions(-) diff --git a/.github/workflows/check_translations.yaml b/.github/workflows/check_translations.yaml index 3407dc7fd8..eb02ceff09 100644 --- a/.github/workflows/check_translations.yaml +++ b/.github/workflows/check_translations.yaml @@ -31,7 +31,7 @@ jobs: sudo apt-get install gettext pip3 install invoke invoke install - - name: Test Translations + - name: Test Translations run: invoke translate - name: Check Migration Files run: python3 ci/check_migration_files.py diff --git a/.github/workflows/qc_checks.yaml b/.github/workflows/qc_checks.yaml index b884796cec..2245a5242f 100644 --- a/.github/workflows/qc_checks.yaml +++ b/.github/workflows/qc_checks.yaml @@ -197,7 +197,7 @@ jobs: invoke migrate invoke import-records -f data.json invoke import-records -f data.json - - name: Test Translations + - name: Test Translations run: invoke translate - name: Check Migration Files run: python3 ci/check_migration_files.py diff --git a/.gitpod.yml b/.gitpod.yml index 33389c5960..1cc823a74f 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -29,7 +29,7 @@ tasks: git clone https://github.com/inventree/demo-dataset /workspace/InvenTree/inventree-data invoke delete-data -f invoke import-records -f /workspace/InvenTree/inventree-data/inventree_data.json - + inv server # List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e6a58dba54..f1bdc6ad85 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ Please read the contribution guidelines below, before submitting your first pull ## Setup -Please run `invoke setup_dev` in the root directory of your InvenTree code base to set up your development setup before starting to contribute. This will install and set up pre-commit to run some checks before each commit and help reduce the style errors. +Please run `invoke setup_dev` in the root directory of your InvenTree code base to set up your development setup before starting to contribute. This will install and set up pre-commit to run some checks before each commit and help reduce the style errors. ## Branches and Versioning @@ -94,7 +94,7 @@ The various github actions can be found in the `./github/workflows` directory ## Code Style -Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR. +Sumbitted Python code is automatically checked against PEP style guidelines. Locally you can run `invoke style` to ensure the style checks will pass, before submitting the PR. Please write docstrings for each function and class - we follow the [google doc-style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings) for python. Docstrings for general javascript code is encouraged! Docstyles are checked by `invoke style`. ## Documentation @@ -166,4 +166,3 @@ The tags describe issues and PRs in multiple areas: | | docker | Docker / docker-compose | | | CI | CI / unit testing ecosystem | | | setup | Relates to the InvenTree setup / installation process | - diff --git a/InvenTree/InvenTree/static/css/bootstrap-treeview.css b/InvenTree/InvenTree/static/css/bootstrap-treeview.css index 23c6cf0668..1023438a24 100644 --- a/InvenTree/InvenTree/static/css/bootstrap-treeview.css +++ b/InvenTree/InvenTree/static/css/bootstrap-treeview.css @@ -1,9 +1,9 @@ /* ========================================================= * bootstrap-treeview.css v1.2.0 * ========================================================= - * Copyright 2013 Jonathan Miles + * Copyright 2013 Jonathan Miles * Project URL : http://www.jondmiles.com/bootstrap-treeview - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,4 +34,4 @@ .treeview .node-disabled { color: silver; cursor: not-allowed; -} \ No newline at end of file +} diff --git a/InvenTree/InvenTree/static/css/color-themes/dark-reader.css b/InvenTree/InvenTree/static/css/color-themes/dark-reader.css index 5270d5ead5..9a383d4fde 100644 --- a/InvenTree/InvenTree/static/css/color-themes/dark-reader.css +++ b/InvenTree/InvenTree/static/css/color-themes/dark-reader.css @@ -104,7 +104,7 @@ select:-webkit-autofill { fill: rgb(232, 230, 227); } .fad.fa-inverse { - color: rgb(232, 230, 227); + color: rgb(232, 230, 227); } :root { --bs-blue: #0d6efd; --bs-indigo: #6610f2; --bs-purple: #6f42c1; --bs-pink: #d63384; --bs-red: #dc3545; --bs-orange: #fd7e14; --bs-yellow: #ffc107; --bs-green: #198754; --bs-teal: #20c997; --bs-cyan: #0dcaf0; --bs-white: #fff; --bs-gray: #6c757d; --bs-gray-dark: #343a40; --bs-gray-100: #f8f9fa; --bs-gray-200: #e9ecef; --bs-gray-300: #dee2e6; --bs-gray-400: #ced4da; --bs-gray-500: #adb5bd; --bs-gray-600: #6c757d; --bs-gray-700: #495057; --bs-gray-800: #343a40; --bs-gray-900: #212529; --bs-primary: #0d6efd; --bs-secondary: #6c757d; --bs-success: #198754; --bs-info: #0dcaf0; --bs-warning: #ffc107; --bs-danger: #dc3545; --bs-light: #f8f9fa; --bs-dark: #212529; --darkreader-bg--bs-primary-rgb: 13,110,253; --darkreader-text--bs-primary-rgb: 13,110,253; --darkreader-bg--bs-secondary-rgb: 108,117,125; --darkreader-text--bs-secondary-rgb: 108,117,125; --darkreader-bg--bs-success-rgb: 25,135,84; --darkreader-text--bs-success-rgb: 25,135,84; --darkreader-bg--bs-info-rgb: 13,202,240; --darkreader-text--bs-info-rgb: 13,202,240; --darkreader-bg--bs-warning-rgb: 255,193,7; --darkreader-text--bs-warning-rgb: 255,193,7; --darkreader-bg--bs-danger-rgb: 220,53,69; --darkreader-text--bs-danger-rgb: 220,53,69; --darkreader-bg--bs-light-rgb: 248,249,250; --darkreader-text--bs-light-rgb: 248,249,250; --darkreader-bg--bs-dark-rgb: 33,37,41; --darkreader-text--bs-dark-rgb: 33,37,41; --darkreader-bg--bs-white-rgb: 255,255,255; --darkreader-text--bs-white-rgb: 255,255,255; --darkreader-bg--bs-black-rgb: 0,0,0; --darkreader-text--bs-black-rgb: 0,0,0; --darkreader-text--bs-body-color-rgb: 33,37,41; --darkreader-bg--bs-body-bg-rgb: 255,255,255; --bs-font-sans-serif: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans","Liberation Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; --bs-font-monospace: SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New", @@ -701,13 +701,13 @@ iframe { } .form-check-input:checked { background-color: rgb(2, 80, 196); - border-color: rgb(1, 71, 174); + border-color: rgb(1, 71, 174); } .form-check-input:checked[type="checkbox"] { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e"); + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e"); } .form-check-input:checked[type="radio"] { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e"); + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e"); } .form-check-input[type="checkbox"]:indeterminate { background-color: rgb(2, 80, 196); @@ -2211,26 +2211,26 @@ iframe { } @media (max-width: 1399.98px) { .modal-fullscreen-xxl-down .modal-content { - border-color: initial; + border-color: initial; } } .tooltip { - text-decoration-color: initial; text-shadow: none; + text-decoration-color: initial; text-shadow: none; } .tooltip .tooltip-arrow::before { - border-color: transparent; + border-color: transparent; } .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before, .bs-tooltip-top .tooltip-arrow::before { - border-top-color: rgb(140, 130, 115); + border-top-color: rgb(140, 130, 115); } .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before, .bs-tooltip-end .tooltip-arrow::before { - border-right-color: rgb(140, 130, 115); + border-right-color: rgb(140, 130, 115); } .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before, .bs-tooltip-bottom .tooltip-arrow::before { - border-bottom-color: rgb(140, 130, 115); + border-bottom-color: rgb(140, 130, 115); } .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before, .bs-tooltip-start .tooltip-arrow::before { @@ -2244,42 +2244,42 @@ iframe { text-decoration-color: initial; text-shadow: none; background-color: rgb(24, 26, 27); - border-color: rgba(140, 130, 115, 0.2); + border-color: rgba(140, 130, 115, 0.2); } .popover .popover-arrow::after, .popover .popover-arrow::before { - border-color: transparent; + border-color: transparent; } .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::before, .bs-popover-top > .popover-arrow::before { - border-top-color: rgba(140, 130, 115, 0.25); + border-top-color: rgba(140, 130, 115, 0.25); } .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::after, .bs-popover-top > .popover-arrow::after { - border-top-color: rgb(48, 52, 54); + border-top-color: rgb(48, 52, 54); } .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::before, .bs-popover-end > .popover-arrow::before { - border-right-color: rgba(140, 130, 115, 0.25); + border-right-color: rgba(140, 130, 115, 0.25); } .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::after, .bs-popover-end > .popover-arrow::after { - border-right-color: rgb(48, 52, 54); + border-right-color: rgb(48, 52, 54); } .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::before, .bs-popover-bottom > .popover-arrow::before { - border-bottom-color: rgba(140, 130, 115, 0.25); + border-bottom-color: rgba(140, 130, 115, 0.25); } .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::after, .bs-popover-bottom > .popover-arrow::after { - border-bottom-color: rgb(48, 52, 54); + border-bottom-color: rgb(48, 52, 54); } .bs-popover-auto[data-popper-placement^="bottom"] .popover-header::before, .bs-popover-bottom .popover-header::before { - border-bottom-color: rgb(52, 57, 59); + border-bottom-color: rgb(52, 57, 59); } .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::before, .bs-popover-start > .popover-arrow::before { - border-left-color: rgba(140, 130, 115, 0.25); + border-left-color: rgba(140, 130, 115, 0.25); } .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::after, .bs-popover-start > .popover-arrow::after { @@ -2786,13 +2786,13 @@ iframe { background-color: rgb(34, 36, 38); } .select2-container--default .select2-search--dropdown .select2-search__field { - border-color: rgb(72, 78, 81); + border-color: rgb(72, 78, 81); } .select2-container--default .select2-search--inline .select2-search__field { - background-image: initial; background-color: transparent; border-color: initial; outline-color: initial; box-shadow: none; + background-image: initial; background-color: transparent; border-color: initial; outline-color: initial; box-shadow: none; } .select2-container--default .select2-results__option[aria-disabled="true"] { - color: rgb(168, 160, 149); + color: rgb(168, 160, 149); } .select2-container--default .select2-results__option[aria-selected="true"] { background-color: rgb(43, 47, 49); @@ -2827,7 +2827,7 @@ iframe { rgb(53, 57, 59) 100%); } .select2-container--classic .select2-selection--single .select2-selection__arrow b { - border-color: rgb(82, 88, 92) transparent transparent; + border-color: rgb(82, 88, 92) transparent transparent; } .select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow { border-top-color: initial; @@ -2895,13 +2895,13 @@ iframe { box-shadow: none; } .select2-container--classic .select2-dropdown { - background-color: rgb(24, 26, 27); border-color: transparent; + background-color: rgb(24, 26, 27); border-color: transparent; } .select2-container--classic .select2-dropdown--above { - border-bottom-color: initial; + border-bottom-color: initial; } .select2-container--classic .select2-dropdown--below { - border-top-color: initial; + border-top-color: initial; } .select2-container--classic .select2-results__option[aria-disabled="true"] { color: rgb(152, 143, 129); @@ -2962,14 +2962,14 @@ iframe { } .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { color: rgb(232, 230, 227); - background-color: rgb(27, 30, 31); + background-color: rgb(27, 30, 31); } .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected, .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected="true"] { color: rgb(232, 230, 227); - background-color: rgb(2, 80, 196); + background-color: rgb(2, 80, 196); } .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--disabled, .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-disabled="true"] { - color: rgb(158, 150, 137); + color: rgb(158, 150, 137); } .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[role="group"] .select2-results__group { color: rgb(158, 150, 137); @@ -3685,7 +3685,7 @@ a.ui-button:active, border-color: rgb(62, 68, 70); } .form-field-error { - color: rgb(194, 102, 100); + color: rgb(194, 102, 100); } input[type="submit"] { color: rgb(200, 195, 188); diff --git a/InvenTree/InvenTree/static/css/inventree.css b/InvenTree/InvenTree/static/css/inventree.css index 4abba23b09..ca3f8a2955 100644 --- a/InvenTree/InvenTree/static/css/inventree.css +++ b/InvenTree/InvenTree/static/css/inventree.css @@ -19,7 +19,7 @@ main { } .login-screen { - background: url(/static/img/paper_splash.jpg) no-repeat center fixed; + background: url(/static/img/paper_splash.jpg) no-repeat center fixed; background-size: cover; height: 100vh; font-family: 'Numans', sans-serif; @@ -259,7 +259,7 @@ main { } .rowinvalid { - color: #A00; + color: #A00; } .rowinherited { @@ -306,7 +306,7 @@ main { padding-left: 2px; transform: translate(0%, -25%); } - + .filter-list .close:hover { background: #bbb; } @@ -1008,7 +1008,7 @@ input[type='number']{ .product-card-panel{ height: 100%; - margin-bottom: 5px; + margin-bottom: 5px; } .borderless { @@ -1047,4 +1047,4 @@ a { padding: 3px; margin-top: 3px; overflow: hidden; -} \ No newline at end of file +} diff --git a/InvenTree/InvenTree/static/fontawesome/webfonts/fa-brands-400.svg b/InvenTree/InvenTree/static/fontawesome/webfonts/fa-brands-400.svg index 46ad237a61..304135c663 100644 --- a/InvenTree/InvenTree/static/fontawesome/webfonts/fa-brands-400.svg +++ b/InvenTree/InvenTree/static/fontawesome/webfonts/fa-brands-400.svg @@ -12,7 +12,7 @@ Copyright (c) Font Awesome - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/InvenTree/InvenTree/static/fullcalendar/locales-all.js b/InvenTree/InvenTree/static/fullcalendar/locales-all.js index 81eaf9e99e..ee756eca09 100644 --- a/InvenTree/InvenTree/static/fullcalendar/locales-all.js +++ b/InvenTree/InvenTree/static/fullcalendar/locales-all.js @@ -1507,7 +1507,7 @@ /* eslint max-len: off */ var localesAll = [ - l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36, l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48, l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60, l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, + l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36, l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48, l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60, l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, ]; return localesAll; diff --git a/InvenTree/InvenTree/static/fullcalendar/main.js b/InvenTree/InvenTree/static/fullcalendar/main.js index f173a6e89d..27ec8f07b9 100644 --- a/InvenTree/InvenTree/static/fullcalendar/main.js +++ b/InvenTree/InvenTree/static/fullcalendar/main.js @@ -6736,7 +6736,7 @@ var FullCalendar = (function (exports) { var endMarker = framingRange.end; var instanceStarts = []; while (dayMarker < endMarker) { - var instanceStart + var instanceStart // if everyday, or this particular day-of-week = void 0; // if everyday, or this particular day-of-week @@ -11900,7 +11900,7 @@ var FullCalendar = (function (exports) { /* known bug: events that are force to be list-item but span multiple days still take up space in later columns */ - nodes.push(createElement("div", { className: 'fc-daygrid-event-harness' + (isAbsolute ? ' fc-daygrid-event-harness-abs' : ''), key: instanceId, + nodes.push(createElement("div", { className: 'fc-daygrid-event-harness' + (isAbsolute ? ' fc-daygrid-event-harness-abs' : ''), key: instanceId, // in print mode when in mult cols, could collide ref: isMirror ? null : this.segHarnessRefs.createRef(instanceId + ':' + seg.firstCol), style: { visibility: isInvisible ? 'hidden' : '', @@ -13209,7 +13209,7 @@ var FullCalendar = (function (exports) { if (!slatCoords) { return null; } - return segs.map(function (seg, i) { return (createElement(NowIndicatorRoot, { isAxis: false, date: date, + return segs.map(function (seg, i) { return (createElement(NowIndicatorRoot, { isAxis: false, date: date, // key doesn't matter. will only ever be one key: i }, function (rootElRef, classNames, innerElRef, innerContent) { return (createElement("div", { ref: rootElRef, className: ['fc-timegrid-now-indicator-line'].concat(classNames).join(' '), style: { top: slatCoords.computeDateTop(seg.start, date) } }, innerContent)); })); }); }; diff --git a/InvenTree/InvenTree/static/script/bootstrap/bootstrap-treeview.js b/InvenTree/InvenTree/static/script/bootstrap/bootstrap-treeview.js index 7a82a2eeb5..1febf52b74 100644 --- a/InvenTree/InvenTree/static/script/bootstrap/bootstrap-treeview.js +++ b/InvenTree/InvenTree/static/script/bootstrap/bootstrap-treeview.js @@ -321,7 +321,7 @@ var target = $(event.target); var node = this.findNode(target); if (!node || node.state.disabled) return; - + var classList = target.attr('class') ? target.attr('class').split(' ') : []; if ((classList.indexOf('expand-icon') !== -1)) { @@ -329,12 +329,12 @@ this.render(); } else if ((classList.indexOf('check-icon') !== -1)) { - + this.toggleCheckedState(node, _default.options); this.render(); } else { - + if (node.selectable) { this.toggleSelectedState(node, _default.options); } else { @@ -516,7 +516,7 @@ .addClass(node.state.checked ? 'node-checked' : '') .addClass(node.state.disabled ? 'node-disabled': '') .addClass(node.state.selected ? 'node-selected' : '') - .addClass(node.searchResult ? 'search-result' : '') + .addClass(node.searchResult ? 'search-result' : '') .attr('data-nodeid', node.nodeId) .attr('style', _this.buildStyleOverride(node)); @@ -548,13 +548,13 @@ // Add node icon if (_this.options.showIcon) { - + var classList = ['node-icon']; classList.push(node.icon || _this.options.nodeIcon); if (node.state.selected) { classList.pop(); - classList.push(node.selectedIcon || _this.options.selectedIcon || + classList.push(node.selectedIcon || _this.options.selectedIcon || node.icon || _this.options.nodeIcon); } @@ -569,7 +569,7 @@ var classList = ['check-icon']; if (node.state.checked) { - classList.push(_this.options.checkedIcon); + classList.push(_this.options.checkedIcon); } else { classList.push(_this.options.uncheckedIcon); @@ -935,7 +935,7 @@ this.forEachIdentifier(identifiers, options, $.proxy(function (node, options) { this.toggleExpandedState(node, options); }, this)); - + this.render(); }; @@ -1085,7 +1085,7 @@ $.each(identifiers, $.proxy(function (index, identifier) { callback(this.identifyNode(identifier), options); - }, this)); + }, this)); }; /* @@ -1156,9 +1156,9 @@ }); if (options.render) { - this.render(); + this.render(); } - + this.$element.trigger('searchCleared', $.extend(true, {}, results)); }; diff --git a/InvenTree/InvenTree/static/script/inventree/inventree.js b/InvenTree/InvenTree/static/script/inventree/inventree.js index efad99c3ec..7999e4a7be 100644 --- a/InvenTree/InvenTree/static/script/inventree/inventree.js +++ b/InvenTree/InvenTree/static/script/inventree/inventree.js @@ -47,7 +47,7 @@ function attachClipboard(selector, containerselector, textElement) { /** - * Return a standard list of export format options * + * Return a standard list of export format options * */ function exportFormatOptions() { return [ @@ -167,7 +167,7 @@ function inventreeDocReady() { function isFileTransfer(transfer) { - /* Determine if a transfer (e.g. drag-and-drop) is a file transfer + /* Determine if a transfer (e.g. drag-and-drop) is a file transfer */ return transfer.files.length > 0; @@ -176,7 +176,7 @@ function isFileTransfer(transfer) { function enableDragAndDrop(element, url, options) { /* Enable drag-and-drop file uploading for a given element. - + Params: element - HTML element lookup string e.g. "#drop-div" url - URL to POST the file to @@ -205,7 +205,7 @@ function enableDragAndDrop(element, url, options) { if (isFileTransfer(transfer)) { formData.append(label, transfer.files[0]); - + inventreeFormDataUpload( url, formData, @@ -234,7 +234,7 @@ function enableDragAndDrop(element, url, options) { /** * Save a key:value pair to local storage - * @param {String} name - settting key + * @param {String} name - settting key * @param {String} value - setting value */ function inventreeSave(name, value) { @@ -248,7 +248,7 @@ function inventreeSave(name, value) { * Retrieve a key:value pair from local storage * @param {*} name - setting key * @param {*} defaultValue - default value (returned if no matching key:value pair is found) - * @returns + * @returns */ function inventreeLoad(name, defaultValue) { diff --git a/InvenTree/InvenTree/static/treegrid/LICENSE b/InvenTree/InvenTree/static/treegrid/LICENSE index 41cb9c4b70..6308e939b7 100644 --- a/InvenTree/InvenTree/static/treegrid/LICENSE +++ b/InvenTree/InvenTree/static/treegrid/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 +Copyright (c) 2013 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/InvenTree/InvenTree/static/treegrid/examples/example-basic.html b/InvenTree/InvenTree/static/treegrid/examples/example-basic.html index f954edfee5..9377a5c2be 100644 --- a/InvenTree/InvenTree/static/treegrid/examples/example-basic.html +++ b/InvenTree/InvenTree/static/treegrid/examples/example-basic.html @@ -44,7 +44,7 @@
- +

TreeGrid Basic example

@@ -61,10 +61,10 @@ Node 1-2-1Additional info - +

Code

- +
 
 <!doctype html>
@@ -100,7 +100,7 @@
         <tr class="treegrid-4 treegrid-parent-3">
           <td>Node 1-2-1</td><td>Additional info</td>
         </tr>
-      </table>	  
+      </table>
 
   </body>
 </html>
@@ -128,4 +128,4 @@
       }
 
   
-
\ No newline at end of file
+
diff --git a/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-2.html b/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-2.html
index 6feee1dd16..2e975850b5 100644
--- a/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-2.html
+++ b/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-2.html
@@ -76,7 +76,7 @@
                 
                 
                     Node 2-2-1Additional info
-                        
+                
             
             

Source

@@ -89,7 +89,7 @@ $(document).ready(function() { $('.tree').treegrid(); }); -</script>
+</script>

Bootstrap grid example
table-bordered table-striped table-condensed
with custom expander

@@ -117,8 +117,8 @@ Node 2-2-1Additional info - - + +

Source

<link href="bootstrap-2.3.2/css/bootstrap.css" rel="stylesheet">
@@ -133,7 +133,7 @@
                     expanderCollapsedClass: 'icon-plus-sign'
                 });
     });
-</script>
+</script>
diff --git a/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-3.html b/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-3.html index 9faf397511..a251e137a3 100644 --- a/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-3.html +++ b/InvenTree/InvenTree/static/treegrid/examples/example-bootstrap-3.html @@ -29,7 +29,7 @@ }); }); - + + - \ No newline at end of file + diff --git a/InvenTree/InvenTree/static/treegrid/examples/example-events.html b/InvenTree/InvenTree/static/treegrid/examples/example-events.html index e31ea545a7..0c6d0acd83 100644 --- a/InvenTree/InvenTree/static/treegrid/examples/example-events.html +++ b/InvenTree/InvenTree/static/treegrid/examples/example-events.html @@ -73,7 +73,7 @@ Node 1-2-1Additional info - +

Code

@@ -95,16 +95,16 @@ $('.tree').treegrid({ onChange: function() { alert("Changed: "+$(this).attr("id")); - }, + }, onCollapse: function() { alert("Collapsed: "+$(this).attr("id")); - }, + }, onExpand: function() { alert("Expanded "+$(this).attr("id")); }}); $('#node-1').on("change", function() { alert("Event from " + $(this).attr("id")); - }); + }); }); </script> @@ -124,7 +124,7 @@ <tr class="treegrid-4 treegrid-parent-3"> <td>Node 1-2-1</td><td>Additional info</td> </tr> - </table> + </table> </body> </html> @@ -152,4 +152,4 @@ } - \ No newline at end of file + diff --git a/InvenTree/InvenTree/static/treegrid/examples/example-huge.html b/InvenTree/InvenTree/static/treegrid/examples/example-huge.html index 3a63fe56ce..3bba1cdba5 100644 --- a/InvenTree/InvenTree/static/treegrid/examples/example-huge.html +++ b/InvenTree/InvenTree/static/treegrid/examples/example-huge.html @@ -30,7 +30,7 @@ - + @@ -51,13 +51,13 @@ - +
- +
- + {% endblock %} {% block js_load %} @@ -197,4 +197,4 @@ $('#multi-build-print').click(function() { }); {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/company/migrations/0019_auto_20200413_0642.py b/InvenTree/company/migrations/0019_auto_20200413_0642.py index cfbc3da4da..3b7c928489 100644 --- a/InvenTree/company/migrations/0019_auto_20200413_0642.py +++ b/InvenTree/company/migrations/0019_auto_20200413_0642.py @@ -65,7 +65,7 @@ def reverse_association(apps, schema_editor): # pragma: no cover # Now extract the "name" for the manufacturer response = cursor.execute(f"SELECT name from company_company where id={manufacturer_id};") - + row = cursor.fetchone() name = row[0] @@ -77,7 +77,7 @@ def reverse_association(apps, schema_editor): # pragma: no cover def associate_manufacturers(apps, schema_editor): """ This migration is the "middle step" in migration of the "manufacturer" field for the SupplierPart model. - + Previously the "manufacturer" field was a simple text field with the manufacturer name. This is quite insufficient. The new "manufacturer" field is a link to Company object which has the "is_manufacturer" parameter set to True @@ -87,7 +87,7 @@ def associate_manufacturers(apps, schema_editor): It uses fuzzy pattern matching to help the user out as much as possible. """ - + def get_manufacturer_name(part_id): """ THIS IS CRITICAL! @@ -149,7 +149,7 @@ def associate_manufacturers(apps, schema_editor): return True - # Have we already mapped this + # Have we already mapped this if name in links.keys(): # pragma: no cover print(" - Part[{pk}]: Mapped '{n}' - manufacturer <{c}>".format(pk=part_id, n=name, c=links[name])) @@ -178,7 +178,7 @@ def associate_manufacturers(apps, schema_editor): links[company_name] = manufacturer.pk companies[company_name] = manufacturer.pk - + print(" - Part[{pk}]: Created new manufacturer: '{name}'".format(pk=part_id, name=company_name)) # Update SupplierPart object in the database @@ -228,9 +228,9 @@ def associate_manufacturers(apps, schema_editor): # Present a list of options if not TESTING: # pragma: no cover print("----------------------------------") - + print("Checking part [{pk}] ({idx} of {total})".format(pk=part_id, idx=idx+1, total=total)) - + if not TESTING: # pragma: no cover print("Manufacturer name: '{n}'".format(n=name)) print("----------------------------------") @@ -293,7 +293,7 @@ def associate_manufacturers(apps, schema_editor): if not response or len(response) == 0: # Response cannot be empty! print("Please select an option") - + # Double-check if the typed name corresponds to an existing item elif response in companies.keys(): link_part(part, companies[response]) @@ -334,7 +334,7 @@ def associate_manufacturers(apps, schema_editor): results = cursor.fetchall() part_count = len(results) - + # Create a unique set of manufacturer names for index, row in enumerate(results): pk, MPN, SKU, manufacturer_id, manufacturer_name = row diff --git a/InvenTree/company/migrations/0026_auto_20201110_1011.py b/InvenTree/company/migrations/0026_auto_20201110_1011.py index 193d191ed6..f61b64d29f 100644 --- a/InvenTree/company/migrations/0026_auto_20201110_1011.py +++ b/InvenTree/company/migrations/0026_auto_20201110_1011.py @@ -32,7 +32,7 @@ def migrate_currencies(apps, schema_editor): # The 'suffix' field denotes the currency code response = cursor.execute('SELECT id, suffix, description from common_currency;') - + results = cursor.fetchall() remap = {} @@ -56,7 +56,7 @@ def migrate_currencies(apps, schema_editor): # Now iterate through each SupplierPriceBreak and update the rows response = cursor.execute('SELECT id, cost, currency_id, price, price_currency from part_supplierpricebreak;') - + results = cursor.fetchall() count = 0 @@ -92,7 +92,7 @@ def reverse_currencies(apps, schema_editor): # pragma: no cover # Extract a list of currency codes which are in use response = cursor.execute(f'SELECT id, price, price_currency from part_supplierpricebreak;') - + results = cursor.fetchall() codes_in_use = set() @@ -123,7 +123,7 @@ def reverse_currencies(apps, schema_editor): # pragma: no cover # Create a new object in the database print(f"Creating new Currency object for {code}") - + # Construct a query to create a new Currency object query = f'INSERT into common_currency (symbol, suffix, description, value, base) VALUES ("$", "{code}", "{description}", 1.0, False);' diff --git a/InvenTree/company/migrations/0036_supplierpart_update_2.py b/InvenTree/company/migrations/0036_supplierpart_update_2.py index 82e1e1ba97..9c986437e3 100644 --- a/InvenTree/company/migrations/0036_supplierpart_update_2.py +++ b/InvenTree/company/migrations/0036_supplierpart_update_2.py @@ -9,7 +9,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): SupplierPart = apps.get_model('company', 'SupplierPart') supplier_parts = SupplierPart.objects.all() - + if supplier_parts: print(f'\nCreating ManufacturerPart Objects\n{"-"*10}') for supplier_part in supplier_parts: @@ -23,7 +23,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): if not part: # pragma: no cover print(f'[ERROR: SUPPLIER PART IS NOT CONNECTED TO PART]') continue - + manufacturer = supplier_part.manufacturer MPN = supplier_part.MPN link = supplier_part.link @@ -31,7 +31,7 @@ def supplierpart_make_manufacturer_parts(apps, schema_editor): if manufacturer or MPN: print(f' | {part.name[:15].ljust(15)}', end='') - + try: print(f' | {manufacturer.name[:15].ljust(15)}', end='') except AttributeError: @@ -73,12 +73,12 @@ def supplierpart_populate_manufacturer_info(apps, schema_editor): # pragma: no SupplierPart = apps.get_model('company', 'SupplierPart') supplier_parts = SupplierPart.objects.all() - + if supplier_parts: print(f'\nSupplierPart: Populating Manufacturer Information\n{"-"*10}') for supplier_part in supplier_parts: print(f'{supplier_part.supplier.name[:15].ljust(15)} | {supplier_part.SKU[:15].ljust(15)}\t', end='') - + manufacturer_part = supplier_part.manufacturer_part if manufacturer_part: @@ -89,13 +89,13 @@ def supplierpart_populate_manufacturer_info(apps, schema_editor): # pragma: no supplier_part.MPN = manufacturer_part.MPN supplier_part.save() - + print(f'[SUCCESS: UPDATED MANUFACTURER INFO]') else: print(f'[IGNORED: NO MANUFACTURER PART]') print(f'{"-"*10}\nDone\n') - + class Migration(migrations.Migration): diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 4474278613..9ae40f0833 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -90,7 +90,7 @@ {% endif %} - + {% include "filter_list.html" with id="manufacturer-part" %} @@ -172,9 +172,9 @@ {% include "filter_list.html" with id="customerstock" %} - +
- + @@ -313,7 +313,7 @@ var selections = $("#manufacturer-part-table").bootstrapTable("getSelections"); deleteManufacturerParts(selections, { - onSuccess: function() { + onSuccess: function() { $("#manufacturer-part-table").bootstrapTable("refresh"); } }); @@ -378,10 +378,10 @@ accept: function() { selections.forEach(function(part) { var url = `/api/company/part/${part.pk}/`; - + requests.push(inventreeDelete(url)); }); - + $.when.apply($, requests).done(function() { $('#supplier-part-table').bootstrapTable('refresh'); }); @@ -412,4 +412,4 @@ enableSidebar('company'); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/company/templates/company/index.html b/InvenTree/company/templates/company/index.html index d7fbee1732..f9790a9a1d 100644 --- a/InvenTree/company/templates/company/index.html +++ b/InvenTree/company/templates/company/index.html @@ -5,7 +5,7 @@ {% load inventree_extras %} {% block page_title %} -{% inventree_title %} | {% trans "Supplier List" %} +{% inventree_title %} | {% trans "Supplier List" %} {% endblock %} {% block heading %} @@ -23,11 +23,11 @@ {% block page_info %}
- +
{% include "filter_list.html" with id='company' %}
- +
@@ -59,4 +59,4 @@ } ); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/company/templates/company/manufacturer_part.html b/InvenTree/company/templates/company/manufacturer_part.html index aa087fe207..d46f99b68f 100644 --- a/InvenTree/company/templates/company/manufacturer_part.html +++ b/InvenTree/company/templates/company/manufacturer_part.html @@ -137,7 +137,7 @@ src="{% static 'img/blank_image.png' %}" {% include "filter_list.html" with id='supplier-part' %} - +
@@ -267,10 +267,10 @@ $("#supplier-part-delete").click(function() { accept: function() { selections.forEach(function(part) { var url = `/api/company/part/${part.pk}/`; - + requests.push(inventreeDelete(url)); }); - + $.when.apply($, requests).done(function() { reloadSupplierPartTable(); }); @@ -295,7 +295,7 @@ $("#multi-parameter-delete").click(function() { text += ` `; - + showQuestionDialog( '{% trans "Delete Parameters" %}', text, @@ -353,7 +353,7 @@ $('#order-part, #order-part2').click(function() { '{% url "api-part-detail" part.part.pk %}', {}, { success: function(response) { - + orderParts([response], { manufacturer_part: {{ part.pk }}, {% if part.manufacturer %} @@ -389,4 +389,4 @@ $('#delete-part').click(function() { enableSidebar('manufacturerpart'); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/company/templates/company/supplier_part.html b/InvenTree/company/templates/company/supplier_part.html index f990b66898..d833d581f0 100644 --- a/InvenTree/company/templates/company/supplier_part.html +++ b/InvenTree/company/templates/company/supplier_part.html @@ -165,7 +165,7 @@ src="{% static 'img/blank_image.png' %}" - {% endif %} + {% endif %} @@ -198,7 +198,7 @@ src="{% static 'img/blank_image.png' %}"
- +
diff --git a/InvenTree/config_template.yaml b/InvenTree/config_template.yaml index cad7012ebe..6b0d3d29ae 100644 --- a/InvenTree/config_template.yaml +++ b/InvenTree/config_template.yaml @@ -39,7 +39,7 @@ database: #PASSWORD: inventree_password #HOST: 'localhost' #PORT: '5432' - + # --- Example Configuration - sqlite3 --- # ENGINE: sqlite3 # NAME: '/home/inventree/database.sqlite3' @@ -98,7 +98,7 @@ email: debug: True # Set debug_toolbar to True to enable a debugging toolbar for InvenTree -# Note: This will only be displayed if DEBUG mode is enabled, +# Note: This will only be displayed if DEBUG mode is enabled, # and only if InvenTree is accessed from a local IP (127.0.0.1) debug_toolbar: False @@ -118,7 +118,7 @@ allowed_hosts: - '*' # Cross Origin Resource Sharing (CORS) settings (see https://github.com/ottoyiu/django-cors-headers) -# Following parameters are +# Following parameters are cors: # CORS_ORIGIN_ALLOW_ALL - If True, the whitelist will not be used and all origins will be accepted. allow_all: True diff --git a/InvenTree/order/migrations/0055_auto_20211025_0645.py b/InvenTree/order/migrations/0055_auto_20211025_0645.py index d9ee366f5f..0efab70da8 100644 --- a/InvenTree/order/migrations/0055_auto_20211025_0645.py +++ b/InvenTree/order/migrations/0055_auto_20211025_0645.py @@ -19,7 +19,7 @@ def add_shipment(apps, schema_editor): Allocation = apps.get_model('order', 'salesorderallocation') SalesOrder = apps.get_model('order', 'salesorder') Shipment = apps.get_model('order', 'salesordershipment') - + n = 0 for order in SalesOrder.objects.all(): diff --git a/InvenTree/order/templates/order/purchase_order_detail.html b/InvenTree/order/templates/order/purchase_order_detail.html index 542a7a90ca..4c9bc16ca7 100644 --- a/InvenTree/order/templates/order/purchase_order_detail.html +++ b/InvenTree/order/templates/order/purchase_order_detail.html @@ -30,7 +30,7 @@ {% trans "Receive Items" %} {% endif %} - {% endif %} + {% endif %} @@ -38,7 +38,7 @@
{% include "filter_list.html" with id="purchase-order-lines" %}
- +
@@ -260,4 +260,4 @@ loadOrderTotal( enableSidebar('purchaseorder'); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index 8ddae982b9..f76cc936af 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -41,12 +41,12 @@ - +
- +
- + {% endblock %} @@ -192,4 +192,4 @@ loadPurchaseOrderTable("#purchase-order-table", { url: "{% url 'api-po-list' %}", }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html index 628e510d37..f55480d288 100644 --- a/InvenTree/order/templates/order/sales_order_detail.html +++ b/InvenTree/order/templates/order/sales_order_detail.html @@ -181,7 +181,7 @@ {% endif %} }); - + onPanelLoad('order-shipments-complete', function() { loadSalesOrderShipmentTable('#completed-shipments-table', { order: {{ order.pk }}, @@ -293,5 +293,5 @@ ); enableSidebar('salesorder'); - -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/InvenTree/order/templates/order/sales_orders.html b/InvenTree/order/templates/order/sales_orders.html index 7f4f09b8d2..81c9f3670d 100644 --- a/InvenTree/order/templates/order/sales_orders.html +++ b/InvenTree/order/templates/order/sales_orders.html @@ -44,13 +44,13 @@ - +
- +
- + {% endblock %} {% block js_load %} @@ -192,4 +192,4 @@ $("#so-create").click(function() { createSalesOrder(); }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/fixtures/part.yaml b/InvenTree/part/fixtures/part.yaml index fd38036fa9..762a0bf740 100644 --- a/InvenTree/part/fixtures/part.yaml +++ b/InvenTree/part/fixtures/part.yaml @@ -1,4 +1,4 @@ -# Create some fasteners +# Create some fasteners - model: part.part pk: 1 diff --git a/InvenTree/part/migrations/0034_auto_20200404_1238.py b/InvenTree/part/migrations/0034_auto_20200404_1238.py index 3868191c02..a720fffa1e 100644 --- a/InvenTree/part/migrations/0034_auto_20200404_1238.py +++ b/InvenTree/part/migrations/0034_auto_20200404_1238.py @@ -7,7 +7,7 @@ def create_thumbnails(apps, schema_editor): """ Create thumbnails for all existing Part images. - Note: This functionality is now performed in apps.py, + Note: This functionality is now performed in apps.py, as running the thumbnail script here caused too many database level errors. This migration is left here to maintain the database migration history diff --git a/InvenTree/part/migrations/0056_auto_20201110_1125.py b/InvenTree/part/migrations/0056_auto_20201110_1125.py index efb36b1812..bb3d930f99 100644 --- a/InvenTree/part/migrations/0056_auto_20201110_1125.py +++ b/InvenTree/part/migrations/0056_auto_20201110_1125.py @@ -33,7 +33,7 @@ def migrate_currencies(apps, schema_editor): # The 'suffix' field denotes the currency code response = cursor.execute('SELECT id, suffix, description from common_currency;') - + results = cursor.fetchall() remap = {} @@ -57,7 +57,7 @@ def migrate_currencies(apps, schema_editor): # Now iterate through each PartSellPriceBreak and update the rows response = cursor.execute('SELECT id, cost, currency_id, price, price_currency from part_partsellpricebreak;') - + results = cursor.fetchall() count = 0 @@ -93,7 +93,7 @@ def reverse_currencies(apps, schema_editor): # pragma: no cover # Extract a list of currency codes which are in use response = cursor.execute(f'SELECT id, price, price_currency from part_partsellpricebreak;') - + results = cursor.fetchall() codes_in_use = set() @@ -124,7 +124,7 @@ def reverse_currencies(apps, schema_editor): # pragma: no cover # Create a new object in the database print(f"Creating new Currency object for {code}") - + # Construct a query to create a new Currency object query = f"INSERT into common_currency (symbol, suffix, description, value, base) VALUES ('$', '{code}', '{description}', 1.0, False);" diff --git a/InvenTree/part/templates/part/bom.html b/InvenTree/part/templates/part/bom.html index 7a3ab1ad6d..e817f60d08 100644 --- a/InvenTree/part/templates/part/bom.html +++ b/InvenTree/part/templates/part/bom.html @@ -34,7 +34,7 @@
  • {% trans "Delete Items" %}
  • - {% endif %} + {% endif %} {% include "filter_list.html" with id="bom" %} diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 41df553a5e..30c0867968 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -188,7 +188,7 @@
    -
    +
    @@ -221,9 +221,9 @@ {% include "filter_list.html" with id="category" %} - +
    - + @@ -255,7 +255,7 @@ onPanelLoad('parameters', function() { loadParametricPartTable( "#parametric-part-table", - { + { category: {{ category.pk }}, } ); @@ -341,7 +341,7 @@ location.href = `/part/${data.pk}/`; }, }); - + }); {% endif %} diff --git a/InvenTree/part/templates/part/detail.html b/InvenTree/part/templates/part/detail.html index 1c80a88c28..23d8af755a 100644 --- a/InvenTree/part/templates/part/detail.html +++ b/InvenTree/part/templates/part/detail.html @@ -66,14 +66,14 @@ {% include "filter_list.html" with id="parttests" %} - -
    + +
    -
    +

    {% trans "Purchase Orders" %}

    {% include "spacer.html" %}
    @@ -89,9 +89,9 @@ {% include "filter_list.html" with id="partpurchaseorders" %}
    - + -
    +
    @@ -114,7 +114,7 @@

    {% trans "Sales Order Allocations" %}

    - +
    {% include "filter_list.html" with id="salesorderallocation" %} @@ -167,7 +167,7 @@ {% include "filter_list.html" with id="variants" %}
    - +
    @@ -268,7 +268,7 @@
  • {% trans "Validate BOM" %}
  • - + {% if roles.part.change %} - +
    @@ -230,11 +230,11 @@ {% if part.has_bom and roles.sales_order.view %}
    -

    {% trans "BOM Cost" %} +

    {% trans "BOM Cost" %}

    - +
    @@ -256,11 +256,11 @@ {% if part.salable and roles.sales_order.view %}
    -

    {% trans "Sale Cost" %} +

    {% trans "Sale Cost" %}

    - +
    @@ -274,7 +274,7 @@ {% trans "Add Price Break" %}
    - +
    @@ -285,11 +285,11 @@ {% if show_price_history %}
    -

    {% trans "Sale Price" %} +

    {% trans "Sale Price" %}

    - +
    {% if sale_history|length > 0 %}
    @@ -303,4 +303,3 @@
    {% endif %} {% endif %} - \ No newline at end of file diff --git a/InvenTree/stock/fixtures/stock.yaml b/InvenTree/stock/fixtures/stock.yaml index 2fd5b7eb92..fb798e74be 100644 --- a/InvenTree/stock/fixtures/stock.yaml +++ b/InvenTree/stock/fixtures/stock.yaml @@ -274,7 +274,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1002 fields: @@ -285,7 +285,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1003 fields: @@ -307,7 +307,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1005 fields: @@ -318,7 +318,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1006 fields: @@ -329,7 +329,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1007 fields: @@ -340,7 +340,7 @@ tree_id: 0 lft: 0 rght: 0 - + - model: stock.stockitem pk: 1008 fields: @@ -351,4 +351,3 @@ tree_id: 0 lft: 0 rght: 0 - \ No newline at end of file diff --git a/InvenTree/stock/migrations/0061_auto_20210511_0911.py b/InvenTree/stock/migrations/0061_auto_20210511_0911.py index 1e20071d59..887bff0ea8 100644 --- a/InvenTree/stock/migrations/0061_auto_20210511_0911.py +++ b/InvenTree/stock/migrations/0061_auto_20210511_0911.py @@ -26,7 +26,7 @@ def update_history(apps, schema_editor): # Note we cannot use the 'pathstring' function here as we don't have access to model functions! path = [location.name] - + loc = location while loc.parent: @@ -48,7 +48,7 @@ def update_history(apps, schema_editor): deltas = {} updated = False - + q = entry.quantity if idx == 0 or not q == quantity: @@ -69,7 +69,7 @@ def update_history(apps, schema_editor): if 'completed build' in title: tracking_type = StockHistoryCode.BUILD_OUTPUT_COMPLETED - + elif 'removed' in title and 'item' in title: if entry.notes.lower().startswith('split '): @@ -81,7 +81,7 @@ def update_history(apps, schema_editor): result = re.search(r"^removed ([\d\.]+) items", title) if result: - + removed = result.groups()[0] try: @@ -93,12 +93,12 @@ def update_history(apps, schema_editor): print(f"WARNING: Error converting removed quantity '{removed}'") else: print(f"Could not decode '{title}'") - + elif 'split from existing' in title: tracking_type = StockHistoryCode.SPLIT_FROM_PARENT deltas['quantity'] = float(q) - + elif 'moved to' in title: tracking_type = StockHistoryCode.STOCK_MOVE @@ -119,7 +119,7 @@ def update_history(apps, schema_editor): # Direct match for name if text == location.name: matches.add(location) - + # Match for "name - description" compare = f"{location.name} - {location.description}" @@ -140,7 +140,7 @@ def update_history(apps, schema_editor): else: print(f"No location match: '{text}'") break - + elif 'created stock item' in title: tracking_type = StockHistoryCode.CREATED @@ -152,7 +152,7 @@ def update_history(apps, schema_editor): elif 'counted' in title: tracking_type = StockHistoryCode.STOCK_COUNT - + elif 'added' in title: tracking_type = StockHistoryCode.STOCK_ADD @@ -160,7 +160,7 @@ def update_history(apps, schema_editor): result = re.search(r"^added ([\d\.]+) items", title) if result: - + added = result.groups()[0] try: diff --git a/InvenTree/stock/templates/stock/item.html b/InvenTree/stock/templates/stock/item.html index 66069c7a2e..efb4a6e39f 100644 --- a/InvenTree/stock/templates/stock/item.html +++ b/InvenTree/stock/templates/stock/item.html @@ -26,7 +26,7 @@
    -
    +
    {% include "filter_list.html" with id="stocktracking" %}
    @@ -111,8 +111,8 @@ {% include "filter_list.html" with id="stocktests" %}
    - -
    + +
    @@ -210,7 +210,7 @@ quantity: {{ item.quantity|unlocalize }}, } ); - + onPanelLoad('notes', function() { setupNotesField( 'stock-notes', @@ -322,7 +322,7 @@ reload: true, } ); - }); + }); loadStockTrackingTable($("#track-table"), { params: { @@ -330,7 +330,7 @@ item: {{ item.pk }}, user_detail: true, }, - url: "{% url 'api-stock-tracking-list' %}", + url: "{% url 'api-stock-tracking-list' %}", }); enableSidebar('stockitem'); diff --git a/InvenTree/stock/templates/stock/item_base.html b/InvenTree/stock/templates/stock/item_base.html index da4b832266..1e5abb7ebc 100644 --- a/InvenTree/stock/templates/stock/item_base.html +++ b/InvenTree/stock/templates/stock/item_base.html @@ -102,7 +102,7 @@
  • {% trans "Uninstall" %}
  • {% else %} {% if item.part.get_used_in %} - {% endif %} @@ -260,13 +260,13 @@ {% trans "This stock item is allocated to Build Order" %} {{ link }} {% if qty < item.quantity %}({% trans "Quantity" %}: {{ qty }}){% endif %}
    {% endfor %} - + {% if item.serialized %}
    {% trans "This stock item is serialized - it has a unique serial number and the quantity cannot be adjusted." %}
    {% endif %} - +
    {% endblock details %} @@ -473,7 +473,7 @@ $("#print-label").click(function() { {% if roles.stock.change %} $("#stock-duplicate").click(function() { - // Duplicate a stock item + // Duplicate a stock item duplicateStockItem({{ item.pk }}, {}); }); @@ -512,7 +512,7 @@ $("#barcode-unlink").click(function() { }); $("#barcode-scan-into-location").click(function() { - + inventreeGet('{% url "api-stock-detail" item.pk %}', {}, { success: function(item) { scanItemsIntoLocation([item]); diff --git a/InvenTree/stock/templates/stock/location.html b/InvenTree/stock/templates/stock/location.html index 1066adf6ea..496e0b4e1c 100644 --- a/InvenTree/stock/templates/stock/location.html +++ b/InvenTree/stock/templates/stock/location.html @@ -205,7 +205,7 @@ {% include "filter_list.html" with id="location" %}
    - +
    @@ -235,33 +235,33 @@ allowTreeView: true, }); }); - + linkButtonsToSelection( $('#sublocation-table'), [ '#location-print-options', ] ); - + {% if labels_enabled %} $('#print-label').click(function() { var locs = [{{ location.pk }}]; - printStockLocationLabels(locs); + printStockLocationLabels(locs); }); - + $('#multi-location-print-label').click(function() { - + var selections = $('#sublocation-table').bootstrapTable('getSelections'); - + var locations = []; - + selections.forEach(function(loc) { locations.push(loc.pk); }); - + printStockLocationLabels(locations); }); {% endif %} diff --git a/InvenTree/stock/templates/stock/location_delete.html b/InvenTree/stock/templates/stock/location_delete.html index c86ab4bc05..b4e4deb49d 100644 --- a/InvenTree/stock/templates/stock/location_delete.html +++ b/InvenTree/stock/templates/stock/location_delete.html @@ -7,7 +7,7 @@
    {% trans "Are you sure you want to delete this stock location?" %}
    - + {% if location.children.all|length > 0 %}
    {% blocktrans with n=location.children.all|length %}This location contains {{ n }} child locations{% endblocktrans %}.
    @@ -31,4 +31,4 @@
    {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/503.html b/InvenTree/templates/503.html index 606fc03ff0..bc72ace5c0 100644 --- a/InvenTree/templates/503.html +++ b/InvenTree/templates/503.html @@ -14,7 +14,7 @@ {% block body_class %}login-screen{% endblock %} {% block body %} -
    diff --git a/InvenTree/templates/InvenTree/search.html b/InvenTree/templates/InvenTree/search.html index 2759cb0b8b..5ba618137e 100644 --- a/InvenTree/templates/InvenTree/search.html +++ b/InvenTree/templates/InvenTree/search.html @@ -224,7 +224,7 @@ {% endif %} - {% endif %} + {% endif %} enableSidebar( 'search', diff --git a/InvenTree/templates/InvenTree/settings/part.html b/InvenTree/templates/InvenTree/settings/part.html index 4f9841aaaf..1004113dc6 100644 --- a/InvenTree/templates/InvenTree/settings/part.html +++ b/InvenTree/templates/InvenTree/settings/part.html @@ -46,7 +46,7 @@
    +
    diff --git a/InvenTree/templates/InvenTree/settings/plugin.html b/InvenTree/templates/InvenTree/settings/plugin.html index a451fb6544..cd2d921bca 100644 --- a/InvenTree/templates/InvenTree/settings/plugin.html +++ b/InvenTree/templates/InvenTree/settings/plugin.html @@ -36,7 +36,7 @@
    {% url 'admin:plugin_pluginconfig_changelist' as url %} {% include "admin_button.html" with url=url %} - +
    @@ -52,7 +52,7 @@ {% trans "Version" %} - + {% plugin_list as pl_list %} {% for plugin_key, plugin in pl_list.items %} @@ -133,7 +133,7 @@ {% trans "Message" %} - + {% for stage, errors in pl_errors.items %} {% for error_detail in errors %} diff --git a/InvenTree/templates/InvenTree/settings/plugin_settings.html b/InvenTree/templates/InvenTree/settings/plugin_settings.html index 79150ec879..2ba3a401b2 100644 --- a/InvenTree/templates/InvenTree/settings/plugin_settings.html +++ b/InvenTree/templates/InvenTree/settings/plugin_settings.html @@ -70,7 +70,7 @@
    {% trans 'The code information is pulled from the latest git commit for this plugin. It might not reflect official version numbers or information but the actual code running.' %}
    - + {% endif %}
    diff --git a/InvenTree/templates/InvenTree/settings/settings.html b/InvenTree/templates/InvenTree/settings/settings.html index 4e460398f1..3d5519db54 100644 --- a/InvenTree/templates/InvenTree/settings/settings.html +++ b/InvenTree/templates/InvenTree/settings/settings.html @@ -99,7 +99,7 @@ $('table').find('.boolean-setting').change(function() { } } ); - + }); // Callback for when non-boolean settings are edited diff --git a/InvenTree/templates/InvenTree/settings/user_display.html b/InvenTree/templates/InvenTree/settings/user_display.html index 1f52c095ac..bab90aadf9 100644 --- a/InvenTree/templates/InvenTree/settings/user_display.html +++ b/InvenTree/templates/InvenTree/settings/user_display.html @@ -76,7 +76,7 @@ {% if lang_translated > 10 or lang_code == 'en' or lang_code == LANGUAGE_CODE %}{% define True as use_lang %}{% else %}{% define False as use_lang %}{% endif %} {% if ALL_LANG or use_lang %}
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/user_search.html b/InvenTree/templates/InvenTree/settings/user_search.html index f18fb5816c..5e6df86170 100644 --- a/InvenTree/templates/InvenTree/settings/user_search.html +++ b/InvenTree/templates/InvenTree/settings/user_search.html @@ -25,11 +25,11 @@ {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_EXCLUDE_INACTIVE_PURCHASE_ORDERS" user_setting=True icon='fa-eye-slash' %} {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_SHOW_SALES_ORDERS" user_setting=True icon='fa-truck' %} {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_EXCLUDE_INACTIVE_SALES_ORDERS" user_setting=True icon='fa-eye-slash' %} - + {% include "InvenTree/settings/setting.html" with key="SEARCH_PREVIEW_RESULTS" user_setting=True icon='fa-search' %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/account/base.html b/InvenTree/templates/account/base.html index 9a68f7ba31..241be9bb9f 100644 --- a/InvenTree/templates/account/base.html +++ b/InvenTree/templates/account/base.html @@ -50,7 +50,7 @@ -
    @@ -130,4 +130,4 @@ $(document).ready(function () { - \ No newline at end of file + diff --git a/InvenTree/templates/base.html b/InvenTree/templates/base.html index 795a5679aa..1ae46c34f9 100644 --- a/InvenTree/templates/base.html +++ b/InvenTree/templates/base.html @@ -65,7 +65,7 @@ {% block page_title %} -{% inventree_title %} +{% inventree_title %} {% endblock %} @@ -91,7 +91,7 @@
    - + {% block alerts %}
    @@ -164,7 +164,7 @@ - + @@ -246,4 +246,4 @@ $(document).ready(function () { {% endblock %} - \ No newline at end of file + diff --git a/InvenTree/templates/js/dynamic/nav.js b/InvenTree/templates/js/dynamic/nav.js index eed098f162..e22ea19388 100644 --- a/InvenTree/templates/js/dynamic/nav.js +++ b/InvenTree/templates/js/dynamic/nav.js @@ -68,7 +68,7 @@ function activatePanel(label, panel_name, options={}) { function onPanelLoad(panel, callback) { // One-time callback when a panel is first displayed - // Used to implement lazy-loading, rather than firing + // Used to implement lazy-loading, rather than firing // multiple AJAX queries when the page is first loaded. var panelId = `#panel-${panel}`; @@ -130,12 +130,12 @@ function enableSidebar(label, options={}) { // By default, the menu is "expanded" var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded'; - + // We wish to "toggle" the state! setSidebarState(label, state == 'expanded' ? 'collapsed' : 'expanded'); }); } - + // Set the initial state (default = expanded) var state = localStorage.getItem(`inventree-menu-state-${label}`) || 'expanded'; @@ -204,7 +204,7 @@ function enableBreadcrumbTree(options) { node = nodes[node.parent]; } } - + } else { roots.push(node); } @@ -227,7 +227,7 @@ function enableBreadcrumbTree(options) { // Toggle treeview visibilty $('#breadcrumb-tree-collapse').toggle(); - + }); } diff --git a/InvenTree/templates/js/dynamic/settings.js b/InvenTree/templates/js/dynamic/settings.js index 5b52c2a015..4d4434c0c5 100644 --- a/InvenTree/templates/js/dynamic/settings.js +++ b/InvenTree/templates/js/dynamic/settings.js @@ -58,13 +58,13 @@ function editSetting(key, options={}) { // First, read the settings object from the server inventreeGet(url, {}, { success: function(response) { - + if (response.choices && response.choices.length > 0) { response.type = 'choice'; reload_required = true; } - // Construct the field + // Construct the field var fields = { value: { label: response.name, @@ -77,7 +77,7 @@ function editSetting(key, options={}) { // Foreign key lookup available! if (response.type == 'related field') { - + if (response.model_name && response.api_url) { fields.value.type = 'related field'; fields.value.model = response.model_name.split('.').at(-1); diff --git a/InvenTree/templates/js/translated/api.js b/InvenTree/templates/js/translated/api.js index 17b1b2fca0..e260f605cc 100644 --- a/InvenTree/templates/js/translated/api.js +++ b/InvenTree/templates/js/translated/api.js @@ -14,11 +14,11 @@ $.urlParam = function(name) { // eslint-disable-next-line no-useless-escape var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); - + if (results == null) { return null; } - + return decodeURI(results[1]) || 0; }; @@ -80,9 +80,9 @@ function inventreeGet(url, filters={}, options={}) { function inventreeFormDataUpload(url, data, options={}) { /* Upload via AJAX using the FormData approach. - * + * * Note that the following AJAX parameters are required for FormData upload - * + * * processData: false * contentType: false */ diff --git a/InvenTree/templates/js/translated/attachment.js b/InvenTree/templates/js/translated/attachment.js index 858ca8bd84..dd1fe31c66 100644 --- a/InvenTree/templates/js/translated/attachment.js +++ b/InvenTree/templates/js/translated/attachment.js @@ -14,7 +14,7 @@ /* * Add callbacks to buttons for creating new attachments. - * + * * Note: Attachments can also be external links! */ function addAttachmentButtonCallbacks(url, fields={}) { @@ -46,7 +46,7 @@ function addAttachmentButtonCallbacks(url, fields={}) { }; Object.assign(link_fields, fields); - + constructForm(url, { fields: link_fields, method: 'POST', @@ -88,7 +88,7 @@ function loadAttachmentTable(url, options) { constructForm(`${url}${pk}/`, { fields: { link: {}, - comment: {}, + comment: {}, }, processResults: function(data, fields, opts) { // Remove the "link" field if the attachment is a file! @@ -100,7 +100,7 @@ function loadAttachmentTable(url, options) { title: '{% trans "Edit Attachment" %}', }); }); - + // Add callback for 'delete' button $(table).find('.button-attachment-delete').click(function() { var pk = $(this).attr('pk'); diff --git a/InvenTree/templates/js/translated/barcode.js b/InvenTree/templates/js/translated/barcode.js index d6ce81fa38..3c2211e710 100644 --- a/InvenTree/templates/js/translated/barcode.js +++ b/InvenTree/templates/js/translated/barcode.js @@ -324,7 +324,7 @@ function barcodeDialog(title, options={}) { function barcodeScanDialog() { /* * Perform a barcode scan, - * and (potentially) redirect the browser + * and (potentially) redirect the browser */ var modal = '#modal-form'; @@ -345,9 +345,9 @@ function barcodeScanDialog() { 'warning' ); } - } + } }, - ); + ); } @@ -647,7 +647,7 @@ function scanItemsIntoLocation(item_list, options={}) { item_list.forEach(function(item) { items.push({ pk: item.pk || item.id, - quantity: item.quantity, + quantity: item.quantity, }); }); diff --git a/InvenTree/templates/js/translated/bom.js b/InvenTree/templates/js/translated/bom.js index 0119b36664..b15a2613f8 100644 --- a/InvenTree/templates/js/translated/bom.js +++ b/InvenTree/templates/js/translated/bom.js @@ -95,7 +95,7 @@ function constructBomUploadTable(data, options={}) { // Handle any errors raised by initial data import if (row.data.errors.part) { - addFieldErrorMessage(`items_sub_part_${idx}`, row.data.errors.part); + addFieldErrorMessage(`items_sub_part_${idx}`, row.data.errors.part); } if (row.data.errors.quantity) { @@ -156,7 +156,7 @@ function constructBomUploadTable(data, options={}) { // Request API endpoint options getApiEndpointOptions('{% url "api-bom-list" %}', function(response) { - + var fields = response.actions.POST; data.rows.forEach(function(row, idx) { @@ -543,7 +543,7 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) { ${part_thumb} ${part_name} - ${part_desc}
    `; - + // Add a table of individual rows html += ` @@ -643,7 +643,7 @@ function bomSubstitutesDialog(bom_item_id, substitutes, options={}) { // Re-enable the "submit" button $(opts.modal).find('#modal-form-submit').prop('disabled', false); - + // Reload the parent BOM table reloadParentTable(); } @@ -659,7 +659,7 @@ function deleteBomItems(items, options={}) { var sub_part = item.sub_part_detail; var thumb = thumbnailImage(sub_part.thumbnail || sub_part.image); - + var html = ` @@ -709,7 +709,7 @@ function deleteBomItems(items, options={}) { function deleteNextBomItem() { if (items.length > 0) { - + var item = items.shift(); inventreeDelete(`/api/bom/${item.pk}/`, @@ -735,13 +735,13 @@ function deleteBomItems(items, options={}) { function loadBomTable(table, options={}) { /* Load a BOM table with some configurable options. - * + * * Following options are available: * editable - Should the BOM table be editable? * bom_url - Address to request BOM data from * part_url - Address to request Part data from * parent_id - Parent ID of the owning part - * + * * BOM data are retrieved from the server via AJAX query */ @@ -831,10 +831,10 @@ function loadBomTable(table, options={}) { var html = ''; var sub_part = row.sub_part_detail; - + // Display an extra icon if this part is an assembly if (sub_part.assembly) { - + if (row.sub_assembly_received) { // Data received, ignore } else if (row.sub_assembly_requested) { @@ -895,7 +895,7 @@ function loadBomTable(table, options={}) { text = parseFloat(text); if (row.optional) { - text += ' ({% trans "Optional" %})'; + text += ' ({% trans "Optional" %})'; } if (row.overage) { @@ -920,7 +920,7 @@ function loadBomTable(table, options={}) { var variant_stock = row.allow_variants ? (row.available_variant_stock || 0) : 0; var available_stock = availableQuantity(row); - + var text = `${available_stock}`; if (available_stock <= 0) { @@ -957,7 +957,7 @@ function loadBomTable(table, options={}) { } } }); - + if (show_pricing) { cols.push({ field: 'purchase_price_range', @@ -1139,7 +1139,7 @@ function loadBomTable(table, options={}) { row.sub_assembly_received = true; $(table).bootstrapTable('updateByUniqueId', bom_pk, row, true); - + table.bootstrapTable('append', response); }, error: function(xhr) { @@ -1302,10 +1302,10 @@ function loadBomTable(table, options={}) { * Arguments: * - table: The ID string of the table element e.g. '#used-in-table' * - part_id: The ID (PK) of the part we are interested in - * + * * Options: - * - - * + * - + * * The following "options" are available. */ function loadUsedInTable(table, part_id, options={}) { @@ -1343,14 +1343,14 @@ function loadUsedInTable(table, part_id, options={}) { // Iterate through each variant item for (var jj = 0; jj < variantData.length; jj++) { variantData[jj].parent = row.pk; - + var variant = variantData[jj]; // Add this variant to the table, augmented $(table).bootstrapTable('append', [{ - // Point the parent to the "master" assembly row + // Point the parent to the "master" assembly row parent: row.pk, - part: variant.pk, + part: variant.pk, part_detail: variant, sub_part: row.sub_part, sub_part_detail: row.sub_part_detail, diff --git a/InvenTree/templates/js/translated/build.js b/InvenTree/templates/js/translated/build.js index 814f2a3247..34e071a461 100644 --- a/InvenTree/templates/js/translated/build.js +++ b/InvenTree/templates/js/translated/build.js @@ -126,7 +126,7 @@ function newBuildOrder(options={}) { /* Construct a form to cancel a build order */ function cancelBuildOrder(build_id, options={}) { - + constructForm( `/api/build/${build_id}/cancel/`, { @@ -304,7 +304,7 @@ function createBuildOutput(build_id, options) { * Construct a set of output buttons for a particular build output */ function makeBuildOutputButtons(output_id, build_info, options={}) { - + var html = `
    `; // Tracked parts? Must be individually allocated @@ -355,7 +355,7 @@ function makeBuildOutputButtons(output_id, build_info, options={}) { /* * Unallocate stock against a particular build order - * + * * Options: * - output: pk value for a stock item "build output" * - bom_item: pk value for a particular BOMItem (build item) @@ -401,7 +401,7 @@ function unallocateStock(build_id, options={}) { * Launch a modal form to complete selected build outputs */ function completeBuildOutputs(build_id, outputs, options={}) { - + if (outputs.length == 0) { showAlertDialog( '{% trans "Select Build Outputs" %}', @@ -487,7 +487,7 @@ function completeBuildOutputs(build_id, outputs, options={}) { }); }, onSubmit: function(fields, opts) { - + // Extract data elements from the form var data = { outputs: [], @@ -631,7 +631,7 @@ function deleteBuildOutputs(build_id, outputs, options={}) { var pk = $(this).attr('pk'); $(opts.modal).find(`#output_row_${pk}`).remove(); - }); + }); }, onSubmit: function(fields, opts) { var data = { @@ -753,7 +753,7 @@ function loadBuildOrderAllocationTable(table, options={}) { if (!value) { return '{% trans "Location not specified" %}'; } - + var link = `/stock/location/${value}`; var text = row.location_detail.description; @@ -803,7 +803,7 @@ function sumAllocationsForBomRow(bom_row, allocations) { * Display a "build output" table for a particular build. * * This displays a list of "active" (i.e. "in production") build outputs for a given build - * + * */ function loadBuildOutputTable(build_info, options={}) { @@ -825,7 +825,7 @@ function loadBuildOutputTable(build_info, options={}) { setupFilterList('builditems', $(table), options.filterTarget || '#filter-list-incompletebuilditems'); function setupBuildOutputButtonCallbacks() { - + // Callback for the "allocate" button $(table).find('.button-output-allocate').click(function() { var pk = $(this).attr('pk'); @@ -997,7 +997,7 @@ function loadBuildOutputTable(build_info, options={}) { // Check how many BOM lines have been completely allocated for this build output bom_items.forEach(function(bom_item) { - + var required_quantity = bom_item.quantity * row.quantity; if (sumAllocationsForBomRow(bom_item, row.allocations) >= required_quantity) { @@ -1281,7 +1281,7 @@ function loadBuildOutputTable(build_info, options={}) { $(table).on('expand-row.bs.table', function(detail, index, row) { $(`#button-output-allocate-${row.pk}`).prop('disabled', false); }); - + // Disable the "allocate" button when the sub-table is collapsed $(table).on('collapse-row.bs.table', function(detail, index, row) { $(`#button-output-allocate-${row.pk}`).prop('disabled', true); @@ -1364,9 +1364,9 @@ function loadBuildOutputTable(build_info, options={}) { /* * Display the "allocation table" for a particular build output. - * + * * This displays a table of required allocations for a particular build output - * + * * Args: * - buildId: The PK of the Build object * - partId: The PK of the Part object @@ -1375,7 +1375,7 @@ function loadBuildOutputTable(build_info, options={}) { * -- table: The #id of the table (will be auto-calculated if not provided) */ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { - + var buildId = buildInfo.pk; var partId = buildInfo.part; @@ -1628,7 +1628,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { $(table).inventreeTable({ data: bom_items, disablePagination: true, - formatNoMatches: function() { + formatNoMatches: function() { return '{% trans "No BOM items found" %}'; }, name: 'build-allocation', @@ -1715,7 +1715,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { field: 'actions', formatter: function(value, row) { /* Actions available for a particular stock item allocation: - * + * * - Edit the allocation quantity * - Delete the allocation */ @@ -1812,15 +1812,15 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { var variant_stock = row.allow_variants ? (row.available_variant_stock || 0) : 0; var available_stock = availableQuantity(row); - + var required = requiredQuantity(row); var text = ''; - + if (available_stock > 0) { text += `${available_stock}`; } - + if (available_stock < required) { text += ``; } else { @@ -1838,12 +1838,12 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { } else if (substitute_stock > 0) { extra = '{% trans "Includes substitute stock" %}'; } - + if (extra) { text += ``; } } - + return renderLink(text, url); }, sorter: function(valA, valB, rowA, rowB) { @@ -1862,7 +1862,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { }, sorter: function(valA, valB, rowA, rowB) { // Custom sorting function for progress bars - + var aA = allocatedQuantity(rowA); var aB = allocatedQuantity(rowB); @@ -1932,12 +1932,12 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { /** * Allocate stock items to a build - * + * * arguments: * - buildId: ID / PK value for the build * - partId: ID / PK value for the part being built * - bom_items: A list of BomItem objects to be allocated - * + * * options: * - output: ID / PK of the associated build output (or null for untracked items) * - source_location: ID / PK of the top-level StockLocation to source stock from (or null) @@ -2109,7 +2109,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) {
    ${thumb} ${sub_part.full_name}
    `; - + constructForm(`/api/build/${build_id}/allocate/`, { method: 'POST', fields: {}, @@ -2193,7 +2193,7 @@ function allocateStockToBuild(build_id, part_id, bom_items, options={}) { filters.location = location; filters.cascade = true; - + return filters; }, noResults: function(query) { @@ -2371,7 +2371,7 @@ function loadBuildTable(table, options) { columns: [ { field: 'pk', - title: 'ID', + title: 'ID', visible: false, switchable: false, }, diff --git a/InvenTree/templates/js/translated/company.js b/InvenTree/templates/js/translated/company.js index d7b98841e4..1ed38e4b7d 100644 --- a/InvenTree/templates/js/translated/company.js +++ b/InvenTree/templates/js/translated/company.js @@ -10,7 +10,7 @@ setupFilterList, showQuestionDialog, */ - + /* exported createCompany, createManufacturerPart, @@ -26,7 +26,7 @@ /** * Construct a set of form fields for creating / editing a ManufacturerPart - * @returns + * @returns */ function manufacturerPartFields() { @@ -46,7 +46,7 @@ function manufacturerPartFields() { /** * Launches a form to create a new ManufacturerPart - * @param {object} options + * @param {object} options */ function createManufacturerPart(options={}) { @@ -67,7 +67,7 @@ function createManufacturerPart(options={}) { var company_fields = companyFormFields(); company_fields.is_manufacturer.value = true; - + return company_fields; } }; @@ -84,7 +84,7 @@ function createManufacturerPart(options={}) { /** * Launches a form to edit a ManufacturerPart * @param {integer} part - ID of a ManufacturerPart - * @param {object} options + * @param {object} options */ function editManufacturerPart(part, options={}) { @@ -414,7 +414,7 @@ function deleteManufacturerParts(selections, options={}) {

    ${item.MPN} - ${item.part_detail.full_name}

    `; }); - + text += ` `; @@ -577,7 +577,7 @@ function loadManufacturerPartTable(table, url, options) { var pk = $(this).attr('pk'); editManufacturerPart( - pk, + pk, { onSuccess: function() { $(table).bootstrapTable('refresh'); @@ -590,7 +590,7 @@ function loadManufacturerPartTable(table, url, options) { var pk = $(this).attr('pk'); deleteManufacturerPart( - pk, + pk, { onSuccess: function() { $(table).bootstrapTable('refresh'); @@ -775,7 +775,7 @@ function loadSupplierPartTable(table, url, options) { formatter: function(value, row) { if (value) { var name = row.supplier_detail.name; - var url = `/company/${value}/`; + var url = `/company/${value}/`; var html = imageHoverIcon(row.supplier_detail.image) + renderLink(name, url); return html; @@ -875,7 +875,7 @@ function loadSupplierPartTable(table, url, options) { var pk = $(this).attr('pk'); editSupplierPart( - pk, + pk, { onSuccess: function() { $(table).bootstrapTable('refresh'); @@ -888,7 +888,7 @@ function loadSupplierPartTable(table, url, options) { var pk = $(this).attr('pk'); deleteSupplierPart( - pk, + pk, { onSuccess: function() { $(table).bootstrapTable('refresh'); diff --git a/InvenTree/templates/js/translated/filters.js b/InvenTree/templates/js/translated/filters.js index dd45aa6628..349b3028ed 100644 --- a/InvenTree/templates/js/translated/filters.js +++ b/InvenTree/templates/js/translated/filters.js @@ -6,22 +6,22 @@ inventreeSave, reloadTableFilters, */ - + /* exported setupFilterList, */ /** * Code for managing query filters / table options. - * + * * Optional query filters are available to the user for various * tables display in the web interface. - * These filters are saved to the web session, and should be + * These filters are saved to the web session, and should be * persistent for a given table type. - * + * * This makes use of the 'inventreeSave' and 'inventreeLoad' functions * for writing to and reading from session storage. - * + * */ @@ -39,7 +39,7 @@ function defaultFilters() { /** * Load table filters for the given table from session storage - * + * * @param tableKey - String key for the particular table * @param defaults - Default filters for this table e.g. 'cascade=1&location=5' */ @@ -73,7 +73,7 @@ function loadTableFilters(tableKey) { /** * Save table filters to session storage - * + * * @param {*} tableKey - string key for the given table * @param {*} filters - object of string:string pairs */ @@ -251,7 +251,7 @@ function generateFilterInput(tableKey, filterKey) { /** * Configure a filter list for a given table - * + * * @param {*} tableKey - string lookup key for filter settings * @param {*} table - bootstrapTable element to update * @param {*} target - name of target element on page @@ -410,7 +410,7 @@ function setupFilterList(tableKey, table, target, options={}) { /** * Return the pretty title for the given table and filter selection. * If no title is provided, default to the key value. - * + * */ function getFilterTitle(tableKey, filterKey) { var settings = getFilterSettings(tableKey, filterKey); @@ -460,4 +460,3 @@ function getFilterOptionValue(tableKey, filterKey, valueKey) { // Cannot map to a display string - return the original text return value; } - diff --git a/InvenTree/templates/js/translated/forms.js b/InvenTree/templates/js/translated/forms.js index d45a2de78c..a4af51ef74 100644 --- a/InvenTree/templates/js/translated/forms.js +++ b/InvenTree/templates/js/translated/forms.js @@ -62,7 +62,7 @@ $.fn.select2.defaults.set('theme', 'bootstrap-5'); * can perform a GET method at the endpoint. */ function canView(OPTIONS) { - + if ('actions' in OPTIONS) { return ('GET' in OPTIONS.actions); } else { @@ -90,7 +90,7 @@ function canCreate(OPTIONS) { * can perform a PUT or PATCH method at the endpoint */ function canChange(OPTIONS) { - + if ('actions' in OPTIONS) { return ('PUT' in OPTIONS.actions || 'PATCH' in OPTIONS.actions); } else { @@ -147,25 +147,25 @@ function getApiEndpointOptions(url, callback) { /* * Construct a 'creation' (POST) form, to create a new model in the database. - * + * * arguments: * - fields: The 'actions' object provided by the OPTIONS endpoint - * + * * options: - * - + * - */ function constructCreateForm(fields, options) { // Check if default values were provided for any fields for (const name in fields) { - + var field = fields[name]; var field_options = options.fields[name] || {}; // If a 'value' is not provided for the field, if (field.value == null) { - + if ('value' in field_options) { // Client has specified the default value for the field field.value = field_options.value; @@ -183,12 +183,12 @@ function constructCreateForm(fields, options) { /* * Construct a 'change' (PATCH) form, to create a new model in the database. - * + * * arguments: * - fields: The 'actions' object provided by the OPTIONS endpoint - * + * * options: - * - + * - */ function constructChangeForm(fields, options) { @@ -203,12 +203,12 @@ function constructChangeForm(fields, options) { json: 'application/json', }, success: function(data) { - + // An optional function can be provided to process the returned results, // before they are rendered to the form if (options.processResults) { var processed = options.processResults(data, fields, options); - + // If the processResults function returns data, it will be stored if (processed) { data = processed; @@ -225,7 +225,7 @@ function constructChangeForm(fields, options) { // Store the entire data object options.instance = data; - + constructFormBody(fields, options); }, error: function(xhr) { @@ -240,7 +240,7 @@ function constructChangeForm(fields, options) { /* * Construct a 'delete' form, to remove a model instance from the database. - * + * * arguments: * - fields: The 'actions' object provided by the OPTIONS request * - options: The 'options' object provided by the client @@ -282,7 +282,7 @@ function constructDeleteForm(fields, options) { /* * Request API OPTIONS data from the server, * and construct a modal form based on the response. - * + * * url: API URL which defines form data * options: * - method: The HTTP method e.g. 'PUT', 'POST', 'DELETE' (default='PATCH') @@ -310,7 +310,7 @@ function constructDeleteForm(fields, options) { * - reload: Set to true to reload the current page after form success * - confirm: Set to true to require a "confirm" button * - confirmText: Text for confirm button (default = "Confirm") - * + * */ function constructForm(url, options) { @@ -321,7 +321,7 @@ function constructForm(url, options) { options.fields = options.fields || {}; - // Save the URL + // Save the URL options.url = url; // Default HTTP method @@ -345,7 +345,7 @@ function constructForm(url, options) { /* * Determine what "type" of form we want to construct, * based on the requested action. - * + * * First we must determine if the user has the correct permissions! */ @@ -360,7 +360,7 @@ function constructForm(url, options) { details: '{% trans "Create operation not allowed" %}', icon: 'fas fa-user-times', }); - + console.warn(`'POST action unavailable at ${url}`); } break; @@ -375,7 +375,7 @@ function constructForm(url, options) { details: '{% trans "Update operation not allowed" %}', icon: 'fas fa-user-times', }); - + console.warn(`${options.method} action unavailable at ${url}`); } break; @@ -389,7 +389,7 @@ function constructForm(url, options) { details: '{% trans "Delete operation not allowed" %}', icon: 'fas fa-user-times', }); - + console.warn(`DELETE action unavailable at ${url}`); } break; @@ -403,7 +403,7 @@ function constructForm(url, options) { details: '{% trans "View operation not allowed" %}', icon: 'fas fa-user-times', }); - + console.warn(`GET action unavailable at ${url}`); } break; @@ -417,7 +417,7 @@ function constructForm(url, options) { /* * Construct a modal form based on the provided options - * + * * arguments: * - fields: The endpoint description returned from the OPTIONS request * - options: form options object provided by the client. @@ -450,7 +450,7 @@ function constructFormBody(fields, options) { // Provide each field object with its own name for (field in fields) { fields[field].name = field; - + // If any "instance_filters" are defined for the endpoint, copy them across (overwrite) if (fields[field].instance_filters) { fields[field].filters = Object.assign(fields[field].filters || {}, fields[field].instance_filters); @@ -512,7 +512,7 @@ function constructFormBody(fields, options) { default: break; } - + html += constructField(field_name, field, options); } @@ -529,7 +529,7 @@ function constructFormBody(fields, options) { var modal = options.modal; modalEnable(modal, true); - + // Insert generated form content $(modal).find('#form-content').html(html); @@ -547,7 +547,7 @@ function constructFormBody(fields, options) { if (options.postFormContent) { $(modal).find('#post-form-content').html(options.postFormContent); } - + // Clear any existing buttons from the modal $(modal).find('#modal-footer-buttons').html(''); @@ -659,7 +659,7 @@ function extractFormData(fields, options) { var data = {}; for (var idx = 0; idx < options.field_names.length; idx++) { - + var name = options.field_names[idx]; var field = fields[name] || null; @@ -677,7 +677,7 @@ function extractFormData(fields, options) { /* * Submit form data to the server. - * + * */ function submitFormData(fields, options) { @@ -712,7 +712,7 @@ function submitFormData(fields, options) { case 'decimal': if (!validateFormField(name, options)) { data_valid = false; - + data_errors[name] = ['{% trans "Enter a valid number" %}']; } break; @@ -734,7 +734,7 @@ function submitFormData(fields, options) { var file = field_files[0]; form_data.append(name, file); - + has_files = true; } } else { @@ -780,7 +780,7 @@ function submitFormData(fields, options) { handleFormSuccess(response, options); }, error: function(xhr) { - + $(options.modal).find('#modal-progress-spinner').hide(); switch (xhr.status) { @@ -808,7 +808,7 @@ function submitFormData(fields, options) { * */ function updateFieldValues(fields, options) { - + for (var idx = 0; idx < options.field_names.length; idx++) { var name = options.field_names[idx]; @@ -896,7 +896,7 @@ function getFormFieldElement(name, options) { * An invalid number is expunged at the client side by the getFormFieldValue() function, * which means that an empty string '' is sent to the server if the number is not valud. * This can result in confusing error messages displayed under the form field. - * + * * So, we can invalid numbers and display errors *before* the form is submitted! */ function validateFormField(name, options) { @@ -962,7 +962,7 @@ function getFormFieldValue(name, field={}, options={}) { /* * Handle successful form posting - * + * * arguments: * - response: The JSON response object from the server * - options: The original options object provided by the client @@ -1004,7 +1004,7 @@ function handleFormSuccess(response, options) { target: msg_target, }); } - + if (response && response.info) { showAlertOrCache(response.info, cache, {style: 'info'}); } @@ -1020,7 +1020,7 @@ function handleFormSuccess(response, options) { if (persist) { // Instead of closing the form and going somewhere else, // reload (empty) the form so the user can input more data - + // Reset the status of the "submit" button if (options.modal) { $(options.modal).find('#modal-form-submit').prop('disabled', false); @@ -1065,7 +1065,7 @@ function clearFormErrors(options={}) { if (options && options.modal) { // Remove the individual error messages $(options.modal).find('.form-error-message').remove(); - + $(options.modal).find('.modal-content').removeClass('modal-error'); // Remove the "has error" class @@ -1086,12 +1086,12 @@ function clearFormErrors(options={}) { * * We need to know the unique ID of each item in the array, * and the array length must equal the length of the array returned from the server - * + * * arguments: * - response: The JSON error response from the server * - parent: The name of the parent field e.g. "items" * - options: The global options struct - * + * * options: * - nested: A map of nested ID values for the "parent" field * e.g. @@ -1102,7 +1102,7 @@ function clearFormErrors(options={}) { * 12 * ] * } - * + * */ function handleNestedErrors(errors, field_name, options={}) { @@ -1115,7 +1115,7 @@ function handleNestedErrors(errors, field_name, options={}) { } var nest_list = nest_list = options['nested'][field_name]; - + // Nest list must be provided! if (!nest_list) { console.warn(`handleNestedErrors missing nesting options for field '${fieldName}'`); @@ -1123,9 +1123,9 @@ function handleNestedErrors(errors, field_name, options={}) { } for (var idx = 0; idx < error_list.length; idx++) { - + var error_item = error_list[idx]; - + if (idx >= nest_list.length) { console.warn(`handleNestedErrors returned greater number of errors (${error_list.length}) than could be handled (${nest_list.length})`); break; @@ -1133,7 +1133,7 @@ function handleNestedErrors(errors, field_name, options={}) { // Extract the particular ID of the nested item var nest_id = nest_list[idx]; - + // Here, error_item is a map of field names to error messages for (sub_field_name in error_item) { @@ -1158,7 +1158,7 @@ function handleNestedErrors(errors, field_name, options={}) { row.after(html); } - + } // Find the target (nested) field @@ -1178,7 +1178,7 @@ function handleNestedErrors(errors, field_name, options={}) { /* * Display form error messages as returned from the server. - * + * * arguments: * - errors: The JSON error response from the server * - fields: The form data object @@ -1195,7 +1195,7 @@ function handleFormErrors(errors, fields={}, options={}) { clearFormErrors(options); var non_field_errors = null; - + if (options.modal) { non_field_errors = $(options.modal).find('#non-field-errors'); } else { @@ -1310,13 +1310,13 @@ function isFieldVisible(field, options) { /* * Attach callbacks to specified fields, * triggered after the field value is edited. - * + * * Callback function is called with arguments (name, field, options) */ function addFieldCallbacks(fields, options) { for (var idx = 0; idx < options.field_names.length; idx++) { - + var name = options.field_names[idx]; var field = fields[name]; @@ -1581,7 +1581,7 @@ function addSecondaryModal(field, fields, options) { /* * Initialize a single related-field - * + * * argument: * - modal: DOM identifier for the modal window * - name: name of the field e.g. 'location' @@ -1657,7 +1657,7 @@ function initializeRelatedField(field, fields, options={}) { query.search = params.term; query.offset = offset; query.limit = pageSize; - + // Allow custom run-time filter augmentation if ('adjustFilters' in field) { query = field.adjustFilters(query, options); @@ -1707,7 +1707,7 @@ function initializeRelatedField(field, fields, options={}) { // Extract 'instance' data passed through from an initial value // Or, use the raw 'item' data as a backup var data = item; - + if (item.element && item.element.instance) { data = item.element.instance; } @@ -1732,7 +1732,7 @@ function initializeRelatedField(field, fields, options={}) { // Extract 'instance' data passed through from an initial value // Or, use the raw 'item' data as a backup var data = item; - + if (item.element && item.element.instance) { data = item.element.instance; } @@ -1761,7 +1761,7 @@ function initializeRelatedField(field, fields, options={}) { // If a 'value' is already defined, grab the model info from the server if (field.value) { - + var pk = field.value; var url = `${field.api_url}/${pk}/`.replace('//', '/'); @@ -1806,7 +1806,7 @@ function initializeRelatedField(field, fields, options={}) { /* * Set the value of a select2 instace for a "related field", * e.g. with data returned from a secondary modal - * + * * arguments: * - name: The name of the field * - data: JSON data representing the model instance @@ -1852,7 +1852,7 @@ function searching() { /* * Render a "foreign key" model reference in a select2 instance. * Allows custom rendering with access to the entire serialized object. - * + * * arguments: * - name: The name of the field e.g. 'location' * - model: The name of the InvenTree model e.g. 'stockitem' @@ -1872,7 +1872,7 @@ function renderModelData(name, model, data, parameters, options) { var renderer = null; - // Find a custom renderer + // Find a custom renderer switch (model) { case 'company': renderer = renderCompany; @@ -1919,7 +1919,7 @@ function renderModelData(name, model, data, parameters, options) { default: break; } - + if (renderer != null) { html = renderer(name, data, parameters, options); } @@ -1954,16 +1954,16 @@ function getFieldName(name, options={}) { /* * Construct a single form 'field' for rendering in a form. - * + * * arguments: * - name: The 'name' of the field * - parameters: The field parameters supplied by the DRF OPTIONS method - * + * * options: - * - - * + * - + * * The function constructs a fieldset which mostly replicates django "crispy" forms: - * + * * - Field name * - Field (depends on specified field type) * - Field description (help text) @@ -2012,7 +2012,7 @@ function constructField(name, parameters, options={}) { if (group_options.collapsible) { html += `
    - + `; } else { html += `
    `; @@ -2044,7 +2044,7 @@ function constructField(name, parameters, options={}) { if (parameters.before) { html += parameters.before; } - + var hover_title = ''; if (parameters.help_text) { @@ -2062,7 +2062,7 @@ function constructField(name, parameters, options={}) { // Does this input deserve "extra" decorators? var extra = (parameters.icon != null) || (parameters.prefix != null) || (parameters.prefixRaw != null); - + // Some fields can have 'clear' inputs associated with them if (!parameters.required && !parameters.read_only) { switch (parameters.type) { @@ -2080,10 +2080,10 @@ function constructField(name, parameters, options={}) { break; } } - + if (extra) { html += `
    `; - + if (parameters.prefix) { html += `${parameters.prefix}`; } else if (parameters.prefixRaw) { @@ -2120,7 +2120,7 @@ function constructField(name, parameters, options={}) { html += `
    `; // controls html += `
    `; // form-group - + if (parameters.after) { html += parameters.after; } @@ -2145,17 +2145,17 @@ function constructLabel(name, parameters) { } var html = ``; return html; @@ -2164,11 +2164,11 @@ function constructLabel(name, parameters) { /* * Construct a form input based on the field parameters - * + * * arguments: * - name: The name of the field * - parameters: Field parameters returned by the OPTIONS method - * + * */ function constructInput(name, parameters, options={}) { @@ -2212,7 +2212,7 @@ function constructInput(name, parameters, options={}) { // Unsupported field type! break; } - + if (func != null) { html = func(name, parameters, options); } else { @@ -2499,14 +2499,14 @@ function constructRawInput(name, parameters) { /* * Construct a 'help text' div based on the field parameters - * + * * arguments: * - name: The name of the field * - parameters: Field parameters returned by the OPTIONS method - * + * */ function constructHelpText(name, parameters) { - + var html = `
    ${parameters.help_text}
    `; return html; @@ -2567,7 +2567,7 @@ function selectImportFields(url, data={}, options={}) { var headers = `{% trans "File Column" %}{% trans "Field Name" %}`; var html = ''; - + if (options.preamble) { html += options.preamble; } @@ -2580,7 +2580,7 @@ function selectImportFields(url, data={}, options={}) { fields: {}, preFormContent: html, onSubmit: function(fields, opts) { - + var columns = []; for (var idx = 0; idx < field_names.length; idx++) { @@ -2605,16 +2605,16 @@ function selectImportFields(url, data={}, options={}) { } }, error: function(xhr) { - + $(opts.modal).find('#modal-progress-spinner').hide(); - + switch (xhr.status) { case 400: handleFormErrors(xhr.responseJSON, fields, opts); break; default: $(opts.modal).modal('hide'); - + console.error(`upload error at ${opts.url}`); showApiError(xhr, opts.url); break; diff --git a/InvenTree/templates/js/translated/helpers.js b/InvenTree/templates/js/translated/helpers.js index dc40d1e30c..5747c2f71e 100644 --- a/InvenTree/templates/js/translated/helpers.js +++ b/InvenTree/templates/js/translated/helpers.js @@ -60,7 +60,7 @@ function imageHoverIcon(url) { /** * Renders a simple thumbnail image - * @param {String} url is the image URL + * @param {String} url is the image URL * @returns html tag */ function thumbnailImage(url, options={}) { @@ -131,7 +131,7 @@ function makeIconButton(icon, cls, pk, title, options={}) { /* * Render a progessbar! - * + * * @param value is the current value of the progress bar * @param maximum is the maximum value of the progress bar */ @@ -164,7 +164,7 @@ function makeProgressBar(value, maximum, opts={}) { var style = options.style || ''; var text = options.text; - + if (!text) { if (style == 'percent') { // Display e.g. "50%" @@ -247,13 +247,13 @@ function setupNotesField(element, url, options={}) { if (editable) { // Heading icons toolbar_icons.push('heading-1', 'heading-2', 'heading-3', '|'); - + // Font style toolbar_icons.push('bold', 'italic', 'strikethrough', '|'); - + // Text formatting toolbar_icons.push('unordered-list', 'ordered-list', 'code', 'quote', '|'); - + // Elements toolbar_icons.push('table', 'link', 'image'); } @@ -275,11 +275,11 @@ function setupNotesField(element, url, options={}) { if (!editable) { // Set readonly mde.codemirror.setOption('readOnly', true); - + // Hide the "edit" and "save" buttons $('#edit-notes').hide(); $('#save-notes').hide(); - + } else { mde.togglePreview(); @@ -289,7 +289,7 @@ function setupNotesField(element, url, options={}) { $('#save-notes').show(); // Show the toolbar - $(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').show(); + $(`#${element}`).next('.EasyMDEContainer').find('.editor-toolbar').show(); mde.togglePreview(); }); @@ -313,4 +313,3 @@ function setupNotesField(element, url, options={}) { }); } } - diff --git a/InvenTree/templates/js/translated/label.js b/InvenTree/templates/js/translated/label.js index 388509c8bf..c95962e526 100644 --- a/InvenTree/templates/js/translated/label.js +++ b/InvenTree/templates/js/translated/label.js @@ -224,7 +224,7 @@ function selectLabel(labels, items, options={}) { /** * Present the user with the available labels, * and allow them to select which label to print. - * + * * The intent is that the available labels have been requested * (via AJAX) from the server. */ @@ -249,7 +249,7 @@ function selectLabel(labels, items, options={}) { } var plugin_selection = ''; - + if (plugins_enabled && plugins.length > 0) { plugin_selection =`
    diff --git a/InvenTree/templates/js/translated/modals.js b/InvenTree/templates/js/translated/modals.js index 464006ae12..128278dd23 100644 --- a/InvenTree/templates/js/translated/modals.js +++ b/InvenTree/templates/js/translated/modals.js @@ -20,7 +20,7 @@ /* * Create and display a new modal dialog - * + * * options: * - title: Form title to render * - submitText: Text to render on 'submit' button (default = "Submit") @@ -94,7 +94,7 @@ function createNewModal(options={}) { if (options.focus) { getFieldByName(modal_name, options.focus).focus(); } - + // Steal keyboard focus $(modal_name).focus(); @@ -122,7 +122,7 @@ function createNewModal(options={}) { // Simulate a click on the 'Submit' button $(modal_name).find('#modal-form-submit').click(); } - + return false; } }); @@ -163,10 +163,10 @@ function makeOptionsList(elements, textFunc, valueFunc, titleFunc) { * from the (assumed array) of elements. * For each element, we pass the element to the supplied functions, * which (in turn) generate display / value / title values. - * + * * Args: * - elements: List of elements - * - textFunc: Function which takes an element and generates the text to be displayed + * - textFunc: Function which takes an element and generates the text to be displayed * - valueFunc: optional function which takes an element and generates the value * - titleFunc: optional function which takes an element and generates a title */ @@ -214,7 +214,7 @@ function setFieldOptions(fieldName, optionList, options={}) { var addEmptyOption = options.addEmptyOption || true; - // If not appending, clear out the field... + // If not appending, clear out the field... if (!append) { field.find('option').remove(); } @@ -246,7 +246,7 @@ function reloadFieldOptions(fieldName, options) { * * Args: * - fieldName: The name of the field - * - options: + * - options: * -- url: Query url * -- params: Query params * -- value: A function which takes a returned option and returns the 'value' (if not specified, the `pk` field is used) @@ -289,7 +289,7 @@ function reloadFieldOptions(fieldName, options) { function enableField(fieldName, enabled, options={}) { /* Enable (or disable) a particular field in a modal. - * + * * Args: * - fieldName: The name of the field * - enabled: boolean enabled / disabled status @@ -366,7 +366,7 @@ function partialMatcher(params, data) { function attachSelect(modal) { - /* Attach 'select2' functionality to any drop-down list in the modal. + /* Attach 'select2' functionality to any drop-down list in the modal. * Provides search filtering for dropdown items */ @@ -391,7 +391,7 @@ function attachBootstrapCheckbox(modal) { function loadingMessageContent() { - /* Render a 'loading' message to display in a form + /* Render a 'loading' message to display in a form * when waiting for a response from the server */ @@ -404,7 +404,7 @@ function afterForm(response, options) { /* afterForm is called after a form is successfully submitted, * and the form is dismissed. * Used for general purpose functionality after form submission: - * + * * - Display a bootstrap alert (success / info / warning / danger) * - Run a supplied success callback function * - Redirect the browser to a different URL @@ -424,11 +424,11 @@ function afterForm(response, options) { if (response.info) { showAlertOrCache(response.info, cache, {style: 'info'}); } - + if (response.warning) { showAlertOrCache(response.warning, cache, {style: 'warning'}); } - + if (response.danger) { showAlertOrCache(response.danger, cache, {style: 'danger'}); } @@ -467,7 +467,7 @@ function modalEnable(modal, enable=true) { function modalSetTitle(modal, title='') { - /* Update the title of a modal form + /* Update the title of a modal form */ $(modal + ' #modal-title').html(title); } @@ -496,7 +496,7 @@ function modalSetCloseText(modal, text) { function modalSetButtonText(modal, submit_text, close_text) { /* Set the button text for a modal form - * + * * submit_text - text for the form submit button * close_text - text for the form dismiss button */ @@ -575,8 +575,8 @@ function renderErrorMessage(xhr) { function showAlertDialog(title, content, options={}) { /* Display a modal dialog message box. - * - * title - Title text + * + * title - Title text * content - HTML content of the dialog window */ @@ -600,7 +600,7 @@ function showAlertDialog(title, content, options={}) { function showQuestionDialog(title, content, options={}) { /* Display a modal dialog for user input (Yes/No confirmation dialog) - * + * * title - Title text * content - HTML content of the dialog window * options: @@ -609,7 +609,7 @@ function showQuestionDialog(title, content, options={}) { * cancel_text - Text for the cancel button (default = 'Cancel') * accept - Function to run if the user presses 'Accept' * cancel - Functino to run if the user presses 'Cancel' - */ + */ var modal = createNewModal({ title: title, @@ -632,9 +632,9 @@ function showQuestionDialog(title, content, options={}) { function openModal(options) { /* Open a modal form, and perform some action based on the provided options object: - * + * * options can contain: - * + * * modal - ID of the modal form element (default = '#modal-form') * title - Custom title for the form * content - Default content for the form panel @@ -743,7 +743,7 @@ function attachSecondaryModal(modal, options) { /* Attach a secondary modal form to the primary modal form. * Inserts a button into the primary form which, when clicked, * will launch the secondary modal to do /something/ and then return a result. - * + * * options: * field: Name of the field to attach to * label: Button text @@ -834,7 +834,7 @@ function attachButtons(modal, buttons) { function attachFieldCallback(modal, callback) { /* Attach a 'callback' function to a given field in the modal form. * When the value of that field is changed, the callback function is performed. - * + * * options: * - field: The name of the field to attach to * - action: A function to perform @@ -867,7 +867,7 @@ function attachCallbacks(modal, callbacks) { function handleModalForm(url, options) { /* Update a modal form after data are received from the server. * Manages POST requests until the form is successfully submitted. - * + * * The server should respond with a JSON object containing a boolean value 'form_valid' * Form submission repeats (after user interaction) until 'form_valid' = true */ @@ -952,8 +952,8 @@ function handleModalForm(url, options) { error: function(xhr) { // There was an error submitting form data via POST - $(modal).modal('hide'); - showAlertDialog('{% trans "Error posting form data" %}', renderErrorMessage(xhr)); + $(modal).modal('hide'); + showAlertDialog('{% trans "Error posting form data" %}', renderErrorMessage(xhr)); }, complete: function() { // TODO @@ -965,15 +965,15 @@ function handleModalForm(url, options) { function launchModalForm(url, options = {}) { /* Launch a modal form, and request data from the server to fill the form - * If the form data is returned from the server, calls handleModalForm() + * If the form data is returned from the server, calls handleModalForm() * * A successful request will return a JSON object with, at minimum, * an object called 'html_form' - * + * * If the request is NOT successful, displays an appropriate error message. - * + * * options: - * + * * modal - Name of the modal (default = '#modal-form') * data - Data to pass through to the AJAX request to fill the form * submit_text - Text for the submit button (default = 'Submit') diff --git a/InvenTree/templates/js/translated/model_renderers.js b/InvenTree/templates/js/translated/model_renderers.js index 1d88fb90d7..7be7c2d656 100644 --- a/InvenTree/templates/js/translated/model_renderers.js +++ b/InvenTree/templates/js/translated/model_renderers.js @@ -21,9 +21,9 @@ /* * This file contains functions for rendering various InvenTree database models, * in particular for displaying them in modal forms in a 'select2' context. - * + * * Each renderer is provided with three arguments: - * + * * - name: The 'name' of the model instance in the referring model * - data: JSON data which represents the model instance. Returned via a GET request. * - parameters: The field parameters provided via an OPTIONS request to the endpoint. @@ -40,7 +40,7 @@ function renderId(title, pk, parameters={}) { if ('render_pk' in parameters) { render = parameters['render_pk']; } - + if (render) { return `${title}: ${pk}`; } else { @@ -52,7 +52,7 @@ function renderId(title, pk, parameters={}) { // Renderer for "Company" model // eslint-disable-next-line no-unused-vars function renderCompany(name, data, parameters={}, options={}) { - + var html = select2Thumbnail(data.image); html += `${data.name} - ${data.description}`; @@ -68,11 +68,11 @@ function renderCompany(name, data, parameters={}, options={}) { function renderStockItem(name, data, parameters={}, options={}) { var image = blankImage(); - + if (data.part_detail) { image = data.part_detail.thumbnail || data.part_detail.image || blankImage(); } - + var render_part_detail = true; if ('render_part_detail' in parameters) { @@ -151,12 +151,12 @@ function renderStockLocation(name, data, parameters={}, options={}) { // eslint-disable-next-line no-unused-vars function renderBuild(name, data, parameters={}, options={}) { - + var image = null; if (data.part_detail && data.part_detail.thumbnail) { image = data.part_detail.thumbnail; - } + } var html = select2Thumbnail(image); @@ -173,7 +173,7 @@ function renderBuild(name, data, parameters={}, options={}) { function renderPart(name, data, parameters={}, options={}) { var html = select2Thumbnail(data.image); - + html += ` ${data.full_name || data.name}`; if (data.description) { @@ -245,9 +245,9 @@ function renderPurchaseOrder(name, data, parameters={}, options={}) { var prefix = global_settings.PURCHASEORDER_REFERENCE_PREFIX; var html = `${prefix}${data.reference}`; - + var thumbnail = null; - + if (data.supplier_detail) { thumbnail = data.supplier_detail.thumbnail || data.supplier_detail.image; @@ -268,10 +268,10 @@ function renderPurchaseOrder(name, data, parameters={}, options={}) { // Renderer for "SalesOrder" model // eslint-disable-next-line no-unused-vars function renderSalesOrder(name, data, parameters={}, options={}) { - + var prefix = global_settings.SALESORDER_REFERENCE_PREFIX; var html = `${prefix}${data.reference}`; - + var thumbnail = null; if (data.customer_detail) { @@ -335,7 +335,7 @@ function renderPartParameterTemplate(name, data, parameters={}, options={}) { if (data.units) { units = ` [${data.units}]`; } - + var html = `${data.name}${units}`; return html; @@ -377,7 +377,7 @@ function renderSupplierPart(name, data, parameters={}, options={}) { var supplier_image = null; var part_image = null; - + if (data.supplier_detail) { supplier_image = data.supplier_detail.image; } @@ -387,13 +387,13 @@ function renderSupplierPart(name, data, parameters={}, options={}) { } var html = ''; - + html += select2Thumbnail(supplier_image); - + if (data.part_detail) { html += select2Thumbnail(part_image); } - + if (data.supplier_detail) { html += ` ${data.supplier_detail.name} - ${data.SKU}`; } diff --git a/InvenTree/templates/js/translated/notification.js b/InvenTree/templates/js/translated/notification.js index 74079669ab..f88c8fbcbb 100644 --- a/InvenTree/templates/js/translated/notification.js +++ b/InvenTree/templates/js/translated/notification.js @@ -74,14 +74,14 @@ function showCachedAlerts() { } -/* +/* * Display an alert message at the top of the screen. * The message will contain a "close" button, * and also dismiss automatically after a certain amount of time. - * + * * arguments: * - message: Text / HTML content to display - * + * * options: * - style: alert style e.g. 'success' / 'warning' * - timeout: Time (in milliseconds) after which the message will be dismissed @@ -119,7 +119,7 @@ function showMessage(message, options={}) { ${icon} ${message} ${details} - +
    `; @@ -152,7 +152,7 @@ var notificationUpdateTic = 0; /** * The notification checker is initiated when the document is loaded. It checks if there are unread notifications * if unread messages exist the notification indicator is updated - * + * * options: * - force: set true to force an update now (if you got in focus for example) **/ @@ -182,10 +182,10 @@ function notificationCheck(force = false) { /** * handles read / unread buttons and UI rebuilding - * + * * arguments: * - btn: element that got clicked / fired the event -> must contain pk and target as attributes - * + * * options: * - panel_caller: this button was clicked in the notification panel **/ @@ -220,7 +220,7 @@ function updateNotificationReadState(btn, panel_caller=false) { /** * Returns the html for a read / unread button - * + * * arguments: * - pk: primary key of the notification * - state: current state of the notification (read / unread) -> just pass what you were handed by the api diff --git a/InvenTree/templates/js/translated/order.js b/InvenTree/templates/js/translated/order.js index 53dead4b60..f2a3684163 100644 --- a/InvenTree/templates/js/translated/order.js +++ b/InvenTree/templates/js/translated/order.js @@ -190,7 +190,7 @@ function completePurchaseOrder(order_id, options={}) { * Launches a modal form to mark a PurchaseOrder as 'cancelled' */ function cancelPurchaseOrder(order_id, options={}) { - + constructForm( `/api/order/po/${order_id}/cancel/`, { @@ -343,7 +343,7 @@ function createSalesOrder(options={}) { title: '{% trans "Add Customer" %}', fields: function() { var fields = companyFormFields(); - + fields.is_customer.value = true; return fields; @@ -531,7 +531,7 @@ function newSupplierPartFromOrderWizard(e) { createSupplierPart({ part: part, onSuccess: function(data) { - + // TODO: 2021-08-23 - This whole form wizard needs to be refactored. // In the future, use the API forms functionality to add the new item // For now, this hack will have to do... @@ -568,9 +568,9 @@ function newSupplierPartFromOrderWizard(e) { /** * Export an order (PurchaseOrder or SalesOrder) - * + * * - Display a simple form which presents the user with export options - * + * */ function exportOrder(redirect_url, options={}) { @@ -828,7 +828,7 @@ function orderParts(parts_list, options={}) { filters: supplier_part_filters, noResults: function(query) { return '{% trans "No matching supplier parts" %}'; - } + } }, null, opts); // Configure the "purchase order" field @@ -971,26 +971,26 @@ function newPurchaseOrderFromOrderWizard(e) { var dropdown = `#id-purchase-order-${supplier}`; var option = new Option(text, pk, true, true); - + $('#modal-form').find(dropdown).append(option).trigger('change'); } } ); } - }); + }); } /** * Receive stock items against a PurchaseOrder * Uses the PurchaseOrderReceive API endpoint - * + * * arguments: * - order_id, ID / PK for the PurchaseOrder instance * - line_items: A list of PurchaseOrderLineItems objects to be allocated - * + * * options: - * - + * - */ function receivePurchaseOrderItems(order_id, line_items, options={}) { @@ -1012,7 +1012,7 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) { var thumb = thumbnailImage(line_item.part_detail.thumbnail); var quantity = (line_item.quantity || 0) - (line_item.received || 0); - + if (quantity < 0) { quantity = 0; } @@ -1022,14 +1022,14 @@ function receivePurchaseOrderItems(order_id, line_items, options={}) { - `; + `; var toggle_serials = ` `; - + // Quantity to Receive var quantity_input = constructField( `items_quantity_${pk}`, @@ -1363,7 +1363,7 @@ function editPurchaseOrderLineItem(e) { function removePurchaseOrderLineItem(e) { - /* Delete a purchase order line item in a modal form + /* Delete a purchase order line item in a modal form */ e = e || window.event; @@ -1371,7 +1371,7 @@ function removePurchaseOrderLineItem(e) { var src = e.target || e.srcElement; var url = $(src).attr('url'); - + // TODO: Migrate this to the API forms launchModalForm(url, { reload: true, @@ -1437,7 +1437,7 @@ function loadPurchaseOrderTable(table, options) { return html; } - }, + }, { field: 'supplier_detail', title: '{% trans "Supplier" %}', @@ -1491,11 +1491,11 @@ function loadPurchaseOrderTable(table, options) { switchable: true, sortable: false, formatter: function(value, row) { - + if (!row.responsible_detail) { return '-'; } - + var html = row.responsible_detail.name; if (row.responsible_detail.label == 'group') { @@ -1514,7 +1514,7 @@ function loadPurchaseOrderTable(table, options) { /** * Load a table displaying line items for a particular PurchasesOrder - * @param {String} table - HTML ID tag e.g. '#table' + * @param {String} table - HTML ID tag e.g. '#table' * @param {Object} options - options which must provide: * - order (integer PK) * - supplier (integer PK) @@ -1533,7 +1533,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) { for (var key in options.params) { filters[key] = options.params[key]; } - + var target = options.filter_target || '#filter-list-purchase-order-lines'; setupFilterList('purchaseorderlineitem', $(table), target, {download: true}); @@ -1651,7 +1651,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) { formatter: function(value, row, index, field) { if (row.part) { return imageHoverIcon(row.part_detail.thumbnail) + renderLink(row.part_detail.full_name, `/part/${row.part_detail.pk}/`); - } else { + } else { return '-'; } }, @@ -1752,7 +1752,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) { currency: currency } ); - + return formatter.format(total); } }, @@ -1789,14 +1789,14 @@ function loadPurchaseOrderLineItemTable(table, options={}) { }); }, sorter: function(valA, valB, rowA, rowB) { - + if (rowA.received == 0 && rowB.received == 0) { return (rowA.quantity > rowB.quantity) ? 1 : -1; } - + var progressA = parseFloat(rowA.received) / rowA.quantity; var progressB = parseFloat(rowB.received) / rowB.quantity; - + return (progressA < progressB) ? 1 : -1; } }, @@ -1821,9 +1821,9 @@ function loadPurchaseOrderLineItemTable(table, options={}) { title: '', formatter: function(value, row, index, field) { var html = `
    `; - + var pk = row.pk; - + if (options.allow_receive && row.received < row.quantity) { html += makeIconButton('fa-sign-in-alt icon-green', 'button-line-receive', pk, '{% trans "Receive line item" %}'); } @@ -1835,7 +1835,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) { } html += `
    `; - + return html; }, } @@ -1847,7 +1847,7 @@ function loadPurchaseOrderLineItemTable(table, options={}) { /** * Load a table displaying lines for a particular PurchaseOrder - * + * * @param {String} table : HTML ID tag e.g. '#table' * @param {Object} options : object which contains: * - order {integer} : pk of the PurchaseOrder @@ -1872,7 +1872,7 @@ function loadPurchaseOrderExtraLineTable(table, options={}) { options.params.order = options.order; options.params.part_detail = true; options.params.allocations = true; - + var filters = loadTableFilters('purchaseorderextraline'); for (var key in options.params) { @@ -1948,15 +1948,15 @@ function loadPurchaseOrderExtraLineTable(table, options={}) { }, 0); var currency = (data.slice(-1)[0] && data.slice(-1)[0].price_currency) || 'USD'; - + var formatter = new Intl.NumberFormat( 'en-US', { - style: 'currency', + style: 'currency', currency: currency } ); - + return formatter.format(total); } } @@ -2359,21 +2359,21 @@ function loadSalesOrderShipmentTable(table, options={}) { /** * Allocate stock items against a SalesOrder - * + * * arguments: * - order_id: The ID / PK value for the SalesOrder * - lines: A list of SalesOrderLineItem objects to be allocated - * + * * options: * - source_location: ID / PK of the top-level StockLocation to source stock from (or null) */ function allocateStockToSalesOrder(order_id, line_items, options={}) { - + function renderLineItemRow(line_item, quantity) { // Function to render a single line_item row var pk = line_item.pk; - + var part = line_item.part_detail; var thumb = thumbnailImage(part.thumbnail || part.image); @@ -2449,7 +2449,7 @@ function allocateStockToSalesOrder(order_id, line_items, options={}) { '{% trans "Select Parts" %}', '{% trans "You must select at least one part to allocate" %}', ); - + return; } @@ -2757,12 +2757,12 @@ function loadSalesOrderAllocationTable(table, options={}) { /** * Display an "allocations" sub table, showing stock items allocated againt a sales order - * @param {*} index - * @param {*} row - * @param {*} element + * @param {*} index + * @param {*} row + * @param {*} element */ function showAllocationSubTable(index, row, element, options) { - + // Construct a sub-table element var html = `
    @@ -2798,7 +2798,7 @@ function showAllocationSubTable(index, row, element, options) { // Add callbacks for 'delete' buttons table.find('.button-allocation-delete').click(function() { var pk = $(this).attr('pk'); - + constructForm( `/api/order/so-allocation/${pk}/`, { @@ -2894,7 +2894,7 @@ function showFulfilledSubTable(index, row, element, options) { } var id = `fulfilled-table-${row.pk}`; - + var html = `
    @@ -2976,7 +2976,7 @@ function reloadTotal() { /** * Load a table displaying line items for a particular SalesOrder - * + * * @param {String} table : HTML ID tag e.g. '#table' * @param {Object} options : object which contains: * - order {integer} : pk of the SalesOrder @@ -3001,7 +3001,7 @@ function loadSalesOrderLineItemTable(table, options={}) { options.params.order = options.order; options.params.part_detail = true; options.params.allocations = true; - + var filters = loadTableFilters('salesorderlineitem'); for (var key in options.params) { @@ -3107,15 +3107,15 @@ function loadSalesOrderLineItemTable(table, options={}) { }, 0); var currency = (data.slice(-1)[0] && data.slice(-1)[0].sale_price_currency) || 'USD'; - + var formatter = new Intl.NumberFormat( 'en-US', { - style: 'currency', + style: 'currency', currency: currency } ); - + return formatter.format(total); } }, @@ -3138,7 +3138,7 @@ function loadSalesOrderLineItemTable(table, options={}) { return `${renderDate(row.order_detail.target_date)}`; } else { return '-'; - } + } } } ]; @@ -3166,17 +3166,17 @@ function loadSalesOrderLineItemTable(table, options={}) { }); }, sorter: function(valA, valB, rowA, rowB) { - + var A = rowA.allocated; var B = rowB.allocated; - + if (A == 0 && B == 0) { return (rowA.quantity > rowB.quantity) ? 1 : -1; } - + var progressA = parseFloat(A) / rowA.quantity; var progressB = parseFloat(B) / rowB.quantity; - + return (progressA < progressB) ? 1 : -1; } }, @@ -3391,11 +3391,11 @@ function loadSalesOrderLineItemTable(table, options={}) { // Extract the row data from the table! var idx = $(this).closest('tr').attr('data-index'); - + var row = $(table).bootstrapTable('getData')[idx]; - + var quantity = 1; - + if (row.allocated < row.quantity) { quantity = row.quantity - row.allocated; } @@ -3489,7 +3489,7 @@ function loadSalesOrderLineItemTable(table, options={}) { /** * Load a table displaying lines for a particular SalesOrder - * + * * @param {String} table : HTML ID tag e.g. '#table' * @param {Object} options : object which contains: * - order {integer} : pk of the SalesOrder @@ -3514,7 +3514,7 @@ function loadSalesOrderExtraLineTable(table, options={}) { options.params.order = options.order; options.params.part_detail = true; options.params.allocations = true; - + var filters = loadTableFilters('salesorderextraline'); for (var key in options.params) { @@ -3590,15 +3590,15 @@ function loadSalesOrderExtraLineTable(table, options={}) { }, 0); var currency = (data.slice(-1)[0] && data.slice(-1)[0].price_currency) || 'USD'; - + var formatter = new Intl.NumberFormat( 'en-US', { - style: 'currency', + style: 'currency', currency: currency } ); - + return formatter.format(total); } } diff --git a/InvenTree/templates/js/translated/part.js b/InvenTree/templates/js/translated/part.js index 8d76b833a6..91a0cf80cd 100644 --- a/InvenTree/templates/js/translated/part.js +++ b/InvenTree/templates/js/translated/part.js @@ -209,7 +209,7 @@ function partFields(options={}) { help_text: '{% trans "Create initial supplier data for this part" %}', group: 'supplier', }; - + fields.supplier = { type: 'related field', model: 'company', @@ -221,14 +221,14 @@ function partFields(options={}) { api_url: '{% url "api-company-list" %}', group: 'supplier', }; - + fields.SKU = { type: 'string', - label: '{% trans "SKU" %}', + label: '{% trans "SKU" %}', help_text: '{% trans "Supplier stock keeping unit" %}', group: 'supplier', }; - + fields.manufacturer = { type: 'related field', model: 'company', @@ -240,7 +240,7 @@ function partFields(options={}) { api_url: '{% url "api-company-list" %}', group: 'supplier', }; - + fields.MPN = { type: 'string', label: '{% trans "MPN" %}', @@ -357,7 +357,7 @@ function duplicatePart(pk, options={}) { inventreeGet(`/api/part/${pk}/`, {}, { success: function(data) { - + var fields = partFields({ duplicate: pk, }); @@ -378,7 +378,7 @@ function duplicatePart(pk, options={}) { // By default, disable "is_template" when making a variant *of* a template data.is_template = false; } - + constructForm('{% url "api-part-list" %}', { method: 'POST', fields: fields, @@ -397,7 +397,7 @@ function duplicatePart(pk, options={}) { /* Toggle the 'starred' status of a part. * Performs AJAX queries and updates the display on the button. - * + * * options: * - button: ID of the button (default = '#part-star-icon') * - URL: API url of the object @@ -578,7 +578,7 @@ function makePartIcons(part) { } if (!part.active) { - html += `{% trans "Inactive" %} `; + html += `{% trans "Inactive" %} `; } return html; @@ -655,7 +655,7 @@ function loadPartVariantTable(table, partId, options={}) { } if (!row.active) { - html += `{% trans "Inactive" %}`; + html += `{% trans "Inactive" %}`; } return html; @@ -839,7 +839,7 @@ function loadPartParameterTable(table, url, options) { /* * Construct a table showing a list of purchase orders for a given part. - * + * * This requests API data from the PurchaseOrderLineItem endpoint */ function loadPartPurchaseOrderTable(table, part_id, options={}) { @@ -850,7 +850,7 @@ function loadPartPurchaseOrderTable(table, part_id, options={}) { options.params.base_part = part_id; options.params.part_detail = true; options.params.order_detail = true; - + var filters = loadTableFilters('purchaseorderlineitem'); for (var key in options.params) { @@ -1014,7 +1014,7 @@ function loadPartPurchaseOrderTable(table, part_id, options={}) { title: '', switchable: false, formatter: function(value, row) { - + if (row.received >= row.quantity) { // Already recevied return `{% trans "Received" %}`; @@ -1089,7 +1089,7 @@ function loadRelatedPartsTable(table, part_id, options={}) { title: '', switchable: false, formatter: function(value, row) { - + var html = `
    `; html += makeIconButton('fa-trash-alt icon-red', 'button-related-delete', row.pk, '{% trans "Delete part relationship" %}'); @@ -1234,7 +1234,7 @@ function partGridTile(part) { } var html = ` - +
    @@ -1258,7 +1258,7 @@ function partGridTile(part) {
    -
    + `; return html; @@ -1267,7 +1267,7 @@ function partGridTile(part) { function loadPartTable(table, url, options={}) { /* Load part listing data into specified table. - * + * * Args: * - table: HTML reference to the table * - url: Base URL for API query @@ -1340,7 +1340,7 @@ function loadPartTable(table, url, options={}) { display += makePartIcons(row); - return display; + return display; } }; @@ -1373,7 +1373,7 @@ function loadPartTable(table, url, options={}) { } else { return '{% trans "No category" %}'; } - } + } }; if (!options.params.ordering) { @@ -1386,7 +1386,7 @@ function loadPartTable(table, url, options={}) { field: 'unallocated_stock', title: '{% trans "Stock" %}', searchable: false, - formatter: function(value, row) { + formatter: function(value, row) { var link = '?display=part-stock'; if (row.in_stock) { @@ -1538,7 +1538,7 @@ function loadPartTable(table, url, options={}) { html = `
    `; data.forEach(function(row, index) { - + // Force a new row every 5 columns if ((index > 0) && (index % 5 == 0) && (index < data.length)) { html += `
    `; @@ -1552,7 +1552,7 @@ function loadPartTable(table, url, options={}) { return html; } }); - + if (options.buttons) { linkButtonsToSelection($(table), options.buttons); } @@ -1624,11 +1624,11 @@ function loadPartCategoryTable(table, options) { filters = loadTableFilters(filterKey); } - + var tree_view = options.allowTreeView && inventreeLoad('category-tree-view') == 1; if (tree_view) { - params.cascade = true; + params.cascade = true; } var original = {}; @@ -1652,7 +1652,7 @@ function loadPartCategoryTable(table, options) { queryParams: filters, disablePagination: tree_view, sidePagination: tree_view ? 'client' : 'server', - serverSort: !tree_view, + serverSort: !tree_view, search: !tree_view, name: 'category', original: original, @@ -1707,14 +1707,14 @@ function loadPartCategoryTable(table, options) { $('#view-category-list').removeClass('btn-secondary').addClass('btn-outline-secondary'); $('#view-category-tree').removeClass('btn-outline-secondary').addClass('btn-secondary'); - + table.treegrid({ treeColumn: 0, onChange: function() { table.bootstrapTable('resetView'); }, onExpand: function() { - + } }); } else { @@ -1862,7 +1862,7 @@ function loadPartTestTemplateTable(table, options) { } else { var text = '{% trans "This test is defined for a parent part" %}'; - return renderLink(text, `/part/${row.part}/tests/`); + return renderLink(text, `/part/${row.part}/tests/`); } } } @@ -1871,9 +1871,9 @@ function loadPartTestTemplateTable(table, options) { table.find('.button-test-edit').click(function() { var pk = $(this).attr('pk'); - + var url = `/api/part/test-template/${pk}/`; - + constructForm(url, { fields: { test_name: {}, @@ -1891,9 +1891,9 @@ function loadPartTestTemplateTable(table, options) { table.find('.button-test-delete').click(function() { var pk = $(this).attr('pk'); - + var url = `/api/part/test-template/${pk}/`; - + constructForm(url, { method: 'DELETE', title: '{% trans "Delete Test Result Template" %}', @@ -1975,14 +1975,14 @@ function loadPriceBreakTable(table, options) { sortable: true, formatter: function(value, row) { var html = value; - + html += `
    `; html += makeIconButton('fa-edit icon-blue', `button-${name}-edit`, row.pk, `{% trans "Edit ${human_name}" %}`); html += makeIconButton('fa-trash-alt icon-red', `button-${name}-delete`, row.pk, `{% trans "Delete ${human_name}" %}`); - + html += `
    `; - + return html; } }, diff --git a/InvenTree/templates/js/translated/report.js b/InvenTree/templates/js/translated/report.js index 49afbcb7ea..eac707f804 100644 --- a/InvenTree/templates/js/translated/report.js +++ b/InvenTree/templates/js/translated/report.js @@ -25,7 +25,7 @@ function selectReport(reports, items, options={}) { /** * Present the user with the available reports, * and allow them to select which report to print. - * + * * The intent is that the available report templates have been requested * (via AJAX) from the server. */ diff --git a/InvenTree/templates/js/translated/search.js b/InvenTree/templates/js/translated/search.js index 9758ee2ff9..9cc0fd83bf 100644 --- a/InvenTree/templates/js/translated/search.js +++ b/InvenTree/templates/js/translated/search.js @@ -34,11 +34,11 @@ function openSearchPanel() { // Prevent this button from actually submitting the form event.preventDefault(); - + panel.find('#search-input').val(''); clearSearchResults(); }); - + // Callback for the "close search" button panel.find('#search-close').click(function(event) { // Prevent this button from actually submitting the form @@ -67,11 +67,11 @@ function updateSearch() { } clearSearchResults(); - + if (searchText.length == 0) { return; } - + searchTextCurrent = searchText; // Cancel any previous AJAX requests @@ -83,7 +83,7 @@ function updateSearch() { // Show the "searching" text $('#offcanvas-search').find('#search-pending').show(); - + if (user_settings.SEARCH_PREVIEW_SHOW_PARTS) { var params = {}; @@ -122,7 +122,7 @@ function updateSearch() { if (user_settings.SEARCH_PREVIEW_SHOW_STOCK) { // Search for matching stock items - + var filters = { part_detail: true, location_detail: true, @@ -220,7 +220,7 @@ function updateSearch() { } ); } - + // Wait until all the pending queries are completed $.when.apply($, searchQueries).done(function() { $('#offcanvas-search').find('#search-pending').hide(); @@ -231,13 +231,13 @@ function updateSearch() { function clearSearchResults() { var panel = $('#offcanvas-search'); - + // Ensure the 'no results found' element is visible panel.find('#search-no-results').show(); // Ensure that the 'searching' element is hidden panel.find('#search-pending').hide(); - + // Delete any existing search results panel.find('#search-results').empty(); @@ -287,7 +287,7 @@ function addSearchQuery(key, title, query_url, query_params, render_func, render // Add a group of results to the list function addSearchResults(key, results, title, renderFunc, renderParams={}) { - + if (results.length == 0) { // Do not display this group, as there are no results return; @@ -297,7 +297,7 @@ function addSearchResults(key, results, title, renderFunc, renderParams={}) { // Ensure the 'no results found' element is hidden panel.find('#search-no-results').hide(); - + panel.find(`#search-results-wrapper-${key}`).append(`
    diff --git a/InvenTree/templates/js/translated/stock.js b/InvenTree/templates/js/translated/stock.js index 94f4d73ae1..ffac1d58c2 100644 --- a/InvenTree/templates/js/translated/stock.js +++ b/InvenTree/templates/js/translated/stock.js @@ -202,7 +202,7 @@ function stockItemFields(options={}) { } else { clearFormInput('supplier_part', opts); clearFormInput('purchase_price', opts); - + disableFormInput('supplier_part', opts); disableFormInput('purchase_price', opts); disableFormInput('purchase_price_currency', opts); @@ -315,11 +315,11 @@ function duplicateStockItem(pk, options) { delete data['serial']; options.data = data; - + options.create = true; options.fields = stockItemFields(options); options.groups = stockItemGroups(options); - + options.method = 'POST'; options.title = '{% trans "Duplicate Stock Item" %}'; @@ -342,7 +342,7 @@ function editStockItem(pk, options={}) { options.groups = stockItemGroups(options); options.title = '{% trans "Edit Stock Item" %}'; - + // Query parameters for retrieving stock item data options.params = { part_detail: true, @@ -443,7 +443,7 @@ function findStockItemBySerialNumber(part_id) { onSubmit: function(fields, opts) { var serial = getFormFieldValue('serial', fields['serial'], opts); - + serial = serial.toString().trim(); if (!serial) { @@ -540,7 +540,7 @@ function assignStockToCustomer(items, options={}) { for (var idx = 0; idx < items.length; idx++) { var item = items[idx]; - + var pk = item.pk; var part = item.part_detail; @@ -1069,7 +1069,7 @@ function adjustStock(action, items, options={}) { } }, onSubmit: function(fields, opts) { - + // Extract data elements from the form var data = { items: [], @@ -1094,7 +1094,7 @@ function adjustStock(action, items, options={}) { if (row.exists()) { item_pk_values.push(pk); - + var quantity = getFormFieldValue(`items_quantity_${pk}`, {}, opts); data.items.push({ @@ -1514,9 +1514,9 @@ function loadStockTestResultsTable(table, options) { function locationDetail(row, showLink=true) { - /* + /* * Function to display a "location" of a StockItem. - * + * * Complicating factors: A StockItem may not actually *be* in a location! * - Could be at a customer * - Could be installed in another stock item @@ -1568,7 +1568,7 @@ function loadStockTable(table, options) { /* Load data into a stock table with adjustable options. * Fetches data (via AJAX) and loads into a bootstrap table. * Also links in default button callbacks. - * + * * Options: * url - URL for the stock query * params - query params for augmenting stock data request @@ -1657,7 +1657,7 @@ function loadStockTable(table, options) { return html; } }; - + if (!options.params.ordering) { col['sortable'] = true; } @@ -1711,7 +1711,7 @@ function loadStockTable(table, options) { if (row.is_building) { html += makeIconBadge('fa-tools', '{% trans "Stock item is in production" %}'); - } + } if (row.sales_order) { // Stock item has been assigned to a sales order @@ -1760,7 +1760,7 @@ function loadStockTable(table, options) { return html; } }; - + columns.push(col); col = { @@ -1870,7 +1870,7 @@ function loadStockTable(table, options) { }); col = { - + field: 'supplier_part', title: '{% trans "Supplier Part" %}', visible: params['supplier_part_detail'] || false, @@ -1987,7 +1987,7 @@ function loadStockTable(table, options) { }); if (global_settings.BARCODE_ENABLE) { - $('#multi-item-barcode-scan-into-location').click(function() { + $('#multi-item-barcode-scan-into-location').click(function() { var selections = $(table).bootstrapTable('getSelections'); var items = []; @@ -2158,7 +2158,7 @@ function loadStockTable(table, options) { } -/* +/* * Display a table of stock locations */ function loadStockLocationTable(table, options) { @@ -2220,14 +2220,14 @@ function loadStockLocationTable(table, options) { $('#view-location-list').removeClass('btn-secondary').addClass('btn-outline-secondary'); $('#view-location-tree').removeClass('btn-outline-secondary').addClass('btn-secondary'); - + table.treegrid({ treeColumn: 1, onChange: function() { table.bootstrapTable('resetView'); }, onExpand: function() { - + } }); } else { @@ -2664,7 +2664,7 @@ function uninstallStockItem(installed_item_id, options={}) { }, preFormContent: function(opts) { var html = ''; - + if (installed_item_id == null) { html += `
    diff --git a/InvenTree/templates/js/translated/tables.js b/InvenTree/templates/js/translated/tables.js index 96c561b49b..a20978dd7d 100644 --- a/InvenTree/templates/js/translated/tables.js +++ b/InvenTree/templates/js/translated/tables.js @@ -15,7 +15,7 @@ /** * Reload a named table - * @param table + * @param table */ function reloadtable(table) { $(table).bootstrapTable('refresh'); @@ -25,7 +25,7 @@ function reloadtable(table) { /** * Download data from a table, via the API. * This requires a number of conditions to be met: - * + * * - The API endpoint supports data download (on the server side) * - The table is "flat" (does not support multi-level loading, etc) * - The table has been loaded using the inventreeTable() function, not bootstrapTable() @@ -60,16 +60,16 @@ function downloadTableData(table, opts={}) { }, onSubmit: function(fields, form_options) { var format = getFormFieldValue('format', fields['format'], form_options); - + // Hide the modal $(form_options.modal).modal('hide'); for (const [key, value] of Object.entries(query_params)) { url += `${key}=${value}&`; } - + url += `export=${format}`; - + location.href = url; } }); @@ -80,9 +80,9 @@ function downloadTableData(table, opts={}) { /** * Render a URL for display - * @param {String} text - * @param {String} url - * @param {object} options + * @param {String} text + * @param {String} url + * @param {object} options * @returns link text */ function renderLink(text, url, options={}) { @@ -134,8 +134,8 @@ function linkButtonsToSelection(table, buttons) { /** * Returns true if the input looks like a valid number - * @param {String} n - * @returns + * @param {String} n + * @returns */ function isNumeric(n) { return !isNaN(parseFloat(n)) && isFinite(n); @@ -251,7 +251,7 @@ function convertQueryParameters(params, filters) { delete params['original_search']; } - + return params; } diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 4660123e0d..620aaf3eff 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -95,9 +95,9 @@ {% include "spacer.html" %} {% include "spacer.html" %} {% endif %} - +
    - + {% block page_info %}
    {% block details_above %} @@ -57,7 +57,7 @@
    {% endblock %} - + {% block page_content %} diff --git a/InvenTree/templates/search.html b/InvenTree/templates/search.html index b43175b4b0..3a855b4c2e 100644 --- a/InvenTree/templates/search.html +++ b/InvenTree/templates/search.html @@ -40,4 +40,3 @@ - \ No newline at end of file diff --git a/InvenTree/templates/socialaccount/snippets/provider_list.html b/InvenTree/templates/socialaccount/snippets/provider_list.html index 268134b35f..d651bed0a6 100644 --- a/InvenTree/templates/socialaccount/snippets/provider_list.html +++ b/InvenTree/templates/socialaccount/snippets/provider_list.html @@ -5,13 +5,13 @@ {% for provider in socialaccount_providers %} {% if provider.id == "openid" %} {% for brand in provider.get_brands %} - {{brand.name}} {% endfor %} {% endif %} - {{provider.name}} {% endfor %} diff --git a/InvenTree/templates/status_codes.html b/InvenTree/templates/status_codes.html index 3b834a6e01..e48424477f 100644 --- a/InvenTree/templates/status_codes.html +++ b/InvenTree/templates/status_codes.html @@ -10,7 +10,7 @@ const {{ label }}Codes = { {% endfor %} }; -/* +/* * Render the status for a {{ label }} object. * Uses the values specified in "status_codes.py" * This function is generated by the "status_codes.html" template diff --git a/README.md b/README.md index 9ea268afb2..a8cbe0cb27 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ InvenTree is an open-source Inventory Management System which provides powerful low-level stock control and part tracking. The core of the InvenTree system is a Python/Django database backend which provides an admin interface (web-based) and a REST API for interaction with external interfaces and applications. -InvenTree is designed to be lightweight and easy to use for SME or hobbyist applications, where many existing stock management solutions are bloated and cumbersome to use. Updating stock is a single-action process and does not require a complex system of work orders or stock transactions. +InvenTree is designed to be lightweight and easy to use for SME or hobbyist applications, where many existing stock management solutions are bloated and cumbersome to use. Updating stock is a single-action process and does not require a complex system of work orders or stock transactions. Powerful business logic works in the background to ensure that stock tracking history is maintained, and users have ready access to stock level information. @@ -115,7 +115,7 @@ Refer to the [getting started guide](https://inventree.readthedocs.io/en/latest/ ## :iphone: Mobile App -InvenTree is supported by a [companion mobile app](https://inventree.readthedocs.io/en/latest/app/app/) which allows users access to stock control information and functionality. +InvenTree is supported by a [companion mobile app](https://inventree.readthedocs.io/en/latest/app/app/) which allows users access to stock control information and functionality.

    Android Play Store @@ -139,7 +139,7 @@ There are several options to deploy InvenTree. ## :wave: Contributing -Contributions are welcomed and encouraged. Please help to make this project even better! +Contributions are welcomed and encouraged. Please help to make this project even better! Refer to the [contribution page in the docs ](https://inventree.readthedocs.io/en/latest/contribute/) and check out [contributing.md](CONTRIBUTING.md). @@ -152,7 +152,7 @@ To contribute to the translation effort, navigate to the [InvenTree crowdin proj ## :money_with_wings: Sponsor -If you use InvenTree and find it to be useful, please consider making a donation toward its continued development. +If you use InvenTree and find it to be useful, please consider making a donation toward its continued development. [Donate via PayPal](https://paypal.me/inventree?locale.x=en_AU) diff --git a/docker/nginx.dev.conf b/docker/nginx.dev.conf index f3085ef57b..f76d239135 100644 --- a/docker/nginx.dev.conf +++ b/docker/nginx.dev.conf @@ -14,7 +14,7 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header CLIENT_IP $remote_addr; - + proxy_pass_request_headers on; proxy_redirect off; diff --git a/docker/production/docker-compose.yml b/docker/production/docker-compose.yml index 32fd3e0f48..f7549e702b 100644 --- a/docker/production/docker-compose.yml +++ b/docker/production/docker-compose.yml @@ -27,7 +27,7 @@ version: "3.8" # ------------------------ # By default, this docker-compose script targets the STABLE version of InvenTree, # image: inventree/inventree:stable -# +# # To run the LATEST (development) version of InvenTree, change the target image to: # image: inventree/inventree:latest # diff --git a/docker/production/nginx.prod.conf b/docker/production/nginx.prod.conf index a412d4094a..741cc7541a 100644 --- a/docker/production/nginx.prod.conf +++ b/docker/production/nginx.prod.conf @@ -14,7 +14,7 @@ server { proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header CLIENT_IP $remote_addr; - + proxy_pass_request_headers on; proxy_redirect off; diff --git a/setup.cfg b/setup.cfg index 7fcf9718fe..f1b744aa0f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,7 +3,7 @@ ignore = # - W605 - invalid escape sequence W605, # - E501 - line too long (82 characters) - E501, + E501, # - E722 - do not use bare except E722, # - C901 - function is too complex From 74726f0fda7f8284fdedf972d5095acfccf53f48 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 13:35:07 +0200 Subject: [PATCH 2/6] fix endline --- .gitattributes | 2 +- InvenTree/build/templates/build/delete_build.html | 2 +- InvenTree/common/fixtures/settings.yaml | 2 +- InvenTree/company/fixtures/price_breaks.yaml | 2 +- .../company/templates/company/manufacturer_part_sidebar.html | 2 +- InvenTree/company/templates/company/supplier_part_navbar.html | 2 +- InvenTree/label/templates/label/part/part_label.html | 2 +- InvenTree/label/templates/label/part/part_label_code128.html | 2 +- InvenTree/locale/cs/LC_MESSAGES/django.po | 1 - InvenTree/locale/de/LC_MESSAGES/django.po | 1 - InvenTree/locale/el/LC_MESSAGES/django.po | 1 - InvenTree/locale/es/LC_MESSAGES/django.po | 1 - InvenTree/locale/fa/LC_MESSAGES/django.po | 1 - InvenTree/locale/fr/LC_MESSAGES/django.po | 1 - InvenTree/locale/he/LC_MESSAGES/django.po | 1 - InvenTree/locale/hu/LC_MESSAGES/django.po | 1 - InvenTree/locale/id/LC_MESSAGES/django.po | 1 - InvenTree/locale/it/LC_MESSAGES/django.po | 1 - InvenTree/locale/ja/LC_MESSAGES/django.po | 1 - InvenTree/locale/ko/LC_MESSAGES/django.po | 1 - InvenTree/locale/nl/LC_MESSAGES/django.po | 1 - InvenTree/locale/no/LC_MESSAGES/django.po | 1 - InvenTree/locale/pl/LC_MESSAGES/django.po | 1 - InvenTree/locale/pt/LC_MESSAGES/django.po | 1 - InvenTree/locale/ru/LC_MESSAGES/django.po | 1 - InvenTree/locale/sv/LC_MESSAGES/django.po | 1 - InvenTree/locale/th/LC_MESSAGES/django.po | 1 - InvenTree/locale/tr/LC_MESSAGES/django.po | 1 - InvenTree/locale/vi/LC_MESSAGES/django.po | 1 - InvenTree/locale/zh/LC_MESSAGES/django.po | 1 - InvenTree/order/templates/order/order_base.html | 2 +- InvenTree/order/templates/order/order_wizard/match_fields.html | 2 +- InvenTree/order/templates/order/order_wizard/match_parts.html | 2 +- InvenTree/order/templates/order/order_wizard/po_upload.html | 2 +- InvenTree/order/templates/order/po_sidebar.html | 2 +- InvenTree/order/templates/order/sales_order_base.html | 2 +- InvenTree/part/fixtures/test_templates.yaml | 2 +- InvenTree/part/templates/part/cat_link.html | 2 +- InvenTree/part/templates/part/category_delete.html | 2 +- InvenTree/part/templates/part/category_sidebar.html | 2 +- InvenTree/part/templates/part/copy_part.html | 2 +- InvenTree/part/templates/part/create_part.html | 2 +- .../part/templates/part/import_wizard/ajax_match_fields.html | 2 +- .../templates/part/import_wizard/ajax_match_references.html | 2 +- .../part/templates/part/import_wizard/ajax_part_upload.html | 2 +- InvenTree/part/templates/part/import_wizard/match_fields.html | 2 +- .../part/templates/part/import_wizard/match_references.html | 2 +- InvenTree/part/templates/part/import_wizard/part_upload.html | 2 +- InvenTree/part/templates/part/part_sidebar.html | 2 +- InvenTree/part/templates/part/part_thumb.html | 2 +- InvenTree/part/templates/part/partial_delete.html | 2 +- InvenTree/part/templates/part/select_image.html | 2 +- InvenTree/part/templates/part/set_category.html | 2 +- InvenTree/part/templates/part/stock_count.html | 2 +- InvenTree/part/templates/part/upload_bom.html | 2 +- InvenTree/part/templates/part/variant_part.html | 2 +- .../report/templates/report/inventree_build_order_base.html | 2 +- InvenTree/report/templates/report/inventree_po_report.html | 2 +- InvenTree/report/templates/report/inventree_report_base.html | 2 +- InvenTree/report/templates/report/inventree_so_report.html | 2 +- .../report/templates/report/inventree_test_report_base.html | 2 +- InvenTree/stock/fixtures/location.yaml | 2 +- InvenTree/stock/fixtures/stock_tests.yaml | 2 +- InvenTree/stock/templates/stock/item_delete.html | 2 +- InvenTree/stock/templates/stock/item_serialize.html | 2 +- InvenTree/stock/templates/stock/stockitem_convert.html | 2 +- InvenTree/stock/templates/stock/tracking_delete.html | 2 +- InvenTree/templates/403.html | 2 +- InvenTree/templates/404.html | 2 +- InvenTree/templates/500.html | 2 +- InvenTree/templates/InvenTree/notifications/history.html | 2 +- InvenTree/templates/InvenTree/notifications/inbox.html | 2 +- InvenTree/templates/InvenTree/password.html | 2 +- InvenTree/templates/InvenTree/settings/barcode.html | 2 +- InvenTree/templates/InvenTree/settings/build.html | 2 +- InvenTree/templates/InvenTree/settings/currencies.html | 2 +- InvenTree/templates/InvenTree/settings/mixins/settings.html | 2 +- InvenTree/templates/InvenTree/settings/po.html | 2 +- InvenTree/templates/InvenTree/settings/report.html | 2 +- InvenTree/templates/InvenTree/settings/sidebar.html | 2 +- InvenTree/templates/InvenTree/settings/so.html | 2 +- InvenTree/templates/InvenTree/settings/user.html | 2 +- InvenTree/templates/InvenTree/settings/user_homepage.html | 2 +- InvenTree/templates/InvenTree/settings/user_labels.html | 2 +- InvenTree/templates/InvenTree/settings/user_notifications.html | 2 +- InvenTree/templates/InvenTree/settings/user_reports.html | 2 +- InvenTree/templates/admin_button.html | 2 +- InvenTree/templates/attachment_button.html | 2 +- InvenTree/templates/attachment_table.html | 2 +- InvenTree/templates/clip.html | 2 +- InvenTree/templates/filter_list.html | 2 +- InvenTree/templates/hover_image.html | 2 +- InvenTree/templates/image_download.html | 2 +- InvenTree/templates/js/translated/plugin.js | 2 -- InvenTree/templates/mail.html | 2 +- InvenTree/templates/modal_csrf.html | 2 +- InvenTree/templates/modals.html | 2 +- InvenTree/templates/notes_buttons.html | 2 +- InvenTree/templates/notifications.html | 1 - InvenTree/templates/panel.html | 2 +- InvenTree/templates/patterns/wizard/upload.html | 2 +- InvenTree/templates/plugin/panel_content.html | 2 +- InvenTree/templates/plugin/panel_js.html | 2 +- InvenTree/templates/plugin/panel_menu.html | 2 +- InvenTree/templates/price.html | 2 +- InvenTree/templates/qr_button.html | 2 +- InvenTree/templates/qr_code.html | 2 +- InvenTree/templates/sample/sample.html | 2 +- InvenTree/templates/sidebar_header.html | 2 +- InvenTree/templates/skeleton.html | 2 +- InvenTree/templates/spacer.html | 2 +- InvenTree/templates/stats.html | 2 +- InvenTree/templates/tel.html | 2 +- InvenTree/templates/url.html | 2 +- InvenTree/templates/version.html | 2 +- InvenTree/templates/yesnolabel.html | 2 +- deploy/supervisord.conf | 2 +- 117 files changed, 93 insertions(+), 118 deletions(-) diff --git a/.gitattributes b/.gitattributes index bfbc22d191..b851783825 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,4 +8,4 @@ *.yaml text *.conf text *.sh text eol=lf -*.js text \ No newline at end of file +*.js text diff --git a/InvenTree/build/templates/build/delete_build.html b/InvenTree/build/templates/build/delete_build.html index 65e53b2f80..62dab01da0 100644 --- a/InvenTree/build/templates/build/delete_build.html +++ b/InvenTree/build/templates/build/delete_build.html @@ -4,4 +4,4 @@ {% trans "Are you sure you want to delete this build?" %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/common/fixtures/settings.yaml b/InvenTree/common/fixtures/settings.yaml index 70ce23f312..67856b7839 100644 --- a/InvenTree/common/fixtures/settings.yaml +++ b/InvenTree/common/fixtures/settings.yaml @@ -10,4 +10,4 @@ pk: 2 fields: key: INVENTREE_COMPANY_NAME - value: "ACME Pty Ltd" \ No newline at end of file + value: "ACME Pty Ltd" diff --git a/InvenTree/company/fixtures/price_breaks.yaml b/InvenTree/company/fixtures/price_breaks.yaml index dbcbacb017..96e1d2c78d 100644 --- a/InvenTree/company/fixtures/price_breaks.yaml +++ b/InvenTree/company/fixtures/price_breaks.yaml @@ -51,4 +51,4 @@ fields: part: 4 quantity: 100 - price: 1.25 \ No newline at end of file + price: 1.25 diff --git a/InvenTree/company/templates/company/manufacturer_part_sidebar.html b/InvenTree/company/templates/company/manufacturer_part_sidebar.html index 04f3a39a5b..81bbb3fd79 100644 --- a/InvenTree/company/templates/company/manufacturer_part_sidebar.html +++ b/InvenTree/company/templates/company/manufacturer_part_sidebar.html @@ -7,4 +7,4 @@ {% trans "Attachments" as text %} {% include "sidebar_item.html" with label='attachments' text=text icon="fa-paperclip" %} {% trans "Supplier Parts" as text %} -{% include "sidebar_item.html" with label='supplier-parts' text=text icon="fa-building" %} \ No newline at end of file +{% include "sidebar_item.html" with label='supplier-parts' text=text icon="fa-building" %} diff --git a/InvenTree/company/templates/company/supplier_part_navbar.html b/InvenTree/company/templates/company/supplier_part_navbar.html index 4f7783701a..d83338f1e0 100644 --- a/InvenTree/company/templates/company/supplier_part_navbar.html +++ b/InvenTree/company/templates/company/supplier_part_navbar.html @@ -30,4 +30,4 @@ - \ No newline at end of file + diff --git a/InvenTree/label/templates/label/part/part_label.html b/InvenTree/label/templates/label/part/part_label.html index 558e1bca5b..5cc6be00c2 100644 --- a/InvenTree/label/templates/label/part/part_label.html +++ b/InvenTree/label/templates/label/part/part_label.html @@ -30,4 +30,4 @@ {{ part.full_name }}

    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/label/templates/label/part/part_label_code128.html b/InvenTree/label/templates/label/part/part_label_code128.html index 7f8ef144ec..9fbcf97c3b 100644 --- a/InvenTree/label/templates/label/part/part_label_code128.html +++ b/InvenTree/label/templates/label/part/part_label_code128.html @@ -30,4 +30,4 @@ {{ part.full_name }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/locale/cs/LC_MESSAGES/django.po b/InvenTree/locale/cs/LC_MESSAGES/django.po index 8d0065b247..c3893dae51 100644 --- a/InvenTree/locale/cs/LC_MESSAGES/django.po +++ b/InvenTree/locale/cs/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/de/LC_MESSAGES/django.po b/InvenTree/locale/de/LC_MESSAGES/django.po index f8e9153f07..0bd1d84ce6 100644 --- a/InvenTree/locale/de/LC_MESSAGES/django.po +++ b/InvenTree/locale/de/LC_MESSAGES/django.po @@ -10220,4 +10220,3 @@ msgstr "Berechtigungen Einträge zu ändern" #: users/models.py:221 msgid "Permission to delete items" msgstr "Berechtigung Einträge zu löschen" - diff --git a/InvenTree/locale/el/LC_MESSAGES/django.po b/InvenTree/locale/el/LC_MESSAGES/django.po index 93f2d36d26..9e43bf0d76 100644 --- a/InvenTree/locale/el/LC_MESSAGES/django.po +++ b/InvenTree/locale/el/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/es/LC_MESSAGES/django.po b/InvenTree/locale/es/LC_MESSAGES/django.po index 3dd32efb54..94cb5653f5 100644 --- a/InvenTree/locale/es/LC_MESSAGES/django.po +++ b/InvenTree/locale/es/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/fa/LC_MESSAGES/django.po b/InvenTree/locale/fa/LC_MESSAGES/django.po index 39a5273962..d011c87e43 100644 --- a/InvenTree/locale/fa/LC_MESSAGES/django.po +++ b/InvenTree/locale/fa/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/fr/LC_MESSAGES/django.po b/InvenTree/locale/fr/LC_MESSAGES/django.po index 9dce24cea8..d93f675e78 100644 --- a/InvenTree/locale/fr/LC_MESSAGES/django.po +++ b/InvenTree/locale/fr/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "Droit de modifier des élément" #: users/models.py:221 msgid "Permission to delete items" msgstr "Droit de supprimer des éléments" - diff --git a/InvenTree/locale/he/LC_MESSAGES/django.po b/InvenTree/locale/he/LC_MESSAGES/django.po index 4d97bfc7a1..2610ddbf4b 100644 --- a/InvenTree/locale/he/LC_MESSAGES/django.po +++ b/InvenTree/locale/he/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/hu/LC_MESSAGES/django.po b/InvenTree/locale/hu/LC_MESSAGES/django.po index 9d124ad74b..0b10351edc 100644 --- a/InvenTree/locale/hu/LC_MESSAGES/django.po +++ b/InvenTree/locale/hu/LC_MESSAGES/django.po @@ -10219,4 +10219,3 @@ msgstr "Jogosultság tételek szerkesztéséhez" #: users/models.py:221 msgid "Permission to delete items" msgstr "Jogosultság tételek törléséhez" - diff --git a/InvenTree/locale/id/LC_MESSAGES/django.po b/InvenTree/locale/id/LC_MESSAGES/django.po index 2845f46f7f..2ab2f173e9 100644 --- a/InvenTree/locale/id/LC_MESSAGES/django.po +++ b/InvenTree/locale/id/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/it/LC_MESSAGES/django.po b/InvenTree/locale/it/LC_MESSAGES/django.po index 2f77a52cf3..ba9211d2aa 100644 --- a/InvenTree/locale/it/LC_MESSAGES/django.po +++ b/InvenTree/locale/it/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "Permessi per modificare gli elementi" #: users/models.py:221 msgid "Permission to delete items" msgstr "Autorizzazione ad eliminare gli elementi" - diff --git a/InvenTree/locale/ja/LC_MESSAGES/django.po b/InvenTree/locale/ja/LC_MESSAGES/django.po index befbb77039..45a87b6218 100644 --- a/InvenTree/locale/ja/LC_MESSAGES/django.po +++ b/InvenTree/locale/ja/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/ko/LC_MESSAGES/django.po b/InvenTree/locale/ko/LC_MESSAGES/django.po index 5397134094..8bc29c69f3 100644 --- a/InvenTree/locale/ko/LC_MESSAGES/django.po +++ b/InvenTree/locale/ko/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/nl/LC_MESSAGES/django.po b/InvenTree/locale/nl/LC_MESSAGES/django.po index a9c307ca93..2610da6e9b 100644 --- a/InvenTree/locale/nl/LC_MESSAGES/django.po +++ b/InvenTree/locale/nl/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/no/LC_MESSAGES/django.po b/InvenTree/locale/no/LC_MESSAGES/django.po index cdfab580d3..b2774de6b3 100644 --- a/InvenTree/locale/no/LC_MESSAGES/django.po +++ b/InvenTree/locale/no/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/pl/LC_MESSAGES/django.po b/InvenTree/locale/pl/LC_MESSAGES/django.po index f623005933..8443733cc4 100644 --- a/InvenTree/locale/pl/LC_MESSAGES/django.po +++ b/InvenTree/locale/pl/LC_MESSAGES/django.po @@ -10223,4 +10223,3 @@ msgstr "Uprawnienie do edycji przedmiotów" #: users/models.py:221 msgid "Permission to delete items" msgstr "Uprawnienie do usuwania przedmiotów" - diff --git a/InvenTree/locale/pt/LC_MESSAGES/django.po b/InvenTree/locale/pt/LC_MESSAGES/django.po index 903204f324..22e23f8abb 100644 --- a/InvenTree/locale/pt/LC_MESSAGES/django.po +++ b/InvenTree/locale/pt/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/ru/LC_MESSAGES/django.po b/InvenTree/locale/ru/LC_MESSAGES/django.po index addb972962..01ac0a2ffc 100644 --- a/InvenTree/locale/ru/LC_MESSAGES/django.po +++ b/InvenTree/locale/ru/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "Разрешение на редактирование элементо #: users/models.py:221 msgid "Permission to delete items" msgstr "Разрешение на удаление элементов" - diff --git a/InvenTree/locale/sv/LC_MESSAGES/django.po b/InvenTree/locale/sv/LC_MESSAGES/django.po index f547ff2053..023fe7c113 100644 --- a/InvenTree/locale/sv/LC_MESSAGES/django.po +++ b/InvenTree/locale/sv/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/th/LC_MESSAGES/django.po b/InvenTree/locale/th/LC_MESSAGES/django.po index 9c7360863b..baa73cf933 100644 --- a/InvenTree/locale/th/LC_MESSAGES/django.po +++ b/InvenTree/locale/th/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/tr/LC_MESSAGES/django.po b/InvenTree/locale/tr/LC_MESSAGES/django.po index 81a35d3896..26e58b16ec 100644 --- a/InvenTree/locale/tr/LC_MESSAGES/django.po +++ b/InvenTree/locale/tr/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "Parçaları düzenleme izni" #: users/models.py:221 msgid "Permission to delete items" msgstr "Parçaları silme izni" - diff --git a/InvenTree/locale/vi/LC_MESSAGES/django.po b/InvenTree/locale/vi/LC_MESSAGES/django.po index b2fe81b867..d25b31e78c 100644 --- a/InvenTree/locale/vi/LC_MESSAGES/django.po +++ b/InvenTree/locale/vi/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "" #: users/models.py:221 msgid "Permission to delete items" msgstr "" - diff --git a/InvenTree/locale/zh/LC_MESSAGES/django.po b/InvenTree/locale/zh/LC_MESSAGES/django.po index 294abc6964..4b619e916a 100644 --- a/InvenTree/locale/zh/LC_MESSAGES/django.po +++ b/InvenTree/locale/zh/LC_MESSAGES/django.po @@ -10218,4 +10218,3 @@ msgstr "编辑项目权限" #: users/models.py:221 msgid "Permission to delete items" msgstr "删除项目权限" - diff --git a/InvenTree/order/templates/order/order_base.html b/InvenTree/order/templates/order/order_base.html index 3657e20e62..1e0de4d193 100644 --- a/InvenTree/order/templates/order/order_base.html +++ b/InvenTree/order/templates/order/order_base.html @@ -290,4 +290,4 @@ $("#export-order").click(function() { }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/order/templates/order/order_wizard/match_fields.html b/InvenTree/order/templates/order/order_wizard/match_fields.html index d4c91efeb3..47972361b7 100644 --- a/InvenTree/order/templates/order/order_wizard/match_fields.html +++ b/InvenTree/order/templates/order/order_wizard/match_fields.html @@ -1,2 +1,2 @@ {% extends "order/order_wizard/po_upload.html" %} -{% include "patterns/wizard/match_fields.html" %} \ No newline at end of file +{% include "patterns/wizard/match_fields.html" %} diff --git a/InvenTree/order/templates/order/order_wizard/match_parts.html b/InvenTree/order/templates/order/order_wizard/match_parts.html index a8701c066c..4f22ac124d 100644 --- a/InvenTree/order/templates/order/order_wizard/match_parts.html +++ b/InvenTree/order/templates/order/order_wizard/match_parts.html @@ -123,4 +123,4 @@ $('.currencyselect').select2({ dropdownAutoWidth: true, }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/order/templates/order/order_wizard/po_upload.html b/InvenTree/order/templates/order/order_wizard/po_upload.html index d33d27f6c6..fa7c985bb5 100644 --- a/InvenTree/order/templates/order/order_wizard/po_upload.html +++ b/InvenTree/order/templates/order/order_wizard/po_upload.html @@ -24,4 +24,4 @@ {% block js_ready %} {{ block.super }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/order/templates/order/po_sidebar.html b/InvenTree/order/templates/order/po_sidebar.html index 298c945d41..79e7edd4b1 100644 --- a/InvenTree/order/templates/order/po_sidebar.html +++ b/InvenTree/order/templates/order/po_sidebar.html @@ -9,4 +9,4 @@ {% trans "Attachments" as text %} {% include "sidebar_item.html" with label='order-attachments' text=text icon="fa-paperclip" %} {% trans "Notes" as text %} -{% include "sidebar_item.html" with label='order-notes' text=text icon="fa-clipboard" %} \ No newline at end of file +{% include "sidebar_item.html" with label='order-notes' text=text icon="fa-clipboard" %} diff --git a/InvenTree/order/templates/order/sales_order_base.html b/InvenTree/order/templates/order/sales_order_base.html index 5593918a38..aa51c04f39 100644 --- a/InvenTree/order/templates/order/sales_order_base.html +++ b/InvenTree/order/templates/order/sales_order_base.html @@ -252,4 +252,4 @@ $('#export-order').click(function() { exportOrder('{% url "so-export" order.id %}'); }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/fixtures/test_templates.yaml b/InvenTree/part/fixtures/test_templates.yaml index 2e06fe9205..aaf11b7974 100644 --- a/InvenTree/part/fixtures/test_templates.yaml +++ b/InvenTree/part/fixtures/test_templates.yaml @@ -43,4 +43,4 @@ fields: part: 10004 test_name: Check that chair is especially green - required: False \ No newline at end of file + required: False diff --git a/InvenTree/part/templates/part/cat_link.html b/InvenTree/part/templates/part/cat_link.html index c8b73a7dc0..d172edfd5f 100644 --- a/InvenTree/part/templates/part/cat_link.html +++ b/InvenTree/part/templates/part/cat_link.html @@ -9,4 +9,4 @@ {% endif %} {% if part %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/part/templates/part/category_delete.html b/InvenTree/part/templates/part/category_delete.html index d93519058e..a4bc847d20 100644 --- a/InvenTree/part/templates/part/category_delete.html +++ b/InvenTree/part/templates/part/category_delete.html @@ -29,4 +29,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/category_sidebar.html b/InvenTree/part/templates/part/category_sidebar.html index 5468d953ae..34c2c7bea9 100644 --- a/InvenTree/part/templates/part/category_sidebar.html +++ b/InvenTree/part/templates/part/category_sidebar.html @@ -18,4 +18,4 @@ {% include "sidebar_item.html" with label='stock' text=text icon='fa-boxes' %} {% trans "Parameters" as text %} {% include "sidebar_item.html" with label="parameters" text=text icon="fa-tasks" %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/part/templates/part/copy_part.html b/InvenTree/part/templates/part/copy_part.html index 1c9495bfc2..49a45f5b3a 100644 --- a/InvenTree/part/templates/part/copy_part.html +++ b/InvenTree/part/templates/part/copy_part.html @@ -22,4 +22,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/create_part.html b/InvenTree/part/templates/part/create_part.html index 9587a4f92b..4aed2bbd48 100644 --- a/InvenTree/part/templates/part/create_part.html +++ b/InvenTree/part/templates/part/create_part.html @@ -21,4 +21,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/import_wizard/ajax_match_fields.html b/InvenTree/part/templates/part/import_wizard/ajax_match_fields.html index d7cb567ede..380fe0a12e 100644 --- a/InvenTree/part/templates/part/import_wizard/ajax_match_fields.html +++ b/InvenTree/part/templates/part/import_wizard/ajax_match_fields.html @@ -86,4 +86,4 @@ $('.fieldselect').select2({ matcher: partialMatcher, }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/import_wizard/ajax_match_references.html b/InvenTree/part/templates/part/import_wizard/ajax_match_references.html index d81437f04a..405a21e845 100644 --- a/InvenTree/part/templates/part/import_wizard/ajax_match_references.html +++ b/InvenTree/part/templates/part/import_wizard/ajax_match_references.html @@ -81,4 +81,4 @@ $('.currencyselect').select2({ dropdownAutoWidth: true, }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/import_wizard/ajax_part_upload.html b/InvenTree/part/templates/part/import_wizard/ajax_part_upload.html index f2a1e5c844..b675473237 100644 --- a/InvenTree/part/templates/part/import_wizard/ajax_part_upload.html +++ b/InvenTree/part/templates/part/import_wizard/ajax_part_upload.html @@ -30,4 +30,4 @@ {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/import_wizard/match_fields.html b/InvenTree/part/templates/part/import_wizard/match_fields.html index 8bde89a175..5bc69d75cc 100644 --- a/InvenTree/part/templates/part/import_wizard/match_fields.html +++ b/InvenTree/part/templates/part/import_wizard/match_fields.html @@ -1,2 +1,2 @@ {% extends "part/import_wizard/part_upload.html" %} -{% include "patterns/wizard/match_fields.html" %} \ No newline at end of file +{% include "patterns/wizard/match_fields.html" %} diff --git a/InvenTree/part/templates/part/import_wizard/match_references.html b/InvenTree/part/templates/part/import_wizard/match_references.html index cf076e340e..ece8211c1e 100644 --- a/InvenTree/part/templates/part/import_wizard/match_references.html +++ b/InvenTree/part/templates/part/import_wizard/match_references.html @@ -88,4 +88,4 @@ $('.currencyselect').select2({ dropdownAutoWidth: true, }); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/import_wizard/part_upload.html b/InvenTree/part/templates/part/import_wizard/part_upload.html index 025a4e997c..0252e172cb 100644 --- a/InvenTree/part/templates/part/import_wizard/part_upload.html +++ b/InvenTree/part/templates/part/import_wizard/part_upload.html @@ -20,4 +20,4 @@ enableSidebar('partupload'); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/part_sidebar.html b/InvenTree/part/templates/part/part_sidebar.html index 1da07aa0c6..e8763fb973 100644 --- a/InvenTree/part/templates/part/part_sidebar.html +++ b/InvenTree/part/templates/part/part_sidebar.html @@ -57,4 +57,4 @@ {% trans "Attachments" as text %} {% include "sidebar_item.html" with label="part-attachments" text=text icon="fa-paperclip" %} {% trans "Notes" as text %} -{% include "sidebar_item.html" with label="part-notes" text=text icon="fa-clipboard" %} \ No newline at end of file +{% include "sidebar_item.html" with label="part-notes" text=text icon="fa-clipboard" %} diff --git a/InvenTree/part/templates/part/part_thumb.html b/InvenTree/part/templates/part/part_thumb.html index 0d437c4fb2..a9fcae3f40 100644 --- a/InvenTree/part/templates/part/part_thumb.html +++ b/InvenTree/part/templates/part/part_thumb.html @@ -22,4 +22,4 @@ {% else %} src="{% static 'img/blank_image.png' %}" {% endif %}/> - \ No newline at end of file + diff --git a/InvenTree/part/templates/part/partial_delete.html b/InvenTree/part/templates/part/partial_delete.html index 22c739b833..cd83f8df4f 100644 --- a/InvenTree/part/templates/part/partial_delete.html +++ b/InvenTree/part/templates/part/partial_delete.html @@ -75,4 +75,4 @@ {% if not part.active %} {{ block.super }} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/select_image.html b/InvenTree/part/templates/part/select_image.html index f2e6731cb0..c7506fe47e 100644 --- a/InvenTree/part/templates/part/select_image.html +++ b/InvenTree/part/templates/part/select_image.html @@ -18,4 +18,4 @@
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/part/templates/part/set_category.html b/InvenTree/part/templates/part/set_category.html index 70353b0517..732072d84b 100644 --- a/InvenTree/part/templates/part/set_category.html +++ b/InvenTree/part/templates/part/set_category.html @@ -40,4 +40,4 @@ {% crispy form %} - {% endblock %} \ No newline at end of file + {% endblock %} diff --git a/InvenTree/part/templates/part/stock_count.html b/InvenTree/part/templates/part/stock_count.html index e12c9bd7b7..237c12b83e 100644 --- a/InvenTree/part/templates/part/stock_count.html +++ b/InvenTree/part/templates/part/stock_count.html @@ -7,4 +7,4 @@ {% trans "No Stock" %} {% elif total_stock < part.minimum_stock %} {% trans "Low Stock" %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/part/templates/part/upload_bom.html b/InvenTree/part/templates/part/upload_bom.html index 9db26f7b39..af0c88e529 100644 --- a/InvenTree/part/templates/part/upload_bom.html +++ b/InvenTree/part/templates/part/upload_bom.html @@ -116,4 +116,4 @@ $('#bom-upload').click(function() { }); -{% endblock js_ready %} \ No newline at end of file +{% endblock js_ready %} diff --git a/InvenTree/part/templates/part/variant_part.html b/InvenTree/part/templates/part/variant_part.html index 8a6064711f..ca274e8076 100644 --- a/InvenTree/part/templates/part/variant_part.html +++ b/InvenTree/part/templates/part/variant_part.html @@ -10,4 +10,4 @@ {% blocktrans with full_name=part.full_name %}Create a new variant of template '{{full_name}}'.{% endblocktrans %}
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/report/templates/report/inventree_build_order_base.html b/InvenTree/report/templates/report/inventree_build_order_base.html index 06d8abae65..5e73491d39 100644 --- a/InvenTree/report/templates/report/inventree_build_order_base.html +++ b/InvenTree/report/templates/report/inventree_build_order_base.html @@ -176,4 +176,4 @@ content: "v{{report_revision}} - {{ date.isoformat }}"; {{ build.notes|markdownify }} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/report/templates/report/inventree_po_report.html b/InvenTree/report/templates/report/inventree_po_report.html index 9e546fb70e..50d6bfc7ef 100644 --- a/InvenTree/report/templates/report/inventree_po_report.html +++ b/InvenTree/report/templates/report/inventree_po_report.html @@ -112,4 +112,4 @@ table td.expand { -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/report/templates/report/inventree_report_base.html b/InvenTree/report/templates/report/inventree_report_base.html index c4c96bddb0..2146053513 100644 --- a/InvenTree/report/templates/report/inventree_report_base.html +++ b/InvenTree/report/templates/report/inventree_report_base.html @@ -104,4 +104,4 @@ {% endblock %}
    - \ No newline at end of file + diff --git a/InvenTree/report/templates/report/inventree_so_report.html b/InvenTree/report/templates/report/inventree_so_report.html index 5cb4900719..4e39d8cdba 100644 --- a/InvenTree/report/templates/report/inventree_so_report.html +++ b/InvenTree/report/templates/report/inventree_so_report.html @@ -113,4 +113,4 @@ table td.expand { -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/report/templates/report/inventree_test_report_base.html b/InvenTree/report/templates/report/inventree_test_report_base.html index 73ee55c680..7074cb0ca6 100644 --- a/InvenTree/report/templates/report/inventree_test_report_base.html +++ b/InvenTree/report/templates/report/inventree_test_report_base.html @@ -150,4 +150,4 @@ content: "{% trans 'Stock Item Test Report' %}"; {% block post_page_content %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/stock/fixtures/location.yaml b/InvenTree/stock/fixtures/location.yaml index cb1bdfac99..0cbcead07e 100644 --- a/InvenTree/stock/fixtures/location.yaml +++ b/InvenTree/stock/fixtures/location.yaml @@ -73,4 +73,4 @@ level: 0 tree_id: 2 lft: 6 - rght: 7 \ No newline at end of file + rght: 7 diff --git a/InvenTree/stock/fixtures/stock_tests.yaml b/InvenTree/stock/fixtures/stock_tests.yaml index 8a99e8b56b..4b413b1289 100644 --- a/InvenTree/stock/fixtures/stock_tests.yaml +++ b/InvenTree/stock/fixtures/stock_tests.yaml @@ -73,4 +73,4 @@ test: 'test strength of chair' result: False value: 100kg - date: 2020-05-17 \ No newline at end of file + date: 2020-05-17 diff --git a/InvenTree/stock/templates/stock/item_delete.html b/InvenTree/stock/templates/stock/item_delete.html index df83a88e37..087e0b5179 100644 --- a/InvenTree/stock/templates/stock/item_delete.html +++ b/InvenTree/stock/templates/stock/item_delete.html @@ -12,4 +12,4 @@ {% blocktrans with full_name=item.part.full_name %}This will remove {{qty}} units of {{full_name}} from stock.{% endblocktrans %}
    -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/stock/templates/stock/item_serialize.html b/InvenTree/stock/templates/stock/item_serialize.html index 0f70647e38..0d79d489f0 100644 --- a/InvenTree/stock/templates/stock/item_serialize.html +++ b/InvenTree/stock/templates/stock/item_serialize.html @@ -5,4 +5,4 @@ {% trans "Create serialized items from this stock item." %}
    {% trans "Select quantity to serialize, and unique serial numbers." %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/stock/templates/stock/stockitem_convert.html b/InvenTree/stock/templates/stock/stockitem_convert.html index d4e3487567..90c3fd8e1e 100644 --- a/InvenTree/stock/templates/stock/stockitem_convert.html +++ b/InvenTree/stock/templates/stock/stockitem_convert.html @@ -14,4 +14,4 @@ {% trans "This action cannot be easily undone" %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/stock/templates/stock/tracking_delete.html b/InvenTree/stock/templates/stock/tracking_delete.html index 79d5af5192..8469458dfc 100644 --- a/InvenTree/stock/templates/stock/tracking_delete.html +++ b/InvenTree/stock/templates/stock/tracking_delete.html @@ -6,4 +6,4 @@ {% trans "Are you sure you want to delete this stock tracking entry?" %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/403.html b/InvenTree/templates/403.html index 4ee8367d9c..e5185b15d0 100644 --- a/InvenTree/templates/403.html +++ b/InvenTree/templates/403.html @@ -16,4 +16,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/404.html b/InvenTree/templates/404.html index aae55031f3..c96ae7568e 100644 --- a/InvenTree/templates/404.html +++ b/InvenTree/templates/404.html @@ -16,4 +16,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/500.html b/InvenTree/templates/500.html index f50a5ea6fe..bd58bbf988 100644 --- a/InvenTree/templates/500.html +++ b/InvenTree/templates/500.html @@ -17,4 +17,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/notifications/history.html b/InvenTree/templates/InvenTree/notifications/history.html index 863c797d1f..2f6a34d0d7 100644 --- a/InvenTree/templates/InvenTree/notifications/history.html +++ b/InvenTree/templates/InvenTree/notifications/history.html @@ -22,4 +22,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/notifications/inbox.html b/InvenTree/templates/InvenTree/notifications/inbox.html index d8f5190860..40ea8f2042 100644 --- a/InvenTree/templates/InvenTree/notifications/inbox.html +++ b/InvenTree/templates/InvenTree/notifications/inbox.html @@ -25,4 +25,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/password.html b/InvenTree/templates/InvenTree/password.html index d109a09a7a..46bd097be7 100644 --- a/InvenTree/templates/InvenTree/password.html +++ b/InvenTree/templates/InvenTree/password.html @@ -4,4 +4,4 @@ {{ block.super }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/barcode.html b/InvenTree/templates/InvenTree/settings/barcode.html index ea45455203..bdfcffbd5d 100644 --- a/InvenTree/templates/InvenTree/settings/barcode.html +++ b/InvenTree/templates/InvenTree/settings/barcode.html @@ -17,4 +17,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/build.html b/InvenTree/templates/InvenTree/settings/build.html index d567197959..de414a6284 100644 --- a/InvenTree/templates/InvenTree/settings/build.html +++ b/InvenTree/templates/InvenTree/settings/build.html @@ -17,4 +17,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/currencies.html b/InvenTree/templates/InvenTree/settings/currencies.html index 706f836317..5f49087497 100644 --- a/InvenTree/templates/InvenTree/settings/currencies.html +++ b/InvenTree/templates/InvenTree/settings/currencies.html @@ -54,4 +54,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/mixins/settings.html b/InvenTree/templates/InvenTree/settings/mixins/settings.html index 57218b3699..c4bff23ef6 100644 --- a/InvenTree/templates/InvenTree/settings/mixins/settings.html +++ b/InvenTree/templates/InvenTree/settings/mixins/settings.html @@ -13,4 +13,4 @@ {% include "InvenTree/settings/setting.html" with key=setting plugin=plugin %} {% endfor %} - \ No newline at end of file + diff --git a/InvenTree/templates/InvenTree/settings/po.html b/InvenTree/templates/InvenTree/settings/po.html index f1ad603db5..193f9ecb93 100644 --- a/InvenTree/templates/InvenTree/settings/po.html +++ b/InvenTree/templates/InvenTree/settings/po.html @@ -13,4 +13,4 @@ {% include "InvenTree/settings/setting.html" with key="PURCHASEORDER_REFERENCE_PREFIX" %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/report.html b/InvenTree/templates/InvenTree/settings/report.html index a25ace23ce..3c6528e1e8 100644 --- a/InvenTree/templates/InvenTree/settings/report.html +++ b/InvenTree/templates/InvenTree/settings/report.html @@ -19,4 +19,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/sidebar.html b/InvenTree/templates/InvenTree/settings/sidebar.html index 9df6b0736f..3d06228c15 100644 --- a/InvenTree/templates/InvenTree/settings/sidebar.html +++ b/InvenTree/templates/InvenTree/settings/sidebar.html @@ -62,4 +62,4 @@ {% endfor %} {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/templates/InvenTree/settings/so.html b/InvenTree/templates/InvenTree/settings/so.html index ac84f5fa86..cdc5213314 100644 --- a/InvenTree/templates/InvenTree/settings/so.html +++ b/InvenTree/templates/InvenTree/settings/so.html @@ -16,4 +16,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html index d3d1e35210..b9feb555f5 100644 --- a/InvenTree/templates/InvenTree/settings/user.html +++ b/InvenTree/templates/InvenTree/settings/user.html @@ -273,4 +273,4 @@ e.preventDefault(); }); } })(); -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/user_homepage.html b/InvenTree/templates/InvenTree/settings/user_homepage.html index 54e3bdcefd..17cbdfe2a5 100644 --- a/InvenTree/templates/InvenTree/settings/user_homepage.html +++ b/InvenTree/templates/InvenTree/settings/user_homepage.html @@ -39,4 +39,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/user_labels.html b/InvenTree/templates/InvenTree/settings/user_labels.html index 6a27ef05bc..d14db225d4 100644 --- a/InvenTree/templates/InvenTree/settings/user_labels.html +++ b/InvenTree/templates/InvenTree/settings/user_labels.html @@ -20,4 +20,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/InvenTree/settings/user_notifications.html b/InvenTree/templates/InvenTree/settings/user_notifications.html index 6d67d34851..829be97c78 100644 --- a/InvenTree/templates/InvenTree/settings/user_notifications.html +++ b/InvenTree/templates/InvenTree/settings/user_notifications.html @@ -21,4 +21,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/InvenTree/templates/InvenTree/settings/user_reports.html b/InvenTree/templates/InvenTree/settings/user_reports.html index 186adfe31c..e4c9b166c8 100644 --- a/InvenTree/templates/InvenTree/settings/user_reports.html +++ b/InvenTree/templates/InvenTree/settings/user_reports.html @@ -19,4 +19,4 @@ -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/admin_button.html b/InvenTree/templates/admin_button.html index ebe767f9ac..221d7f6c8e 100644 --- a/InvenTree/templates/admin_button.html +++ b/InvenTree/templates/admin_button.html @@ -1,4 +1,4 @@ {% load i18n %} \ No newline at end of file + diff --git a/InvenTree/templates/attachment_button.html b/InvenTree/templates/attachment_button.html index d220f4829d..06af64a07e 100644 --- a/InvenTree/templates/attachment_button.html +++ b/InvenTree/templates/attachment_button.html @@ -5,4 +5,4 @@ \ No newline at end of file + diff --git a/InvenTree/templates/attachment_table.html b/InvenTree/templates/attachment_table.html index cd73e864a1..d1562cf5f5 100644 --- a/InvenTree/templates/attachment_table.html +++ b/InvenTree/templates/attachment_table.html @@ -10,4 +10,4 @@
    - \ No newline at end of file + diff --git a/InvenTree/templates/clip.html b/InvenTree/templates/clip.html index 6051e439b4..247f1b4a7a 100644 --- a/InvenTree/templates/clip.html +++ b/InvenTree/templates/clip.html @@ -2,4 +2,4 @@ - \ No newline at end of file + diff --git a/InvenTree/templates/filter_list.html b/InvenTree/templates/filter_list.html index ae29428924..73fa03ccb0 100644 --- a/InvenTree/templates/filter_list.html +++ b/InvenTree/templates/filter_list.html @@ -1 +1 @@ -
    \ No newline at end of file +
    diff --git a/InvenTree/templates/hover_image.html b/InvenTree/templates/hover_image.html index e9f781655b..a1c8224f3c 100644 --- a/InvenTree/templates/hover_image.html +++ b/InvenTree/templates/hover_image.html @@ -9,4 +9,4 @@ {% endif %} - \ No newline at end of file + diff --git a/InvenTree/templates/image_download.html b/InvenTree/templates/image_download.html index 1191886711..271895764e 100644 --- a/InvenTree/templates/image_download.html +++ b/InvenTree/templates/image_download.html @@ -13,4 +13,4 @@
  • {% trans "Remote image must not exceed maximum allowable file size" %}
  • -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/InvenTree/templates/js/translated/plugin.js b/InvenTree/templates/js/translated/plugin.js index 62555c8ff4..77c31e46d1 100644 --- a/InvenTree/templates/js/translated/plugin.js +++ b/InvenTree/templates/js/translated/plugin.js @@ -70,5 +70,3 @@ function locateItemOrLocation(options={}) { }, ); } - - diff --git a/InvenTree/templates/mail.html b/InvenTree/templates/mail.html index 98990fb31b..fe4d213ebe 100644 --- a/InvenTree/templates/mail.html +++ b/InvenTree/templates/mail.html @@ -1 +1 @@ -{{ mail }}{% include "clip.html"%} \ No newline at end of file +{{ mail }}{% include "clip.html"%} diff --git a/InvenTree/templates/modal_csrf.html b/InvenTree/templates/modal_csrf.html index 3bce88c0aa..cdd25cbab7 100644 --- a/InvenTree/templates/modal_csrf.html +++ b/InvenTree/templates/modal_csrf.html @@ -1,3 +1,3 @@
    {% csrf_token %} -
    \ No newline at end of file + diff --git a/InvenTree/templates/modals.html b/InvenTree/templates/modals.html index d36df97170..31e94640ed 100644 --- a/InvenTree/templates/modals.html +++ b/InvenTree/templates/modals.html @@ -52,4 +52,4 @@ - \ No newline at end of file + diff --git a/InvenTree/templates/notes_buttons.html b/InvenTree/templates/notes_buttons.html index ac016a87e2..a4072074f9 100644 --- a/InvenTree/templates/notes_buttons.html +++ b/InvenTree/templates/notes_buttons.html @@ -5,4 +5,4 @@ \ No newline at end of file + diff --git a/InvenTree/templates/notifications.html b/InvenTree/templates/notifications.html index e7dfc86998..4ef7b8daec 100644 --- a/InvenTree/templates/notifications.html +++ b/InvenTree/templates/notifications.html @@ -13,4 +13,3 @@ {% trans "Show all notifications and history" %} - diff --git a/InvenTree/templates/panel.html b/InvenTree/templates/panel.html index 86867f07b4..c674c9a94f 100644 --- a/InvenTree/templates/panel.html +++ b/InvenTree/templates/panel.html @@ -17,4 +17,4 @@ {% endblock %} {% endblock %} - \ No newline at end of file + diff --git a/InvenTree/templates/patterns/wizard/upload.html b/InvenTree/templates/patterns/wizard/upload.html index 6a7049247d..684535b344 100644 --- a/InvenTree/templates/patterns/wizard/upload.html +++ b/InvenTree/templates/patterns/wizard/upload.html @@ -44,4 +44,4 @@ {% endif %} - \ No newline at end of file + diff --git a/InvenTree/templates/plugin/panel_content.html b/InvenTree/templates/plugin/panel_content.html index 6b5c4ed90b..210d484848 100644 --- a/InvenTree/templates/plugin/panel_content.html +++ b/InvenTree/templates/plugin/panel_content.html @@ -16,4 +16,4 @@ {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/templates/plugin/panel_js.html b/InvenTree/templates/plugin/panel_js.html index bf8b7fea34..366f5a0fb3 100644 --- a/InvenTree/templates/plugin/panel_js.html +++ b/InvenTree/templates/plugin/panel_js.html @@ -7,4 +7,4 @@ onPanelLoad('{{ panel.key }}', function() { }); {% endif %} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/templates/plugin/panel_menu.html b/InvenTree/templates/plugin/panel_menu.html index bbbadfdc64..1ce3257aa7 100644 --- a/InvenTree/templates/plugin/panel_menu.html +++ b/InvenTree/templates/plugin/panel_menu.html @@ -3,4 +3,4 @@ {% for panel in plugin_panels %} {% include "sidebar_item.html" with label=panel.key text=panel.title icon=panel.icon %} {% endfor %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/templates/price.html b/InvenTree/templates/price.html index 285f785178..bf8c5f96e6 100644 --- a/InvenTree/templates/price.html +++ b/InvenTree/templates/price.html @@ -1,2 +1,2 @@ {% load djmoney %} -{% money_localize price currency %} \ No newline at end of file +{% money_localize price currency %} diff --git a/InvenTree/templates/qr_button.html b/InvenTree/templates/qr_button.html index c1878d054a..905b5588ab 100644 --- a/InvenTree/templates/qr_button.html +++ b/InvenTree/templates/qr_button.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/InvenTree/templates/qr_code.html b/InvenTree/templates/qr_code.html index a39847629d..7ecd4e345e 100644 --- a/InvenTree/templates/qr_code.html +++ b/InvenTree/templates/qr_code.html @@ -11,4 +11,4 @@ {% trans "QR data not provided" %} {% endif %} - \ No newline at end of file + diff --git a/InvenTree/templates/sample/sample.html b/InvenTree/templates/sample/sample.html index 0db05e3152..5515bda1fe 100644 --- a/InvenTree/templates/sample/sample.html +++ b/InvenTree/templates/sample/sample.html @@ -1 +1 @@ -

    {{abc}}

    \ No newline at end of file +

    {{abc}}

    diff --git a/InvenTree/templates/sidebar_header.html b/InvenTree/templates/sidebar_header.html index 6e79b4f6d6..f8662451a9 100644 --- a/InvenTree/templates/sidebar_header.html +++ b/InvenTree/templates/sidebar_header.html @@ -5,4 +5,4 @@ {% if icon %}{% endif %} {% if text %}{% endif %} - \ No newline at end of file + diff --git a/InvenTree/templates/skeleton.html b/InvenTree/templates/skeleton.html index 1c4775372e..488e69dddb 100644 --- a/InvenTree/templates/skeleton.html +++ b/InvenTree/templates/skeleton.html @@ -96,4 +96,4 @@ {% endblock %} - \ No newline at end of file + diff --git a/InvenTree/templates/spacer.html b/InvenTree/templates/spacer.html index ca2342cd28..048ffa6a2b 100644 --- a/InvenTree/templates/spacer.html +++ b/InvenTree/templates/spacer.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/InvenTree/templates/stats.html b/InvenTree/templates/stats.html index e1359e5886..7b966dd12b 100644 --- a/InvenTree/templates/stats.html +++ b/InvenTree/templates/stats.html @@ -87,4 +87,4 @@ {% endfor %} {% endif %} - \ No newline at end of file + diff --git a/InvenTree/templates/tel.html b/InvenTree/templates/tel.html index 14f978ad87..9a5389f82c 100644 --- a/InvenTree/templates/tel.html +++ b/InvenTree/templates/tel.html @@ -1 +1 @@ -{{ tel }}{% include "clip.html"%} \ No newline at end of file +{{ tel }}{% include "clip.html"%} diff --git a/InvenTree/templates/url.html b/InvenTree/templates/url.html index 16c17842f1..ad0c20d9ee 100644 --- a/InvenTree/templates/url.html +++ b/InvenTree/templates/url.html @@ -4,4 +4,4 @@ {% else %}{{ url }} {% endif %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/InvenTree/templates/version.html b/InvenTree/templates/version.html index 7f3b774257..52368679ae 100644 --- a/InvenTree/templates/version.html +++ b/InvenTree/templates/version.html @@ -5,4 +5,4 @@ Django Version: {% django_version %} {% inventree_commit_date as commit_date %}{% if commit_date %}Commit Date: {% render_date commit_date %}{% endif %} Database: {% inventree_db_engine %} Debug-Mode: {% inventree_in_debug_mode %} -Deployed using Docker: {% inventree_docker_mode %} \ No newline at end of file +Deployed using Docker: {% inventree_docker_mode %} diff --git a/InvenTree/templates/yesnolabel.html b/InvenTree/templates/yesnolabel.html index 480c08dfb3..6ebed75f7f 100644 --- a/InvenTree/templates/yesnolabel.html +++ b/InvenTree/templates/yesnolabel.html @@ -4,4 +4,4 @@ {% trans 'Yes' %} {% else %} {% trans 'No' %} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/deploy/supervisord.conf b/deploy/supervisord.conf index 88a5af3e5c..a480cba804 100644 --- a/deploy/supervisord.conf +++ b/deploy/supervisord.conf @@ -43,4 +43,4 @@ autostart=true autorestart=true ; Change these paths if log files are stored elsewhere stderr_logfile=/home/inventree/log/cluster.err.log -stdout_logfile=/home/inventree/log/cluster.out.log \ No newline at end of file +stdout_logfile=/home/inventree/log/cluster.out.log From ddc4ef3c388433a72fa04b08dd80baf26d47bd5c Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 13:37:12 +0200 Subject: [PATCH 3/6] pep fix --- tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 2511090f86..43b240e6bf 100644 --- a/tasks.py +++ b/tasks.py @@ -63,11 +63,12 @@ def manage(c, cmd, pty=False): cmd - django command to run """ - result = c.run('cd "{path}" && python3 manage.py {cmd}'.format( + c.run('cd "{path}" && python3 manage.py {cmd}'.format( path=managePyDir(), cmd=cmd ), pty=pty) + @task def plugins(c): """ @@ -83,6 +84,7 @@ def plugins(c): # Install the plugins c.run(f"pip3 install -U -r '{plugin_file}'") + @task(post=[plugins]) def install(c): """ @@ -94,6 +96,7 @@ def install(c): # Install required Python packages with PIP c.run('pip3 install -U -r requirements.txt') + @task def setup_dev(c): """ @@ -111,6 +114,7 @@ def setup_dev(c): # Update all the hooks c.run('pre-commit autoupdate') + @task def shell(c): """ @@ -452,7 +456,7 @@ def delete_data(c, force=False): Warning: This will REALLY delete all records in the database!! """ - print(f"Deleting all data from InvenTree database...") + print("Deleting all data from InvenTree database...") if force: manage(c, 'flush --noinput') From e1d22f538dda1eff1b7915a6a17fffa889d5500f Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 17:24:51 +0200 Subject: [PATCH 4/6] resort imports --- InvenTree/InvenTree/api.py | 11 ++- InvenTree/InvenTree/api_tester.py | 3 +- InvenTree/InvenTree/apps.py | 8 +-- InvenTree/InvenTree/ci_render_js.py | 6 +- InvenTree/InvenTree/config.py | 3 +- InvenTree/InvenTree/context.py | 8 +-- InvenTree/InvenTree/exceptions.py | 7 +- InvenTree/InvenTree/exchange.py | 11 +-- InvenTree/InvenTree/fields.py | 22 +++--- InvenTree/InvenTree/forms.py | 20 +++--- InvenTree/InvenTree/helpers.py | 24 +++---- .../management/commands/clean_settings.py | 1 - .../management/commands/prerender.py | 8 +-- .../management/commands/rebuild_thumbnails.py | 11 ++- .../management/commands/remove_mfa.py | 2 +- .../management/commands/wait_for_db.py | 9 ++- InvenTree/InvenTree/metadata.py | 6 +- InvenTree/InvenTree/middleware.py | 13 ++-- InvenTree/InvenTree/models.py | 12 ++-- InvenTree/InvenTree/serializers.py | 13 ++-- InvenTree/InvenTree/settings.py | 17 ++--- InvenTree/InvenTree/status.py | 10 ++- InvenTree/InvenTree/tasks.py | 19 ++--- InvenTree/InvenTree/test_api.py | 11 ++- InvenTree/InvenTree/test_middleware.py | 3 +- InvenTree/InvenTree/test_tasks.py | 5 +- InvenTree/InvenTree/test_urls.py | 7 +- InvenTree/InvenTree/test_views.py | 4 +- InvenTree/InvenTree/tests.py | 29 +++----- InvenTree/InvenTree/urls.py | 62 ++++++++-------- InvenTree/InvenTree/validators.py | 6 +- InvenTree/InvenTree/version.py | 6 +- InvenTree/InvenTree/views.py | 33 +++++---- InvenTree/common/api.py | 12 ++-- InvenTree/common/apps.py | 1 - InvenTree/common/files.py | 7 +- InvenTree/common/models.py | 36 +++++----- InvenTree/common/notifications.py | 3 +- InvenTree/common/serializers.py | 8 +-- InvenTree/common/settings.py | 4 +- InvenTree/common/tasks.py | 3 +- InvenTree/common/test_notifications.py | 7 +- InvenTree/common/test_tasks.py | 3 +- InvenTree/common/tests.py | 9 +-- InvenTree/common/views.py | 4 +- InvenTree/company/admin.py | 15 ++-- InvenTree/company/api.py | 29 ++++---- InvenTree/company/forms.py | 11 ++- InvenTree/company/models.py | 28 +++----- InvenTree/company/serializers.py | 21 +++--- InvenTree/company/test_api.py | 3 +- InvenTree/company/test_views.py | 4 +- InvenTree/company/tests.py | 11 +-- InvenTree/company/urls.py | 1 - InvenTree/company/views.py | 21 +++--- InvenTree/label/admin.py | 2 +- InvenTree/label/api.py | 25 +++---- InvenTree/label/apps.py | 5 +- InvenTree/label/models.py | 22 +++--- InvenTree/label/serializers.py | 6 +- InvenTree/label/tests.py | 10 +-- InvenTree/order/admin.py | 10 +-- InvenTree/order/api.py | 24 +++---- InvenTree/order/forms.py | 6 +- InvenTree/order/models.py | 34 ++++----- InvenTree/order/serializers.py | 34 ++++----- InvenTree/order/test_api.py | 13 ++-- InvenTree/order/test_sales_order.py | 17 ++--- InvenTree/order/test_views.py | 4 +- InvenTree/order/tests.py | 10 +-- InvenTree/order/views.py | 40 +++++------ InvenTree/part/admin.py | 4 +- InvenTree/part/api.py | 66 +++++++---------- InvenTree/part/apps.py | 3 +- InvenTree/part/bom.py | 2 +- InvenTree/part/forms.py | 14 ++-- InvenTree/part/models.py | 72 ++++++++----------- InvenTree/part/serializers.py | 31 ++++---- InvenTree/part/tasks.py | 3 +- .../part/templatetags/inventree_extras.py | 27 +++---- InvenTree/part/templatetags/status_codes.py | 5 +- InvenTree/part/test_api.py | 19 +++-- InvenTree/part/test_bom_export.py | 5 +- InvenTree/part/test_bom_import.py | 5 +- InvenTree/part/test_bom_item.py | 10 +-- InvenTree/part/test_category.py | 2 +- InvenTree/part/test_param.py | 7 +- InvenTree/part/test_part.py | 27 ++++--- InvenTree/part/test_views.py | 4 +- InvenTree/part/urls.py | 1 - InvenTree/part/views.py | 69 ++++++++---------- InvenTree/plugin/__init__.py | 4 +- InvenTree/plugin/api.py | 7 +- InvenTree/plugin/apps.py | 1 - InvenTree/plugin/base/action/test_action.py | 2 +- InvenTree/plugin/base/barcodes/api.py | 11 ++- InvenTree/plugin/base/barcodes/mixins.py | 6 +- .../plugin/base/barcodes/test_barcode.py | 2 +- InvenTree/plugin/base/event/events.py | 4 +- InvenTree/plugin/base/integration/mixins.py | 15 ++-- .../plugin/base/integration/test_mixins.py | 10 +-- InvenTree/plugin/base/label/label.py | 3 +- InvenTree/plugin/base/locate/api.py | 3 +- InvenTree/plugin/base/locate/test_locate.py | 1 - .../builtin/action/test_simpleactionplugin.py | 2 +- .../builtin/barcodes/inventree_barcode.py | 7 +- .../barcodes/test_inventree_barcode.py | 2 +- .../builtin/integration/core_notifications.py | 2 +- .../integration/test_core_notifications.py | 5 +- InvenTree/plugin/events.py | 3 +- InvenTree/plugin/helpers.py | 9 ++- InvenTree/plugin/mixins/__init__.py | 8 ++- InvenTree/plugin/models.py | 7 +- InvenTree/plugin/plugin.py | 9 ++- InvenTree/plugin/registry.py | 21 +++--- .../integration/custom_panel_sample.py | 3 +- .../plugin/samples/integration/sample.py | 8 +-- .../plugin/samples/integration/test_sample.py | 2 +- .../integration/test_scheduled_task.py | 4 +- .../plugin/samples/locate/locate_sample.py | 1 - InvenTree/plugin/serializers.py | 6 +- .../plugin/templatetags/plugin_extras.py | 4 +- InvenTree/plugin/test_api.py | 4 +- InvenTree/plugin/test_plugin.py | 7 +- InvenTree/plugin/urls.py | 1 - InvenTree/plugin/views.py | 1 - InvenTree/report/admin.py | 8 +-- InvenTree/report/api.py | 34 ++++----- InvenTree/report/apps.py | 3 +- InvenTree/report/models.py | 23 +++--- InvenTree/report/serializers.py | 10 ++- InvenTree/report/templatetags/barcode.py | 2 +- InvenTree/report/templatetags/report.py | 6 +- InvenTree/report/tests.py | 9 ++- InvenTree/script/translation_stats.py | 2 +- InvenTree/stock/admin.py | 13 ++-- InvenTree/stock/api.py | 42 ++++------- InvenTree/stock/models.py | 55 ++++++-------- InvenTree/stock/serializers.py | 28 +++----- InvenTree/stock/test_api.py | 13 ++-- InvenTree/stock/test_views.py | 4 +- InvenTree/stock/tests.py | 19 +++-- InvenTree/stock/views.py | 22 +++--- InvenTree/users/admin.py | 17 +++-- InvenTree/users/api.py | 11 ++- InvenTree/users/apps.py | 5 +- InvenTree/users/models.py | 16 ++--- InvenTree/users/serializers.py | 5 +- InvenTree/users/tests.py | 6 +- ci/check_api_endpoint.py | 1 + ci/check_js_templates.py | 4 +- ci/check_locale_files.py | 2 +- ci/check_migration_files.py | 2 +- ci/check_version_number.py | 6 +- docker/gunicorn.conf.py | 3 +- tasks.py | 4 +- 156 files changed, 807 insertions(+), 1042 deletions(-) diff --git a/InvenTree/InvenTree/api.py b/InvenTree/InvenTree/api.py index e58ef798fc..0713479f7a 100644 --- a/InvenTree/InvenTree/api.py +++ b/InvenTree/InvenTree/api.py @@ -2,18 +2,17 @@ Main JSON interface views """ -from django.utils.translation import gettext_lazy as _ from django.conf import settings from django.http import JsonResponse +from django.utils.translation import gettext_lazy as _ from django_filters.rest_framework import DjangoFilterBackend -from rest_framework import filters +from rest_framework import filters, permissions -from rest_framework import permissions - -from .views import AjaxView -from .version import inventreeVersion, inventreeApiVersion, inventreeInstanceName from .status import is_worker_running +from .version import (inventreeApiVersion, inventreeInstanceName, + inventreeVersion) +from .views import AjaxView class InfoView(AjaxView): diff --git a/InvenTree/InvenTree/api_tester.py b/InvenTree/InvenTree/api_tester.py index 34976ffbfe..368ca3a765 100644 --- a/InvenTree/InvenTree/api_tester.py +++ b/InvenTree/InvenTree/api_tester.py @@ -6,9 +6,10 @@ import csv import io import re -from django.http.response import StreamingHttpResponse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.http.response import StreamingHttpResponse + from rest_framework.test import APITestCase diff --git a/InvenTree/InvenTree/apps.py b/InvenTree/InvenTree/apps.py index 0284cd43aa..74dbca444c 100644 --- a/InvenTree/InvenTree/apps.py +++ b/InvenTree/InvenTree/apps.py @@ -3,16 +3,16 @@ import logging from django.apps import AppConfig -from django.core.exceptions import AppRegistryNotReady from django.conf import settings from django.contrib.auth import get_user_model +from django.core.exceptions import AppRegistryNotReady from django.db import transaction from django.db.utils import IntegrityError -from InvenTree.ready import isInTestMode, canAppAccessDatabase -from .config import get_setting import InvenTree.tasks +from InvenTree.ready import canAppAccessDatabase, isInTestMode +from .config import get_setting logger = logging.getLogger("inventree") @@ -111,8 +111,8 @@ class InvenTreeConfig(AppConfig): try: from djmoney.contrib.exchange.models import ExchangeBackend - from InvenTree.tasks import update_exchange_rates from common.settings import currency_code_default + from InvenTree.tasks import update_exchange_rates except AppRegistryNotReady: # pragma: no cover pass diff --git a/InvenTree/InvenTree/ci_render_js.py b/InvenTree/InvenTree/ci_render_js.py index 94530db096..2c9d05dfc4 100644 --- a/InvenTree/InvenTree/ci_render_js.py +++ b/InvenTree/InvenTree/ci_render_js.py @@ -3,12 +3,12 @@ Pull rendered copies of the templated only used for testing the js files! - This file is omited from coverage """ -from django.test import TestCase # pragma: no cover -from django.contrib.auth import get_user_model # pragma: no cover - import os # pragma: no cover import pathlib # pragma: no cover +from django.contrib.auth import get_user_model # pragma: no cover +from django.test import TestCase # pragma: no cover + class RenderJavascriptFiles(TestCase): # pragma: no cover """ diff --git a/InvenTree/InvenTree/config.py b/InvenTree/InvenTree/config.py index 35671c1b26..d7691cf4cc 100644 --- a/InvenTree/InvenTree/config.py +++ b/InvenTree/InvenTree/config.py @@ -2,10 +2,9 @@ Helper functions for loading InvenTree configuration options """ +import logging import os import shutil -import logging - logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/context.py b/InvenTree/InvenTree/context.py index 7d65cb4231..c0b27ad5bf 100644 --- a/InvenTree/InvenTree/context.py +++ b/InvenTree/InvenTree/context.py @@ -4,12 +4,10 @@ Provides extra global data to all templates. """ -from InvenTree.status_codes import SalesOrderStatus, PurchaseOrderStatus -from InvenTree.status_codes import BuildStatus, StockStatus -from InvenTree.status_codes import StockHistoryCode - import InvenTree.status - +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, + SalesOrderStatus, StockHistoryCode, + StockStatus) from users.models import RuleSet diff --git a/InvenTree/InvenTree/exceptions.py b/InvenTree/InvenTree/exceptions.py index 46b1a1ee0a..55017affc0 100644 --- a/InvenTree/InvenTree/exceptions.py +++ b/InvenTree/InvenTree/exceptions.py @@ -5,20 +5,19 @@ Custom exception handling for the DRF API # -*- coding: utf-8 -*- from __future__ import unicode_literals -import traceback import sys +import traceback from django.conf import settings from django.core.exceptions import ValidationError as DjangoValidationError from django.utils.translation import gettext_lazy as _ from django.views.debug import ExceptionReporter +import rest_framework.views as drfviews from error_report.models import Error - +from rest_framework import serializers from rest_framework.exceptions import ValidationError as DRFValidationError from rest_framework.response import Response -from rest_framework import serializers -import rest_framework.views as drfviews def exception_handler(exc, context): diff --git a/InvenTree/InvenTree/exchange.py b/InvenTree/InvenTree/exchange.py index a79239568d..a46e1356a8 100644 --- a/InvenTree/InvenTree/exchange.py +++ b/InvenTree/InvenTree/exchange.py @@ -1,13 +1,14 @@ -import certifi import ssl +from urllib.error import URLError from urllib.request import urlopen -from common.settings import currency_code_default, currency_codes -from urllib.error import URLError - -from djmoney.contrib.exchange.backends.base import SimpleExchangeBackend from django.db.utils import OperationalError +import certifi +from djmoney.contrib.exchange.backends.base import SimpleExchangeBackend + +from common.settings import currency_code_default, currency_codes + class InvenTreeExchange(SimpleExchangeBackend): """ diff --git a/InvenTree/InvenTree/fields.py b/InvenTree/InvenTree/fields.py index 894b993e50..9995c5444c 100644 --- a/InvenTree/InvenTree/fields.py +++ b/InvenTree/InvenTree/fields.py @@ -1,24 +1,22 @@ """ Custom fields used in InvenTree """ import sys - -from .validators import allowable_url_schemes - -from django.utils.translation import gettext_lazy as _ - -from django.forms.fields import URLField as FormURLField -from django.db import models as models -from django.core import validators -from django import forms - from decimal import Decimal -from djmoney.models.fields import MoneyField as ModelMoneyField +from django import forms +from django.core import validators +from django.db import models as models +from django.forms.fields import URLField as FormURLField +from django.utils.translation import gettext_lazy as _ + from djmoney.forms.fields import MoneyField +from djmoney.models.fields import MoneyField as ModelMoneyField from djmoney.models.validators import MinMoneyValidator import InvenTree.helpers +from .validators import allowable_url_schemes + class InvenTreeURLFormField(FormURLField): """ Custom URL form field with custom scheme validators """ @@ -39,7 +37,7 @@ class InvenTreeURLField(models.URLField): def money_kwargs(): """ returns the database settings for MoneyFields """ - from common.settings import currency_code_mappings, currency_code_default + from common.settings import currency_code_default, currency_code_mappings kwargs = {} kwargs['currency_choices'] = currency_code_mappings() diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 40e8509411..50e2d26fff 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -2,29 +2,29 @@ Helper forms which subclass Django forms to provide additional functionality """ -from urllib.parse import urlencode import logging +from urllib.parse import urlencode -from django.utils.translation import gettext_lazy as _ from django import forms -from django.contrib.auth.models import User, Group from django.conf import settings +from django.contrib.auth.models import Group, User from django.http import HttpResponseRedirect from django.urls import reverse +from django.utils.translation import gettext_lazy as _ -from crispy_forms.helper import FormHelper -from crispy_forms.layout import Layout, Field -from crispy_forms.bootstrap import PrependedText, AppendedText, PrependedAppendedText, StrictButton, Div - -from allauth.account.forms import SignupForm, set_form_field_order from allauth.account.adapter import DefaultAccountAdapter -from allauth.socialaccount.adapter import DefaultSocialAccountAdapter +from allauth.account.forms import SignupForm, set_form_field_order from allauth.exceptions import ImmediateHttpResponse +from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from allauth_2fa.adapter import OTPAdapter from allauth_2fa.utils import user_has_valid_totp_device +from crispy_forms.bootstrap import (AppendedText, Div, PrependedAppendedText, + PrependedText, StrictButton) +from crispy_forms.helper import FormHelper +from crispy_forms.layout import Field, Layout -from part.models import PartCategory from common.models import InvenTreeSetting +from part.models import PartCategory logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/helpers.py b/InvenTree/InvenTree/helpers.py index 9e6e24acb8..d5722a2e99 100644 --- a/InvenTree/InvenTree/helpers.py +++ b/InvenTree/InvenTree/helpers.py @@ -3,27 +3,25 @@ Provides helper functions used throughout the InvenTree project """ import io -import re import json import os.path -from PIL import Image - +import re from decimal import Decimal, InvalidOperation - from wsgiref.util import FileWrapper -from django.http import StreamingHttpResponse -from django.core.exceptions import ValidationError, FieldError -from django.utils.translation import gettext_lazy as _ from django.contrib.auth.models import Permission - -import InvenTree.version - -from common.models import InvenTreeSetting -from .settings import MEDIA_URL, STATIC_URL -from common.settings import currency_code_default +from django.core.exceptions import FieldError, ValidationError +from django.http import StreamingHttpResponse +from django.utils.translation import gettext_lazy as _ from djmoney.money import Money +from PIL import Image + +import InvenTree.version +from common.models import InvenTreeSetting +from common.settings import currency_code_default + +from .settings import MEDIA_URL, STATIC_URL def getSetting(key, backup_value=None): diff --git a/InvenTree/InvenTree/management/commands/clean_settings.py b/InvenTree/InvenTree/management/commands/clean_settings.py index 283416de29..7607f2a574 100644 --- a/InvenTree/InvenTree/management/commands/clean_settings.py +++ b/InvenTree/InvenTree/management/commands/clean_settings.py @@ -6,7 +6,6 @@ import logging from django.core.management.base import BaseCommand - logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/management/commands/prerender.py b/InvenTree/InvenTree/management/commands/prerender.py index 28f4b21f15..efaaad80dc 100644 --- a/InvenTree/InvenTree/management/commands/prerender.py +++ b/InvenTree/InvenTree/management/commands/prerender.py @@ -2,15 +2,15 @@ Custom management command to prerender files """ -from django.core.management.base import BaseCommand +import os + from django.conf import settings +from django.core.management.base import BaseCommand +from django.http.request import HttpRequest from django.template.loader import render_to_string from django.utils.module_loading import import_string -from django.http.request import HttpRequest from django.utils.translation import override as lang_over -import os - def render_file(file_name, source, target, locales, ctx): """ renders a file into all provided locales """ diff --git a/InvenTree/InvenTree/management/commands/rebuild_thumbnails.py b/InvenTree/InvenTree/management/commands/rebuild_thumbnails.py index d065516835..3d684df06d 100644 --- a/InvenTree/InvenTree/management/commands/rebuild_thumbnails.py +++ b/InvenTree/InvenTree/management/commands/rebuild_thumbnails.py @@ -4,19 +4,18 @@ Custom management command to rebuild thumbnail images - May be required after importing a new dataset, for example """ -import os import logging +import os + +from django.conf import settings +from django.core.management.base import BaseCommand +from django.db.utils import OperationalError, ProgrammingError from PIL import UnidentifiedImageError -from django.core.management.base import BaseCommand -from django.conf import settings -from django.db.utils import OperationalError, ProgrammingError - from company.models import Company from part.models import Part - logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/management/commands/remove_mfa.py b/InvenTree/InvenTree/management/commands/remove_mfa.py index 8c84920cc3..53266348e2 100644 --- a/InvenTree/InvenTree/management/commands/remove_mfa.py +++ b/InvenTree/InvenTree/management/commands/remove_mfa.py @@ -2,8 +2,8 @@ Custom management command to remove MFA for a user """ -from django.core.management.base import BaseCommand from django.contrib.auth import get_user_model +from django.core.management.base import BaseCommand class Command(BaseCommand): diff --git a/InvenTree/InvenTree/management/commands/wait_for_db.py b/InvenTree/InvenTree/management/commands/wait_for_db.py index b9fa4e5025..ebd6999f7f 100644 --- a/InvenTree/InvenTree/management/commands/wait_for_db.py +++ b/InvenTree/InvenTree/management/commands/wait_for_db.py @@ -2,13 +2,12 @@ Custom management command, wait for the database to be ready! """ -from django.core.management.base import BaseCommand - -from django.db import connection -from django.db.utils import OperationalError, ImproperlyConfigured - import time +from django.core.management.base import BaseCommand +from django.db import connection +from django.db.utils import ImproperlyConfigured, OperationalError + class Command(BaseCommand): """ diff --git a/InvenTree/InvenTree/metadata.py b/InvenTree/InvenTree/metadata.py index 85c5a4c8cc..e2d42bb539 100644 --- a/InvenTree/InvenTree/metadata.py +++ b/InvenTree/InvenTree/metadata.py @@ -1,14 +1,12 @@ import logging from rest_framework import serializers +from rest_framework.fields import empty from rest_framework.metadata import SimpleMetadata from rest_framework.utils import model_meta -from rest_framework.fields import empty - -from InvenTree.helpers import str2bool import users.models - +from InvenTree.helpers import str2bool logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/middleware.py b/InvenTree/InvenTree/middleware.py index 5e122d4689..aaf13f7623 100644 --- a/InvenTree/InvenTree/middleware.py +++ b/InvenTree/InvenTree/middleware.py @@ -1,20 +1,19 @@ # -*- coding: utf-8 -*- +import logging + from django.conf import settings from django.contrib.auth.middleware import PersistentRemoteUserMiddleware from django.http import HttpResponse from django.shortcuts import redirect -from django.urls import reverse_lazy, Resolver404 -from django.urls import include, re_path - -import logging +from django.urls import Resolver404, include, re_path, reverse_lazy +from allauth_2fa.middleware import (AllauthTwoFactorMiddleware, + BaseRequire2FAMiddleware) from rest_framework.authtoken.models import Token -from allauth_2fa.middleware import BaseRequire2FAMiddleware, AllauthTwoFactorMiddleware -from InvenTree.urls import frontendpatterns from common.models import InvenTreeSetting - +from InvenTree.urls import frontendpatterns logger = logging.getLogger("inventree") diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index 73b2bf4572..aba8b36763 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -2,27 +2,25 @@ Generic models which provide extra functionality over base Django model types. """ -import re -import os import logging +import os +import re -from django.db import models from django.conf import settings from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType -from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError - +from django.db import models from django.db.models.signals import pre_delete from django.dispatch import receiver +from django.utils.translation import gettext_lazy as _ -from mptt.models import MPTTModel, TreeForeignKey from mptt.exceptions import InvalidMove +from mptt.models import MPTTModel, TreeForeignKey from InvenTree.fields import InvenTreeURLField from InvenTree.validators import validate_tree_name - logger = logging.getLogger('inventree') diff --git a/InvenTree/InvenTree/serializers.py b/InvenTree/InvenTree/serializers.py index e16a4f1ba7..e91bcab484 100644 --- a/InvenTree/InvenTree/serializers.py +++ b/InvenTree/InvenTree/serializers.py @@ -3,27 +3,24 @@ Serializers used in various InvenTree apps """ import os -import tablib - -from decimal import Decimal - from collections import OrderedDict +from decimal import Decimal from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ValidationError as DjangoValidationError -from django.utils.translation import gettext_lazy as _ from django.db import models +from django.utils.translation import gettext_lazy as _ +import tablib from djmoney.contrib.django_rest_framework.fields import MoneyField from djmoney.money import Money from djmoney.utils import MONEY_CLASSES, get_currency_field_name - from rest_framework import serializers -from rest_framework.utils import model_meta -from rest_framework.fields import empty from rest_framework.exceptions import ValidationError +from rest_framework.fields import empty from rest_framework.serializers import DecimalField +from rest_framework.utils import model_meta from .models import extract_int diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 5c6bca4dea..a1259c7a5d 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -12,7 +12,6 @@ database setup in this file. """ import logging - import os import random import socket @@ -20,13 +19,13 @@ import string import sys from datetime import datetime -import moneyed - -import yaml -from django.utils.translation import gettext_lazy as _ +import django.conf.locale from django.contrib.messages import constants as messages from django.core.files.storage import default_storage -import django.conf.locale +from django.utils.translation import gettext_lazy as _ + +import moneyed +import yaml from .config import get_base_dir, get_config_file, get_plugin_file, get_setting @@ -453,10 +452,8 @@ db_options = db_config.get("OPTIONS", db_config.get("options", {})) # Specific options for postgres backend if "postgres" in db_engine: # pragma: no cover - from psycopg2.extensions import ( - ISOLATION_LEVEL_READ_COMMITTED, - ISOLATION_LEVEL_SERIALIZABLE, - ) + from psycopg2.extensions import (ISOLATION_LEVEL_READ_COMMITTED, + ISOLATION_LEVEL_SERIALIZABLE) # Connection timeout if "connect_timeout" not in db_options: diff --git a/InvenTree/InvenTree/status.py b/InvenTree/InvenTree/status.py index 39b0afc57d..9ea57024d8 100644 --- a/InvenTree/InvenTree/status.py +++ b/InvenTree/InvenTree/status.py @@ -3,20 +3,18 @@ Provides system status functionality checks. """ # -*- coding: utf-8 -*- -from django.utils.translation import gettext_lazy as _ -from django.utils import timezone - import logging from datetime import timedelta +from django.conf import settings +from django.utils import timezone +from django.utils.translation import gettext_lazy as _ + from django_q.models import Success from django_q.monitor import Stat -from django.conf import settings - import InvenTree.ready - logger = logging.getLogger("inventree") diff --git a/InvenTree/InvenTree/tasks.py b/InvenTree/InvenTree/tasks.py index 77f55df271..e118c607fb 100644 --- a/InvenTree/InvenTree/tasks.py +++ b/InvenTree/InvenTree/tasks.py @@ -1,17 +1,16 @@ -import re import json -import warnings -import requests import logging - +import re +import warnings from datetime import timedelta -from django.utils import timezone +from django.conf import settings +from django.core import mail as django_mail from django.core.exceptions import AppRegistryNotReady from django.db.utils import OperationalError, ProgrammingError -from django.core import mail as django_mail -from django.conf import settings +from django.utils import timezone +import requests logger = logging.getLogger("inventree") @@ -72,9 +71,10 @@ def offload_task(taskname, *args, force_sync=False, **kwargs): """ try: + import importlib + from django_q.tasks import AsyncTask - import importlib from InvenTree.status import is_worker_running except AppRegistryNotReady: # pragma: no cover logger.warning(f"Could not offload task '{taskname}' - app registry not ready") @@ -254,9 +254,10 @@ def update_exchange_rates(): """ try: - from InvenTree.exchange import InvenTreeExchange from djmoney.contrib.exchange.models import ExchangeBackend, Rate + from common.settings import currency_code_default, currency_codes + from InvenTree.exchange import InvenTreeExchange except AppRegistryNotReady: # pragma: no cover # Apps not yet loaded! logger.info("Could not perform 'update_exchange_rates' - App registry not ready") diff --git a/InvenTree/InvenTree/test_api.py b/InvenTree/InvenTree/test_api.py index f55dfbcda2..b01c939d1c 100644 --- a/InvenTree/InvenTree/test_api.py +++ b/InvenTree/InvenTree/test_api.py @@ -1,20 +1,17 @@ """ Low level tests for the InvenTree API """ -from rest_framework import status - -from django.test import TestCase +from base64 import b64encode from django.contrib.auth import get_user_model from django.contrib.auth.models import Group - +from django.test import TestCase from django.urls import reverse +from rest_framework import status + from InvenTree.api_tester import InvenTreeAPITestCase - from users.models import RuleSet -from base64 import b64encode - class HTMLAPITests(TestCase): """ diff --git a/InvenTree/InvenTree/test_middleware.py b/InvenTree/InvenTree/test_middleware.py index 865e285783..0e86ec6a0f 100644 --- a/InvenTree/InvenTree/test_middleware.py +++ b/InvenTree/InvenTree/test_middleware.py @@ -1,8 +1,7 @@ """Tests for middleware functions""" -from django.test import TestCase - from django.contrib.auth import get_user_model +from django.test import TestCase from django.urls import reverse diff --git a/InvenTree/InvenTree/test_tasks.py b/InvenTree/InvenTree/test_tasks.py index c8497e2241..1b04e7da5b 100644 --- a/InvenTree/InvenTree/test_tasks.py +++ b/InvenTree/InvenTree/test_tasks.py @@ -4,16 +4,15 @@ Unit tests for task management from datetime import timedelta -from django.utils import timezone from django.test import TestCase -from django_q.models import Schedule +from django.utils import timezone +from django_q.models import Schedule from error_report.models import Error import InvenTree.tasks from common.models import InvenTreeSetting - threshold = timezone.now() - timedelta(days=30) threshold_low = threshold - timedelta(days=1) diff --git a/InvenTree/InvenTree/test_urls.py b/InvenTree/InvenTree/test_urls.py index 8b55d4e042..7f41f6e9fe 100644 --- a/InvenTree/InvenTree/test_urls.py +++ b/InvenTree/InvenTree/test_urls.py @@ -2,14 +2,13 @@ Validate that all URLs specified in template files are correct. """ -from django.test import TestCase -from django.urls import reverse - import os import re - from pathlib import Path +from django.test import TestCase +from django.urls import reverse + class URLTest(TestCase): diff --git a/InvenTree/InvenTree/test_views.py b/InvenTree/InvenTree/test_views.py index 0a145ec508..509eea142e 100644 --- a/InvenTree/InvenTree/test_views.py +++ b/InvenTree/InvenTree/test_views.py @@ -2,12 +2,12 @@ Unit tests for the main web views """ -import re import os +import re +from django.contrib.auth import get_user_model from django.test import TestCase from django.urls import reverse -from django.contrib.auth import get_user_model class ViewTests(TestCase): diff --git a/InvenTree/InvenTree/tests.py b/InvenTree/InvenTree/tests.py index 26b50a0eca..fe13d75562 100644 --- a/InvenTree/InvenTree/tests.py +++ b/InvenTree/InvenTree/tests.py @@ -1,33 +1,26 @@ import json import os import time - +from decimal import Decimal from unittest import mock -from django.test import TestCase, override_settings import django.core.exceptions as django_exceptions -from django.core.exceptions import ValidationError -from django.contrib.auth import get_user_model from django.conf import settings +from django.contrib.auth import get_user_model +from django.core.exceptions import ValidationError +from django.test import TestCase, override_settings -from djmoney.money import Money -from djmoney.contrib.exchange.models import Rate, convert_money from djmoney.contrib.exchange.exceptions import MissingRate - -from .validators import validate_overage, validate_part_name -from . import helpers -from . import version -from . import status -from . import ready -from . import config - -from decimal import Decimal +from djmoney.contrib.exchange.models import Rate, convert_money +from djmoney.money import Money import InvenTree.tasks - -from stock.models import StockLocation -from common.settings import currency_codes from common.models import InvenTreeSetting +from common.settings import currency_codes +from stock.models import StockLocation + +from . import config, helpers, ready, status, version +from .validators import validate_overage, validate_part_name class ValidatorTest(TestCase): diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index ab761c611d..c3f5b87169 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -4,47 +4,41 @@ Top-level URL lookup for InvenTree application. Passes URL lookup downstream to each app as required. """ -from django.urls import include, path, re_path -from django.contrib import admin - -from company.urls import company_urls -from company.urls import manufacturer_part_urls -from company.urls import supplier_part_urls - -from common.urls import common_urls -from part.urls import part_urls -from stock.urls import stock_urls -from build.urls import build_urls -from order.urls import order_urls -from plugin.urls import get_plugin_urls - -from common.api import common_api_urls, settings_api_urls -from part.api import part_api_urls, bom_api_urls -from company.api import company_api_urls -from stock.api import stock_api_urls -from build.api import build_api_urls -from order.api import order_api_urls -from label.api import label_api_urls -from report.api import report_api_urls -from plugin.api import plugin_api_urls -from users.api import user_urls - from django.conf import settings from django.conf.urls.static import static - +from django.contrib import admin +from django.urls import include, path, re_path from django.views.generic.base import RedirectView + from rest_framework.documentation import include_docs_urls -from .views import auth_request -from .views import IndexView, SearchView, DatabaseStatsView -from .views import SettingsView, EditUserView, SetPasswordView, CustomEmailView, CustomConnectionsView, CustomPasswordResetFromKeyView -from .views import CustomSessionDeleteView, CustomSessionDeleteOtherView -from .views import CurrencyRefreshView -from .views import AppearanceSelectView, SettingCategorySelectView -from .views import DynamicJsView -from .views import NotificationsView +from build.api import build_api_urls +from build.urls import build_urls +from common.api import common_api_urls, settings_api_urls +from common.urls import common_urls +from company.api import company_api_urls +from company.urls import (company_urls, manufacturer_part_urls, + supplier_part_urls) +from label.api import label_api_urls +from order.api import order_api_urls +from order.urls import order_urls +from part.api import bom_api_urls, part_api_urls +from part.urls import part_urls +from plugin.api import plugin_api_urls +from plugin.urls import get_plugin_urls +from report.api import report_api_urls +from stock.api import stock_api_urls +from stock.urls import stock_urls +from users.api import user_urls from .api import InfoView, NotFoundView +from .views import (AppearanceSelectView, CurrencyRefreshView, + CustomConnectionsView, CustomEmailView, + CustomPasswordResetFromKeyView, + CustomSessionDeleteOtherView, CustomSessionDeleteView, + DatabaseStatsView, DynamicJsView, EditUserView, IndexView, + NotificationsView, SearchView, SetPasswordView, + SettingCategorySelectView, SettingsView, auth_request) admin.site.site_header = "InvenTree Admin" diff --git a/InvenTree/InvenTree/validators.py b/InvenTree/InvenTree/validators.py index 6bb2c1b350..8a23eae39b 100644 --- a/InvenTree/InvenTree/validators.py +++ b/InvenTree/InvenTree/validators.py @@ -2,19 +2,17 @@ Custom field validators for InvenTree """ +import re from decimal import Decimal, InvalidOperation from django.conf import settings -from django.core.exceptions import ValidationError +from django.core.exceptions import FieldDoesNotExist, ValidationError from django.utils.translation import gettext_lazy as _ -from django.core.exceptions import FieldDoesNotExist from moneyed import CURRENCIES import common.models -import re - def validate_currency_code(code): """ diff --git a/InvenTree/InvenTree/version.py b/InvenTree/InvenTree/version.py index 4663b6a111..7d9cbad102 100644 --- a/InvenTree/InvenTree/version.py +++ b/InvenTree/InvenTree/version.py @@ -3,12 +3,12 @@ Version information for InvenTree. Provides information on the current InvenTree version """ -import subprocess -import django import re +import subprocess + +import django import common.models - from InvenTree.api_version import INVENTREE_API_VERSION # InvenTree software version diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 5be5fa3519..b29ea7cd44 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -5,39 +5,38 @@ In particular these views provide base functionality for rendering Django forms as JSON objects and passing them to modal forms (using jQuery / bootstrap). """ -import os import json +import os -from django.utils.translation import gettext_lazy as _ +from django.conf import settings +from django.contrib.auth.mixins import (LoginRequiredMixin, + PermissionRequiredMixin) +from django.http import HttpResponse, HttpResponseRedirect, JsonResponse +from django.shortcuts import redirect from django.template.loader import render_to_string -from django.http import HttpResponse, JsonResponse, HttpResponseRedirect from django.urls import reverse_lazy from django.utils.timezone import now -from django.shortcuts import redirect -from django.conf import settings - -from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin - +from django.utils.translation import gettext_lazy as _ from django.views import View -from django.views.generic import ListView, DetailView, CreateView, FormView, DeleteView, UpdateView +from django.views.generic import (CreateView, DeleteView, DetailView, FormView, + ListView, UpdateView) from django.views.generic.base import RedirectView, TemplateView -from djmoney.contrib.exchange.models import ExchangeBackend, Rate from allauth.account.forms import AddEmailForm -from allauth.socialaccount.forms import DisconnectForm from allauth.account.models import EmailAddress from allauth.account.views import EmailView, PasswordResetFromKeyView +from allauth.socialaccount.forms import DisconnectForm from allauth.socialaccount.views import ConnectionsView -from user_sessions.views import SessionDeleteView, SessionDeleteOtherView +from djmoney.contrib.exchange.models import ExchangeBackend, Rate +from user_sessions.views import SessionDeleteOtherView, SessionDeleteView +from common.models import ColorTheme, InvenTreeSetting from common.settings import currency_code_default, currency_codes - from part.models import PartCategory -from common.models import InvenTreeSetting, ColorTheme -from users.models import check_user_role, RuleSet +from users.models import RuleSet, check_user_role -from .forms import DeleteForm, EditUserForm, SetPasswordForm -from .forms import SettingCategorySelectForm +from .forms import (DeleteForm, EditUserForm, SetPasswordForm, + SettingCategorySelectForm) from .helpers import str2bool diff --git a/InvenTree/common/api.py b/InvenTree/common/api.py index 646025ab2a..d805626da7 100644 --- a/InvenTree/common/api.py +++ b/InvenTree/common/api.py @@ -5,18 +5,16 @@ Provides a JSON API for common components. import json from django.http.response import HttpResponse +from django.urls import include, path, re_path from django.utils.decorators import method_decorator -from django.urls import path from django.views.decorators.csrf import csrf_exempt -from django.urls import include, re_path -from rest_framework.views import APIView -from rest_framework.response import Response -from rest_framework.exceptions import NotAcceptable, NotFound from django_filters.rest_framework import DjangoFilterBackend -from rest_framework import filters, generics, permissions -from rest_framework import serializers from django_q.tasks import async_task +from rest_framework import filters, generics, permissions, serializers +from rest_framework.exceptions import NotAcceptable, NotFound +from rest_framework.response import Response +from rest_framework.views import APIView import common.models import common.serializers diff --git a/InvenTree/common/apps.py b/InvenTree/common/apps.py index a2253c1066..629b5179e6 100644 --- a/InvenTree/common/apps.py +++ b/InvenTree/common/apps.py @@ -4,7 +4,6 @@ import logging from django.apps import AppConfig - logger = logging.getLogger('inventree') diff --git a/InvenTree/common/files.py b/InvenTree/common/files.py index e6d26be10f..704d02a681 100644 --- a/InvenTree/common/files.py +++ b/InvenTree/common/files.py @@ -2,12 +2,13 @@ Files management tools. """ -from rapidfuzz import fuzz -import tablib import os -from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError +from django.utils.translation import gettext_lazy as _ + +import tablib +from rapidfuzz import fuzz class FileManager: diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index aa54c814ad..79c449002e 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -3,45 +3,41 @@ Common database model definitions. These models are 'generic' and do not fit a particular business logic object. """ -import os +import base64 import decimal -import math -import uuid +import hashlib import hmac import json -import hashlib -import base64 -from secrets import compare_digest +import logging +import math +import os +import uuid from datetime import datetime, timedelta +from secrets import compare_digest from django.apps import apps -from django.db import models, transaction -from django.db.utils import IntegrityError, OperationalError from django.conf import settings -from django.contrib.auth.models import User, Group +from django.contrib.auth.models import Group, User from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.contrib.humanize.templatetags.humanize import naturaltime +from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator, URLValidator +from django.db import models, transaction +from django.db.utils import IntegrityError, OperationalError from django.urls import reverse from django.utils.timezone import now +from django.utils.translation import gettext_lazy as _ -from djmoney.settings import CURRENCY_CHOICES -from djmoney.contrib.exchange.models import convert_money from djmoney.contrib.exchange.exceptions import MissingRate - +from djmoney.contrib.exchange.models import convert_money +from djmoney.settings import CURRENCY_CHOICES from rest_framework.exceptions import PermissionDenied -from django.utils.translation import gettext_lazy as _ -from django.core.validators import MinValueValidator, URLValidator -from django.core.exceptions import ValidationError - -import InvenTree.helpers import InvenTree.fields +import InvenTree.helpers import InvenTree.validators -import logging - - logger = logging.getLogger('inventree') diff --git a/InvenTree/common/notifications.py b/InvenTree/common/notifications.py index 7f6aece282..c2e4f2d6aa 100644 --- a/InvenTree/common/notifications.py +++ b/InvenTree/common/notifications.py @@ -1,13 +1,12 @@ import logging from datetime import timedelta +from common.models import NotificationEntry, NotificationMessage from InvenTree.helpers import inheritors from InvenTree.ready import isImportingData -from common.models import NotificationEntry, NotificationMessage from plugin import registry from plugin.models import NotificationUserSetting - logger = logging.getLogger('inventree') diff --git a/InvenTree/common/serializers.py b/InvenTree/common/serializers.py index 7d0c8cc219..c91ad0f45d 100644 --- a/InvenTree/common/serializers.py +++ b/InvenTree/common/serializers.py @@ -2,12 +2,12 @@ JSON serializers for common components """ -from InvenTree.serializers import InvenTreeModelSerializer -from InvenTree.helpers import get_objectreference - from rest_framework import serializers -from common.models import InvenTreeSetting, InvenTreeUserSetting, NotificationMessage +from common.models import (InvenTreeSetting, InvenTreeUserSetting, + NotificationMessage) +from InvenTree.helpers import get_objectreference +from InvenTree.serializers import InvenTreeModelSerializer class SettingsSerializer(InvenTreeModelSerializer): diff --git a/InvenTree/common/settings.py b/InvenTree/common/settings.py index 361284d831..f010e65567 100644 --- a/InvenTree/common/settings.py +++ b/InvenTree/common/settings.py @@ -2,15 +2,17 @@ User-configurable settings for the common app """ -from moneyed import CURRENCIES from django.conf import settings +from moneyed import CURRENCIES + def currency_code_default(): """ Returns the default currency code (or USD if not specified) """ from django.db.utils import ProgrammingError + from common.models import InvenTreeSetting try: diff --git a/InvenTree/common/tasks.py b/InvenTree/common/tasks.py index db63dc9c17..7fdd57999a 100644 --- a/InvenTree/common/tasks.py +++ b/InvenTree/common/tasks.py @@ -1,9 +1,8 @@ import logging -from datetime import timedelta, datetime +from datetime import datetime, timedelta from django.core.exceptions import AppRegistryNotReady - logger = logging.getLogger('inventree') diff --git a/InvenTree/common/test_notifications.py b/InvenTree/common/test_notifications.py index e16e28f339..e2acfb5c36 100644 --- a/InvenTree/common/test_notifications.py +++ b/InvenTree/common/test_notifications.py @@ -1,7 +1,8 @@ -from common.notifications import NotificationMethod, SingleNotificationMethod, BulkNotificationMethod, storage -from plugin.models import NotificationUserSetting -from part.test_part import BaseNotificationIntegrationTest import plugin.templatetags.plugin_extras as plugin_tags +from common.notifications import (BulkNotificationMethod, NotificationMethod, + SingleNotificationMethod, storage) +from part.test_part import BaseNotificationIntegrationTest +from plugin.models import NotificationUserSetting class BaseNotificationTests(BaseNotificationIntegrationTest): diff --git a/InvenTree/common/test_tasks.py b/InvenTree/common/test_tasks.py index c28a1d19fe..0f19720b95 100644 --- a/InvenTree/common/test_tasks.py +++ b/InvenTree/common/test_tasks.py @@ -2,9 +2,10 @@ from django.test import TestCase from common.models import NotificationEntry -from . import tasks as common_tasks from InvenTree.tasks import offload_task +from . import tasks as common_tasks + class TaskTest(TestCase): """ diff --git a/InvenTree/common/tests.py b/InvenTree/common/tests.py index 1f32b8e941..5820a6cda8 100644 --- a/InvenTree/common/tests.py +++ b/InvenTree/common/tests.py @@ -1,19 +1,20 @@ -from http import HTTPStatus import json from datetime import timedelta +from http import HTTPStatus -from django.test import TestCase, Client from django.contrib.auth import get_user_model +from django.test import Client, TestCase from django.urls import reverse from InvenTree.api_tester import InvenTreeAPITestCase from InvenTree.helpers import str2bool -from plugin.models import NotificationUserSetting, PluginConfig from plugin import registry +from plugin.models import NotificationUserSetting, PluginConfig -from .models import InvenTreeSetting, InvenTreeUserSetting, WebhookEndpoint, WebhookMessage, NotificationEntry, ColorTheme from .api import WebhookView +from .models import (ColorTheme, InvenTreeSetting, InvenTreeUserSetting, + NotificationEntry, WebhookEndpoint, WebhookMessage) CONTENT_TYPE_JSON = 'application/json' diff --git a/InvenTree/common/views.py b/InvenTree/common/views.py index f9a6a4f82a..ee5a02a288 100644 --- a/InvenTree/common/views.py +++ b/InvenTree/common/views.py @@ -4,12 +4,12 @@ Django views for interacting with common models import os -from django.utils.translation import gettext_lazy as _ from django.conf import settings from django.core.files.storage import FileSystemStorage +from django.utils.translation import gettext_lazy as _ -from formtools.wizard.views import SessionWizardView from crispy_forms.helper import FormHelper +from formtools.wizard.views import SessionWizardView from InvenTree.views import AjaxView diff --git a/InvenTree/company/admin.py b/InvenTree/company/admin.py index ce5f5945b6..d3bf75dab3 100644 --- a/InvenTree/company/admin.py +++ b/InvenTree/company/admin.py @@ -1,17 +1,16 @@ from django.contrib import admin -from import_export.admin import ImportExportModelAdmin -from import_export.resources import ModelResource -from import_export.fields import Field import import_export.widgets as widgets - -from .models import Company -from .models import SupplierPart -from .models import SupplierPriceBreak -from .models import ManufacturerPart, ManufacturerPartAttachment, ManufacturerPartParameter +from import_export.admin import ImportExportModelAdmin +from import_export.fields import Field +from import_export.resources import ModelResource from part.models import Part +from .models import (Company, ManufacturerPart, ManufacturerPartAttachment, + ManufacturerPartParameter, SupplierPart, + SupplierPriceBreak) + class CompanyResource(ModelResource): """ Class for managing Company data import/export """ diff --git a/InvenTree/company/api.py b/InvenTree/company/api.py index 22c5c4b207..b63cd65c83 100644 --- a/InvenTree/company/api.py +++ b/InvenTree/company/api.py @@ -2,25 +2,24 @@ Provides a JSON API for the Company app """ -from django_filters.rest_framework import DjangoFilterBackend -from django_filters import rest_framework as rest_filters - -from rest_framework import filters -from rest_framework import generics - -from django.urls import include, re_path from django.db.models import Q +from django.urls import include, re_path + +from django_filters import rest_framework as rest_filters +from django_filters.rest_framework import DjangoFilterBackend +from rest_framework import filters, generics -from InvenTree.helpers import str2bool from InvenTree.api import AttachmentMixin +from InvenTree.helpers import str2bool -from .models import Company -from .models import ManufacturerPart, ManufacturerPartAttachment, ManufacturerPartParameter -from .models import SupplierPart, SupplierPriceBreak - -from .serializers import CompanySerializer -from .serializers import ManufacturerPartSerializer, ManufacturerPartAttachmentSerializer, ManufacturerPartParameterSerializer -from .serializers import SupplierPartSerializer, SupplierPriceBreakSerializer +from .models import (Company, ManufacturerPart, ManufacturerPartAttachment, + ManufacturerPartParameter, SupplierPart, + SupplierPriceBreak) +from .serializers import (CompanySerializer, + ManufacturerPartAttachmentSerializer, + ManufacturerPartParameterSerializer, + ManufacturerPartSerializer, SupplierPartSerializer, + SupplierPriceBreakSerializer) class CompanyList(generics.ListCreateAPIView): diff --git a/InvenTree/company/forms.py b/InvenTree/company/forms.py index eaead82151..bf15038898 100644 --- a/InvenTree/company/forms.py +++ b/InvenTree/company/forms.py @@ -2,14 +2,13 @@ Django Forms for interacting with Company app """ -from InvenTree.forms import HelperForm -from InvenTree.fields import RoundingDecimalFormField - -from django.utils.translation import gettext_lazy as _ import django.forms +from django.utils.translation import gettext_lazy as _ -from .models import Company -from .models import SupplierPriceBreak +from InvenTree.fields import RoundingDecimalFormField +from InvenTree.forms import HelperForm + +from .models import Company, SupplierPriceBreak class CompanyImageDownloadForm(HelperForm): diff --git a/InvenTree/company/models.py b/InvenTree/company/models.py index e33580abff..1feac56f67 100644 --- a/InvenTree/company/models.py +++ b/InvenTree/company/models.py @@ -4,32 +4,26 @@ Company database model definitions import os -from django.utils.translation import gettext_lazy as _ -from django.core.validators import MinValueValidator -from django.core.exceptions import ValidationError - -from django.db import models -from django.db.models import Sum, Q, UniqueConstraint - from django.apps import apps +from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator +from django.db import models +from django.db.models import Q, Sum, UniqueConstraint from django.urls import reverse - -from moneyed import CURRENCIES +from django.utils.translation import gettext_lazy as _ from markdownx.models import MarkdownxField - +from moneyed import CURRENCIES from stdimage.models import StdImageField -from InvenTree.helpers import getMediaUrl, getBlankImage, getBlankThumbnail -from InvenTree.fields import InvenTreeURLField -from InvenTree.models import InvenTreeAttachment -from InvenTree.status_codes import PurchaseOrderStatus - -import InvenTree.validators - import common.models import common.settings +import InvenTree.validators from common.settings import currency_code_default +from InvenTree.fields import InvenTreeURLField +from InvenTree.helpers import getBlankImage, getBlankThumbnail, getMediaUrl +from InvenTree.models import InvenTreeAttachment +from InvenTree.status_codes import PurchaseOrderStatus def rename_company_image(instance, filename): diff --git a/InvenTree/company/serializers.py b/InvenTree/company/serializers.py index 54eeb2c191..e0c34d077f 100644 --- a/InvenTree/company/serializers.py +++ b/InvenTree/company/serializers.py @@ -5,22 +5,19 @@ JSON serializers for Company app from django.utils.translation import gettext_lazy as _ from rest_framework import serializers - from sql_util.utils import SubqueryCount -from InvenTree.serializers import InvenTreeAttachmentSerializer -from InvenTree.serializers import InvenTreeDecimalField -from InvenTree.serializers import InvenTreeImageSerializerField -from InvenTree.serializers import InvenTreeModelSerializer -from InvenTree.serializers import InvenTreeMoneySerializer - +from common.settings import currency_code_default, currency_code_mappings +from InvenTree.serializers import (InvenTreeAttachmentSerializer, + InvenTreeDecimalField, + InvenTreeImageSerializerField, + InvenTreeModelSerializer, + InvenTreeMoneySerializer) from part.serializers import PartBriefSerializer -from .models import Company -from .models import ManufacturerPart, ManufacturerPartAttachment, ManufacturerPartParameter -from .models import SupplierPart, SupplierPriceBreak - -from common.settings import currency_code_default, currency_code_mappings +from .models import (Company, ManufacturerPart, ManufacturerPartAttachment, + ManufacturerPartParameter, SupplierPart, + SupplierPriceBreak) class CompanyBriefSerializer(InvenTreeModelSerializer): diff --git a/InvenTree/company/test_api.py b/InvenTree/company/test_api.py index a1272103df..e0b54130ff 100644 --- a/InvenTree/company/test_api.py +++ b/InvenTree/company/test_api.py @@ -1,6 +1,7 @@ -from rest_framework import status from django.urls import reverse +from rest_framework import status + from InvenTree.api_tester import InvenTreeAPITestCase from .models import Company diff --git a/InvenTree/company/test_views.py b/InvenTree/company/test_views.py index 29900236bf..a39e2be041 100644 --- a/InvenTree/company/test_views.py +++ b/InvenTree/company/test_views.py @@ -1,9 +1,9 @@ """ Unit tests for Company views (see views.py) """ -from django.test import TestCase -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse class CompanyViewTestBase(TestCase): diff --git a/InvenTree/company/tests.py b/InvenTree/company/tests.py index edc34e7f2d..008ac066b2 100644 --- a/InvenTree/company/tests.py +++ b/InvenTree/company/tests.py @@ -1,13 +1,14 @@ -from django.test import TestCase -from django.core.exceptions import ValidationError - import os from decimal import Decimal -from .models import Company, Contact, ManufacturerPart, SupplierPart -from .models import rename_company_image +from django.core.exceptions import ValidationError +from django.test import TestCase + from part.models import Part +from .models import (Company, Contact, ManufacturerPart, SupplierPart, + rename_company_image) + class CompanySimpleTest(TestCase): diff --git a/InvenTree/company/urls.py b/InvenTree/company/urls.py index 25ebdbb771..a7b9584c54 100644 --- a/InvenTree/company/urls.py +++ b/InvenTree/company/urls.py @@ -6,7 +6,6 @@ from django.urls import include, re_path from . import views - company_detail_urls = [ re_path(r'^thumb-download/', views.CompanyImageDownloadFromURL.as_view(), name='company-image-download'), diff --git a/InvenTree/company/views.py b/InvenTree/company/views.py index 03514b51b3..6a21d1e57a 100644 --- a/InvenTree/company/views.py +++ b/InvenTree/company/views.py @@ -2,26 +2,21 @@ Django views for interacting with Company app """ +import io + +from django.core.files.base import ContentFile +from django.urls import reverse from django.utils.translation import gettext_lazy as _ from django.views.generic import DetailView, ListView -from django.urls import reverse -from django.core.files.base import ContentFile - -from PIL import Image import requests -import io +from PIL import Image -from InvenTree.views import AjaxUpdateView -from InvenTree.views import InvenTreeRoleMixin - -from .models import Company -from .models import ManufacturerPart -from .models import SupplierPart +from InvenTree.views import AjaxUpdateView, InvenTreeRoleMixin +from plugin.views import InvenTreePluginViewMixin from .forms import CompanyImageDownloadForm - -from plugin.views import InvenTreePluginViewMixin +from .models import Company, ManufacturerPart, SupplierPart class CompanyIndex(InvenTreeRoleMixin, ListView): diff --git a/InvenTree/label/admin.py b/InvenTree/label/admin.py index 96e90363e0..112ac55a4b 100644 --- a/InvenTree/label/admin.py +++ b/InvenTree/label/admin.py @@ -1,6 +1,6 @@ from django.contrib import admin -from .models import StockItemLabel, StockLocationLabel, PartLabel +from .models import PartLabel, StockItemLabel, StockLocationLabel class LabelAdmin(admin.ModelAdmin): diff --git a/InvenTree/label/api.py b/InvenTree/label/api.py index 17aef828c0..5efbff518a 100644 --- a/InvenTree/label/api.py +++ b/InvenTree/label/api.py @@ -1,30 +1,27 @@ from io import BytesIO -from PIL import Image - -from django.utils.translation import gettext_lazy as _ from django.conf import settings -from django.urls import include, re_path -from django.core.exceptions import ValidationError, FieldError +from django.core.exceptions import FieldError, ValidationError from django.http import HttpResponse, JsonResponse +from django.urls import include, re_path +from django.utils.translation import gettext_lazy as _ from django_filters.rest_framework import DjangoFilterBackend - -from rest_framework import generics, filters +from PIL import Image +from rest_framework import filters, generics from rest_framework.response import Response +import common.models import InvenTree.helpers from InvenTree.tasks import offload_task -import common.models - -from plugin.registry import registry - -from stock.models import StockItem, StockLocation from part.models import Part from plugin.base.label import label as plugin_label +from plugin.registry import registry +from stock.models import StockItem, StockLocation -from .models import StockItemLabel, StockLocationLabel, PartLabel -from .serializers import StockItemLabelSerializer, StockLocationLabelSerializer, PartLabelSerializer +from .models import PartLabel, StockItemLabel, StockLocationLabel +from .serializers import (PartLabelSerializer, StockItemLabelSerializer, + StockLocationLabelSerializer) class LabelListView(generics.ListAPIView): diff --git a/InvenTree/label/apps.py b/InvenTree/label/apps.py index f2c3c4ada5..01c9fe1fdf 100644 --- a/InvenTree/label/apps.py +++ b/InvenTree/label/apps.py @@ -1,7 +1,7 @@ +import hashlib +import logging import os import shutil -import logging -import hashlib import warnings from django.apps import AppConfig @@ -10,7 +10,6 @@ from django.core.exceptions import AppRegistryNotReady from InvenTree.ready import canAppAccessDatabase - logger = logging.getLogger("inventree") diff --git a/InvenTree/label/models.py b/InvenTree/label/models.py index 7a52ed5d02..c7a38f09eb 100644 --- a/InvenTree/label/models.py +++ b/InvenTree/label/models.py @@ -2,28 +2,24 @@ Label printing models """ -import sys -import os -import logging import datetime +import logging +import os +import sys from django.conf import settings -from django.db import models -from django.urls import reverse +from django.core.exceptions import FieldError, ValidationError from django.core.validators import FileExtensionValidator, MinValueValidator -from django.core.exceptions import ValidationError, FieldError - -from django.template import Template, Context +from django.db import models +from django.template import Context, Template from django.template.loader import render_to_string - +from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from InvenTree.helpers import validateFilterString, normalize - import common.models -import stock.models import part.models - +import stock.models +from InvenTree.helpers import normalize, validateFilterString try: from django_weasyprint import WeasyTemplateResponseMixin diff --git a/InvenTree/label/serializers.py b/InvenTree/label/serializers.py index af6ae49e28..5428424572 100644 --- a/InvenTree/label/serializers.py +++ b/InvenTree/label/serializers.py @@ -1,7 +1,7 @@ -from InvenTree.serializers import InvenTreeModelSerializer -from InvenTree.serializers import InvenTreeAttachmentSerializerField +from InvenTree.serializers import (InvenTreeAttachmentSerializerField, + InvenTreeModelSerializer) -from .models import StockItemLabel, StockLocationLabel, PartLabel +from .models import PartLabel, StockItemLabel, StockLocationLabel class StockItemLabelSerializer(InvenTreeModelSerializer): diff --git a/InvenTree/label/tests.py b/InvenTree/label/tests.py index 5bf7ff3c7c..f94efafb84 100644 --- a/InvenTree/label/tests.py +++ b/InvenTree/label/tests.py @@ -2,18 +2,18 @@ import os -from django.conf import settings from django.apps import apps -from django.urls import reverse +from django.conf import settings from django.core.exceptions import ValidationError +from django.urls import reverse -from InvenTree.helpers import validateFilterString from InvenTree.api_tester import InvenTreeAPITestCase - -from .models import StockItemLabel, StockLocationLabel, PartLabel +from InvenTree.helpers import validateFilterString from part.models import Part from stock.models import StockItem +from .models import PartLabel, StockItemLabel, StockLocationLabel + class LabelTest(InvenTreeAPITestCase): diff --git a/InvenTree/order/admin.py b/InvenTree/order/admin.py index ac74a004e3..a46fe62532 100644 --- a/InvenTree/order/admin.py +++ b/InvenTree/order/admin.py @@ -1,14 +1,14 @@ from django.contrib import admin +import import_export.widgets as widgets from import_export.admin import ImportExportModelAdmin - from import_export.fields import Field from import_export.resources import ModelResource -import import_export.widgets as widgets -from .models import PurchaseOrder, PurchaseOrderLineItem, PurchaseOrderExtraLine -from .models import SalesOrder, SalesOrderLineItem, SalesOrderExtraLine -from .models import SalesOrderShipment, SalesOrderAllocation +from .models import (PurchaseOrder, PurchaseOrderExtraLine, + PurchaseOrderLineItem, SalesOrder, SalesOrderAllocation, + SalesOrderExtraLine, SalesOrderLineItem, + SalesOrderShipment) # region general classes diff --git a/InvenTree/order/api.py b/InvenTree/order/api.py index 2a9c3b99d2..e6e6767edb 100644 --- a/InvenTree/order/api.py +++ b/InvenTree/order/api.py @@ -2,29 +2,25 @@ JSON API for the Order app """ +from django.db.models import F, Q from django.urls import include, path, re_path -from django.db.models import Q, F from django_filters import rest_framework as rest_filters -from rest_framework import generics -from rest_framework import filters, status +from rest_framework import filters, generics, status from rest_framework.response import Response -from company.models import SupplierPart - -from InvenTree.filters import InvenTreeOrderingFilter -from InvenTree.helpers import str2bool, DownloadFile -from InvenTree.api import AttachmentMixin, APIDownloadMixin -from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus - -from order.admin import PurchaseOrderResource, PurchaseOrderLineItemResource -from order.admin import SalesOrderResource import order.models as models import order.serializers as serializers +from company.models import SupplierPart +from InvenTree.api import APIDownloadMixin, AttachmentMixin +from InvenTree.filters import InvenTreeOrderingFilter +from InvenTree.helpers import DownloadFile, str2bool +from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus +from order.admin import (PurchaseOrderLineItemResource, PurchaseOrderResource, + SalesOrderResource) from part.models import Part -from users.models import Owner - from plugin.serializers import MetadataSerializer +from users.models import Owner class GeneralExtraLineList: diff --git a/InvenTree/order/forms.py b/InvenTree/order/forms.py index 120d1e0923..2b06a92d00 100644 --- a/InvenTree/order/forms.py +++ b/InvenTree/order/forms.py @@ -5,11 +5,9 @@ Django Forms for interacting with Order objects from django import forms from django.utils.translation import gettext_lazy as _ -from InvenTree.fields import InvenTreeMoneyField - -from InvenTree.helpers import clean_decimal - from common.forms import MatchItemForm +from InvenTree.fields import InvenTreeMoneyField +from InvenTree.helpers import clean_decimal class OrderMatchItemForm(MatchItemForm): diff --git a/InvenTree/order/models.py b/InvenTree/order/models.py index f4688f3736..204130578f 100644 --- a/InvenTree/order/models.py +++ b/InvenTree/order/models.py @@ -5,42 +5,38 @@ Order model definitions # -*- coding: utf-8 -*- import os - from datetime import datetime from decimal import Decimal +from django.contrib.auth.models import User +from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator from django.db import models, transaction -from django.db.models import Q, F, Sum +from django.db.models import F, Q, Sum from django.db.models.functions import Coalesce from django.db.models.signals import post_save from django.dispatch.dispatcher import receiver - -from django.core.validators import MinValueValidator -from django.core.exceptions import ValidationError -from django.contrib.auth.models import User from django.urls import reverse from django.utils.translation import gettext_lazy as _ +from djmoney.contrib.exchange.models import convert_money +from djmoney.money import Money from markdownx.models import MarkdownxField from mptt.models import TreeForeignKey -from djmoney.contrib.exchange.models import convert_money -from djmoney.money import Money +import InvenTree.helpers from common.settings import currency_code_default - -from users import models as UserModels -from part import models as PartModels -from stock import models as stock_models from company.models import Company, SupplierPart - +from InvenTree.fields import InvenTreeModelMoneyField, RoundingDecimalField +from InvenTree.helpers import decimal2string, getSetting, increment +from InvenTree.models import InvenTreeAttachment, ReferenceIndexingMixin +from InvenTree.status_codes import (PurchaseOrderStatus, SalesOrderStatus, + StockHistoryCode, StockStatus) +from part import models as PartModels from plugin.events import trigger_event from plugin.models import MetadataMixin - -import InvenTree.helpers -from InvenTree.fields import InvenTreeModelMoneyField, RoundingDecimalField -from InvenTree.helpers import decimal2string, increment, getSetting -from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus, StockStatus, StockHistoryCode -from InvenTree.models import InvenTreeAttachment, ReferenceIndexingMixin +from stock import models as stock_models +from users import models as UserModels def get_next_po_number(): diff --git a/InvenTree/order/serializers.py b/InvenTree/order/serializers.py index 47eacc40a0..379b9d5fc4 100644 --- a/InvenTree/order/serializers.py +++ b/InvenTree/order/serializers.py @@ -4,36 +4,30 @@ JSON serializers for the Order API from decimal import Decimal -from django.utils.translation import gettext_lazy as _ - from django.core.exceptions import ValidationError as DjangoValidationError from django.db import models, transaction -from django.db.models import Case, When, Value -from django.db.models import BooleanField, ExpressionWrapper, F, Q +from django.db.models import (BooleanField, Case, ExpressionWrapper, F, Q, + Value, When) +from django.utils.translation import gettext_lazy as _ from rest_framework import serializers from rest_framework.serializers import ValidationError - from sql_util.utils import SubqueryCount -from common.settings import currency_code_mappings -from company.serializers import CompanyBriefSerializer, SupplierPartSerializer - -from InvenTree.serializers import InvenTreeAttachmentSerializer -from InvenTree.helpers import normalize, extract_serial_numbers -from InvenTree.serializers import InvenTreeModelSerializer -from InvenTree.serializers import InvenTreeDecimalField -from InvenTree.serializers import InvenTreeMoneySerializer -from InvenTree.serializers import ReferenceIndexingSerializerMixin -from InvenTree.status_codes import StockStatus, PurchaseOrderStatus, SalesOrderStatus - import order.models - -from part.serializers import PartBriefSerializer - import stock.models import stock.serializers - +from common.settings import currency_code_mappings +from company.serializers import CompanyBriefSerializer, SupplierPartSerializer +from InvenTree.helpers import extract_serial_numbers, normalize +from InvenTree.serializers import (InvenTreeAttachmentSerializer, + InvenTreeDecimalField, + InvenTreeModelSerializer, + InvenTreeMoneySerializer, + ReferenceIndexingSerializerMixin) +from InvenTree.status_codes import (PurchaseOrderStatus, SalesOrderStatus, + StockStatus) +from part.serializers import PartBriefSerializer from users.serializers import OwnerSerializer diff --git a/InvenTree/order/test_api.py b/InvenTree/order/test_api.py index 6549b1d89d..ba95a243f0 100644 --- a/InvenTree/order/test_api.py +++ b/InvenTree/order/test_api.py @@ -3,20 +3,17 @@ Tests for the Order API """ import io - from datetime import datetime, timedelta -from rest_framework import status - from django.urls import reverse -from InvenTree.api_tester import InvenTreeAPITestCase -from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus - -from part.models import Part -from stock.models import StockItem +from rest_framework import status import order.models as models +from InvenTree.api_tester import InvenTreeAPITestCase +from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus +from part.models import Part +from stock.models import StockItem class OrderTest(InvenTreeAPITestCase): diff --git a/InvenTree/order/test_sales_order.py b/InvenTree/order/test_sales_order.py index cbd572e24d..b357b14f55 100644 --- a/InvenTree/order/test_sales_order.py +++ b/InvenTree/order/test_sales_order.py @@ -1,21 +1,16 @@ # -*- coding: utf-8 -*- -from django.test import TestCase - -from django.core.exceptions import ValidationError - from datetime import datetime, timedelta -from company.models import Company - -from InvenTree import status_codes as status +from django.core.exceptions import ValidationError +from django.test import TestCase from common.models import InvenTreeSetting - -from order.models import SalesOrder, SalesOrderLineItem, SalesOrderAllocation, SalesOrderShipment - +from company.models import Company +from InvenTree import status_codes as status +from order.models import (SalesOrder, SalesOrderAllocation, SalesOrderLineItem, + SalesOrderShipment) from part.models import Part - from stock.models import StockItem diff --git a/InvenTree/order/test_views.py b/InvenTree/order/test_views.py index e38ea7ecef..b1025959f1 100644 --- a/InvenTree/order/test_views.py +++ b/InvenTree/order/test_views.py @@ -1,9 +1,9 @@ """ Unit tests for Order views (see views.py) """ -from django.test import TestCase -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse class OrderViewTestCase(TestCase): diff --git a/InvenTree/order/tests.py b/InvenTree/order/tests.py index b68e0c3ff1..1c23be2829 100644 --- a/InvenTree/order/tests.py +++ b/InvenTree/order/tests.py @@ -2,15 +2,15 @@ from datetime import datetime, timedelta -from django.test import TestCase import django.core.exceptions as django_exceptions +from django.test import TestCase -from part.models import Part -from .models import PurchaseOrder, PurchaseOrderLineItem -from stock.models import StockLocation from company.models import SupplierPart - from InvenTree.status_codes import PurchaseOrderStatus +from part.models import Part +from stock.models import StockLocation + +from .models import PurchaseOrder, PurchaseOrderLineItem class OrderTest(TestCase): diff --git a/InvenTree/order/views.py b/InvenTree/order/views.py index 77b5741c3e..45b7402dc0 100644 --- a/InvenTree/order/views.py +++ b/InvenTree/order/views.py @@ -2,36 +2,32 @@ Django views for interacting with Order app """ -from django.db.utils import IntegrityError -from django.http.response import JsonResponse -from django.shortcuts import get_object_or_404 -from django.urls import reverse -from django.http import HttpResponseRedirect -from django.utils.translation import gettext_lazy as _ -from django.views.generic import DetailView, ListView -from django.forms import HiddenInput, IntegerField - import logging from decimal import Decimal, InvalidOperation -from .models import PurchaseOrder, PurchaseOrderLineItem -from .models import SalesOrder, SalesOrderLineItem -from .admin import PurchaseOrderLineItemResource, SalesOrderLineItemResource -from company.models import SupplierPart # ManufacturerPart -from part.models import Part +from django.db.utils import IntegrityError +from django.forms import HiddenInput, IntegerField +from django.http import HttpResponseRedirect +from django.http.response import JsonResponse +from django.shortcuts import get_object_or_404 +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ +from django.views.generic import DetailView, ListView -from common.forms import UploadFileForm, MatchFieldForm -from common.views import FileManagementFormView from common.files import FileManager - -from . import forms as order_forms -from part.views import PartPricing - +from common.forms import MatchFieldForm, UploadFileForm +from common.views import FileManagementFormView +from company.models import SupplierPart # ManufacturerPart from InvenTree.helpers import DownloadFile -from InvenTree.views import InvenTreeRoleMixin, AjaxView - +from InvenTree.views import AjaxView, InvenTreeRoleMixin +from part.models import Part +from part.views import PartPricing from plugin.views import InvenTreePluginViewMixin +from . import forms as order_forms +from .admin import PurchaseOrderLineItemResource, SalesOrderLineItemResource +from .models import (PurchaseOrder, PurchaseOrderLineItem, SalesOrder, + SalesOrderLineItem) logger = logging.getLogger("inventree") diff --git a/InvenTree/part/admin.py b/InvenTree/part/admin.py index 5fafc37fea..88064ff275 100644 --- a/InvenTree/part/admin.py +++ b/InvenTree/part/admin.py @@ -1,12 +1,12 @@ from django.contrib import admin +import import_export.widgets as widgets from import_export.admin import ImportExportModelAdmin from import_export.fields import Field from import_export.resources import ModelResource -import import_export.widgets as widgets -from company.models import SupplierPart import part.models as models +from company.models import SupplierPart from stock.models import StockLocation diff --git a/InvenTree/part/api.py b/InvenTree/part/api.py index de335087f4..e0fce0e06c 100644 --- a/InvenTree/part/api.py +++ b/InvenTree/part/api.py @@ -3,53 +3,41 @@ Provides a JSON API for the Part app """ import datetime - -from django.urls import include, path, re_path -from django.http import JsonResponse -from django.db.models import Q, F, Count, Min, Max, Avg -from django.db import transaction -from django.utils.translation import gettext_lazy as _ - -from rest_framework import status -from rest_framework.response import Response -from rest_framework import filters, serializers -from rest_framework import generics -from rest_framework.exceptions import ValidationError - -from django_filters.rest_framework import DjangoFilterBackend -from django_filters import rest_framework as rest_filters - -from djmoney.money import Money -from djmoney.contrib.exchange.models import convert_money -from djmoney.contrib.exchange.exceptions import MissingRate - from decimal import Decimal, InvalidOperation -from part.admin import PartResource +from django.db import transaction +from django.db.models import Avg, Count, F, Max, Min, Q +from django.http import JsonResponse +from django.urls import include, path, re_path +from django.utils.translation import gettext_lazy as _ -from .models import Part, PartCategory, PartRelated -from .models import BomItem, BomItemSubstitute -from .models import PartParameter, PartParameterTemplate -from .models import PartAttachment, PartTestTemplate -from .models import PartSellPriceBreak, PartInternalPriceBreak -from .models import PartCategoryParameterTemplate +from django_filters import rest_framework as rest_filters +from django_filters.rest_framework import DjangoFilterBackend +from djmoney.contrib.exchange.exceptions import MissingRate +from djmoney.contrib.exchange.models import convert_money +from djmoney.money import Money +from rest_framework import filters, generics, serializers, status +from rest_framework.exceptions import ValidationError +from rest_framework.response import Response +import order.models +from build.models import Build, BuildItem +from common.models import InvenTreeSetting from company.models import Company, ManufacturerPart, SupplierPart - +from InvenTree.api import APIDownloadMixin, AttachmentMixin +from InvenTree.helpers import DownloadFile, increment, isNull, str2bool +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, + SalesOrderStatus) +from part.admin import PartResource +from plugin.serializers import MetadataSerializer from stock.models import StockItem, StockLocation -from common.models import InvenTreeSetting -from build.models import Build, BuildItem -import order.models -from plugin.serializers import MetadataSerializer - from . import serializers as part_serializers - -from InvenTree.helpers import str2bool, isNull, increment -from InvenTree.helpers import DownloadFile -from InvenTree.api import AttachmentMixin, APIDownloadMixin - -from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus, SalesOrderStatus +from .models import (BomItem, BomItemSubstitute, Part, PartAttachment, + PartCategory, PartCategoryParameterTemplate, + PartInternalPriceBreak, PartParameter, + PartParameterTemplate, PartRelated, PartSellPriceBreak, + PartTestTemplate) class CategoryList(generics.ListCreateAPIView): diff --git a/InvenTree/part/apps.py b/InvenTree/part/apps.py index b1dfcbe8bc..9f66be5009 100644 --- a/InvenTree/part/apps.py +++ b/InvenTree/part/apps.py @@ -1,11 +1,10 @@ import logging -from django.db.utils import OperationalError, ProgrammingError from django.apps import AppConfig +from django.db.utils import OperationalError, ProgrammingError from InvenTree.ready import canAppAccessDatabase - logger = logging.getLogger("inventree") diff --git a/InvenTree/part/bom.py b/InvenTree/part/bom.py index 4010d542bb..fcb86f6204 100644 --- a/InvenTree/part/bom.py +++ b/InvenTree/part/bom.py @@ -7,11 +7,11 @@ from collections import OrderedDict from django.utils.translation import gettext as _ +from company.models import ManufacturerPart, SupplierPart from InvenTree.helpers import DownloadFile, GetExportFormats, normalize from .admin import BomItemResource from .models import BomItem -from company.models import ManufacturerPart, SupplierPart def IsValidBOMFormat(fmt): diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 9a14d8ad25..e1fe938bd2 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -7,17 +7,15 @@ from django.utils.translation import gettext_lazy as _ from mptt.fields import TreeNodeChoiceField -from InvenTree.forms import HelperForm -from InvenTree.helpers import clean_decimal -from InvenTree.fields import RoundingDecimalFormField - import common.models from common.forms import MatchItemForm +from InvenTree.fields import RoundingDecimalFormField +from InvenTree.forms import HelperForm +from InvenTree.helpers import clean_decimal -from .models import Part, PartCategory -from .models import PartParameterTemplate -from .models import PartCategoryParameterTemplate -from .models import PartSellPriceBreak, PartInternalPriceBreak +from .models import (Part, PartCategory, PartCategoryParameterTemplate, + PartInternalPriceBreak, PartParameterTemplate, + PartSellPriceBreak) class PartModelChoiceField(forms.ModelChoiceField): diff --git a/InvenTree/part/models.py b/InvenTree/part/models.py index fa0f1816f8..0fa6c738aa 100644 --- a/InvenTree/part/models.py +++ b/InvenTree/part/models.py @@ -3,64 +3,52 @@ Part database model definitions """ import decimal - -import os +import hashlib import logging - -from django.utils.translation import gettext_lazy as _ -from django.core.exceptions import ValidationError -from django.urls import reverse - -from django.db import models, transaction -from django.db.utils import IntegrityError -from django.db.models import Q, Sum, UniqueConstraint -from django.db.models.functions import Coalesce -from django.core.validators import MinValueValidator +import os +from datetime import datetime +from decimal import Decimal, InvalidOperation from django.contrib.auth.models import User +from django.core.exceptions import ValidationError +from django.core.validators import MinValueValidator +from django.db import models, transaction +from django.db.models import Q, Sum, UniqueConstraint +from django.db.models.functions import Coalesce from django.db.models.signals import post_save +from django.db.utils import IntegrityError from django.dispatch import receiver - -from jinja2 import Template - -from markdownx.models import MarkdownxField +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ from django_cleanup import cleanup - from djmoney.contrib.exchange.exceptions import MissingRate - -from mptt.models import TreeForeignKey, MPTTModel +from djmoney.contrib.exchange.models import convert_money +from jinja2 import Template +from markdownx.models import MarkdownxField from mptt.exceptions import InvalidMove from mptt.managers import TreeManager - +from mptt.models import MPTTModel, TreeForeignKey from stdimage.models import StdImageField -from decimal import Decimal, InvalidOperation -from datetime import datetime -import hashlib -from djmoney.contrib.exchange.models import convert_money -from common.settings import currency_code_default -from common.models import InvenTreeSetting - -from InvenTree import helpers -from InvenTree import validators - +import common.models import InvenTree.ready import InvenTree.tasks - -from InvenTree.fields import InvenTreeURLField -from InvenTree.helpers import decimal2string, normalize, decimal2money -from InvenTree.models import InvenTreeTree, InvenTreeAttachment, DataImportMixin -from InvenTree.status_codes import BuildStatus, PurchaseOrderStatus, SalesOrderStatus - -import common.models -from build import models as BuildModels -from order import models as OrderModels -from company.models import SupplierPart import part.settings as part_settings -from stock import models as StockModels +from build import models as BuildModels +from common.models import InvenTreeSetting +from common.settings import currency_code_default +from company.models import SupplierPart +from InvenTree import helpers, validators +from InvenTree.fields import InvenTreeURLField +from InvenTree.helpers import decimal2money, decimal2string, normalize +from InvenTree.models import (DataImportMixin, InvenTreeAttachment, + InvenTreeTree) +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, + SalesOrderStatus) +from order import models as OrderModels from plugin.models import MetadataMixin - +from stock import models as StockModels logger = logging.getLogger("inventree") diff --git a/InvenTree/part/serializers.py b/InvenTree/part/serializers.py index 098c1d1aea..4675c529da 100644 --- a/InvenTree/part/serializers.py +++ b/InvenTree/part/serializers.py @@ -5,40 +5,35 @@ JSON serializers for Part app import imghdr from decimal import Decimal -from django.urls import reverse_lazy from django.db import models, transaction -from django.db.models import ExpressionWrapper, F, Q, Func -from django.db.models import Subquery, OuterRef, FloatField - +from django.db.models import (ExpressionWrapper, F, FloatField, Func, OuterRef, + Q, Subquery) from django.db.models.functions import Coalesce +from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ +from djmoney.contrib.django_rest_framework import MoneyField from rest_framework import serializers from sql_util.utils import SubqueryCount, SubquerySum -from djmoney.contrib.django_rest_framework import MoneyField from common.settings import currency_code_default, currency_code_mappings - -from InvenTree.serializers import (DataFileUploadSerializer, - DataFileExtractSerializer, +from InvenTree.serializers import (DataFileExtractSerializer, + DataFileUploadSerializer, + InvenTreeAttachmentSerializer, InvenTreeAttachmentSerializerField, InvenTreeDecimalField, InvenTreeImageSerializerField, InvenTreeModelSerializer, - InvenTreeAttachmentSerializer, InvenTreeMoneySerializer) - -from InvenTree.status_codes import (BuildStatus, - PurchaseOrderStatus, +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, SalesOrderStatus) - from stock.models import StockItem -from .models import (BomItem, BomItemSubstitute, - Part, PartAttachment, PartCategory, PartRelated, - PartParameter, PartParameterTemplate, PartSellPriceBreak, - PartStar, PartTestTemplate, PartCategoryParameterTemplate, - PartInternalPriceBreak) +from .models import (BomItem, BomItemSubstitute, Part, PartAttachment, + PartCategory, PartCategoryParameterTemplate, + PartInternalPriceBreak, PartParameter, + PartParameterTemplate, PartRelated, PartSellPriceBreak, + PartStar, PartTestTemplate) class CategorySerializer(InvenTreeModelSerializer): diff --git a/InvenTree/part/tasks.py b/InvenTree/part/tasks.py index 7ab15a7200..18188bed77 100644 --- a/InvenTree/part/tasks.py +++ b/InvenTree/part/tasks.py @@ -2,10 +2,9 @@ import logging from django.utils.translation import gettext_lazy as _ +import common.notifications import InvenTree.helpers import InvenTree.tasks -import common.notifications - import part.models logger = logging.getLogger("inventree") diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py index a4af8a9383..7c7ee4de12 100644 --- a/InvenTree/part/templatetags/inventree_extras.py +++ b/InvenTree/part/templatetags/inventree_extras.py @@ -5,30 +5,25 @@ This module provides template tags for extra functionality, over and above the built-in Django tags. """ -from datetime import date, datetime +import logging import os import sys -import logging - -from django.utils.html import format_html - -from django.utils.translation import gettext_lazy as _ -from django.conf import settings as djangosettings +from datetime import date, datetime from django import template -from django.urls import reverse -from django.utils.safestring import mark_safe -from django.templatetags.static import StaticNode, static +from django.conf import settings as djangosettings from django.core.files.storage import default_storage - -from InvenTree import version, settings +from django.templatetags.static import StaticNode, static +from django.urls import reverse +from django.utils.html import format_html +from django.utils.safestring import mark_safe +from django.utils.translation import gettext_lazy as _ import InvenTree.helpers - -from common.models import InvenTreeSetting, ColorTheme, InvenTreeUserSetting +from common.models import ColorTheme, InvenTreeSetting, InvenTreeUserSetting from common.settings import currency_code_default - -from plugin.models import PluginSetting, NotificationUserSetting +from InvenTree import settings, version +from plugin.models import NotificationUserSetting, PluginSetting register = template.Library() diff --git a/InvenTree/part/templatetags/status_codes.py b/InvenTree/part/templatetags/status_codes.py index ea334970c2..12072d3d40 100644 --- a/InvenTree/part/templatetags/status_codes.py +++ b/InvenTree/part/templatetags/status_codes.py @@ -4,8 +4,9 @@ Provide templates for the various model status codes. from django import template from django.utils.safestring import mark_safe -from InvenTree.status_codes import PurchaseOrderStatus, SalesOrderStatus -from InvenTree.status_codes import StockStatus, BuildStatus + +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, + SalesOrderStatus, StockStatus) register = template.Library() diff --git a/InvenTree/part/test_api.py b/InvenTree/part/test_api.py index df24bdeaae..3819a01706 100644 --- a/InvenTree/part/test_api.py +++ b/InvenTree/part/test_api.py @@ -1,21 +1,18 @@ -import PIL - from django.urls import reverse +import PIL from rest_framework import status from rest_framework.test import APIClient -from InvenTree.api_tester import InvenTreeAPITestCase -from InvenTree.status_codes import BuildStatus, StockStatus, PurchaseOrderStatus - -from part.models import Part, PartCategory -from part.models import BomItem, BomItemSubstitute -from stock.models import StockItem, StockLocation -from company.models import Company -from common.models import InvenTreeSetting - import build.models import order.models +from common.models import InvenTreeSetting +from company.models import Company +from InvenTree.api_tester import InvenTreeAPITestCase +from InvenTree.status_codes import (BuildStatus, PurchaseOrderStatus, + StockStatus) +from part.models import BomItem, BomItemSubstitute, Part, PartCategory +from stock.models import StockItem, StockLocation class PartCategoryAPITest(InvenTreeAPITestCase): diff --git a/InvenTree/part/test_bom_export.py b/InvenTree/part/test_bom_export.py index 4ae0b88269..04e666f248 100644 --- a/InvenTree/part/test_bom_export.py +++ b/InvenTree/part/test_bom_export.py @@ -4,11 +4,10 @@ Unit testing for BOM export functionality import csv -from django.test import TestCase - -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse class BomExportTest(TestCase): diff --git a/InvenTree/part/test_bom_import.py b/InvenTree/part/test_bom_import.py index 6f9006d487..a9c853ddc4 100644 --- a/InvenTree/part/test_bom_import.py +++ b/InvenTree/part/test_bom_import.py @@ -2,13 +2,12 @@ Unit testing for BOM upload / import functionality """ -import tablib - from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse -from InvenTree.api_tester import InvenTreeAPITestCase +import tablib +from InvenTree.api_tester import InvenTreeAPITestCase from part.models import Part diff --git a/InvenTree/part/test_bom_item.py b/InvenTree/part/test_bom_item.py index 1ee57e8d07..0a48733c85 100644 --- a/InvenTree/part/test_bom_item.py +++ b/InvenTree/part/test_bom_item.py @@ -1,11 +1,11 @@ -from django.db import transaction - -from django.test import TestCase -import django.core.exceptions as django_exceptions from decimal import Decimal -from .models import Part, BomItem, BomItemSubstitute +import django.core.exceptions as django_exceptions +from django.db import transaction +from django.test import TestCase + +from .models import BomItem, BomItemSubstitute, Part class BomItemTest(TestCase): diff --git a/InvenTree/part/test_category.py b/InvenTree/part/test_category.py index 6eb76fa845..4da893f188 100644 --- a/InvenTree/part/test_category.py +++ b/InvenTree/part/test_category.py @@ -1,5 +1,5 @@ -from django.test import TestCase from django.core.exceptions import ValidationError +from django.test import TestCase from .models import Part, PartCategory, PartParameter, PartParameterTemplate diff --git a/InvenTree/part/test_param.py b/InvenTree/part/test_param.py index db617f6ffb..1db23f0be2 100644 --- a/InvenTree/part/test_param.py +++ b/InvenTree/part/test_param.py @@ -1,11 +1,10 @@ # Tests for Part Parameters -from django.test import TestCase, TransactionTestCase import django.core.exceptions as django_exceptions +from django.test import TestCase, TransactionTestCase -from .models import Part, PartCategory -from .models import PartParameter, PartParameterTemplate -from .models import PartCategoryParameterTemplate +from .models import (Part, PartCategory, PartCategoryParameterTemplate, + PartParameter, PartParameterTemplate) class TestParams(TestCase): diff --git a/InvenTree/part/test_part.py b/InvenTree/part/test_part.py index 2df3c10b01..293f13d63f 100644 --- a/InvenTree/part/test_part.py +++ b/InvenTree/part/test_part.py @@ -1,24 +1,23 @@ # Tests for the Part model -from allauth.account.models import EmailAddress - -from django.conf import settings -from django.contrib.auth import get_user_model - -from django.test import TestCase -from django.core.exceptions import ValidationError - import os -from .models import Part, PartCategory, PartCategoryStar, PartStar, PartTestTemplate -from .models import rename_part_image -from .templatetags import inventree_extras +from django.conf import settings +from django.contrib.auth import get_user_model +from django.core.exceptions import ValidationError +from django.test import TestCase + +from allauth.account.models import EmailAddress import part.settings - +from common.models import (InvenTreeSetting, InvenTreeUserSetting, + NotificationEntry, NotificationMessage) +from common.notifications import UIMessageNotification, storage from InvenTree import version -from common.models import InvenTreeSetting, InvenTreeUserSetting, NotificationEntry, NotificationMessage -from common.notifications import storage, UIMessageNotification + +from .models import (Part, PartCategory, PartCategoryStar, PartStar, + PartTestTemplate, rename_part_image) +from .templatetags import inventree_extras class TemplateTagTest(TestCase): diff --git a/InvenTree/part/test_views.py b/InvenTree/part/test_views.py index 2171a09b17..c0eff13a2e 100644 --- a/InvenTree/part/test_views.py +++ b/InvenTree/part/test_views.py @@ -1,9 +1,9 @@ """ Unit tests for Part Views (see views.py) """ -from django.test import TestCase -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse from .models import Part diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py index a9da7329a6..f921cc6dfc 100644 --- a/InvenTree/part/urls.py +++ b/InvenTree/part/urls.py @@ -12,7 +12,6 @@ from django.urls import include, re_path from . import views - part_parameter_urls = [ re_path(r'^template/new/', views.PartParameterTemplateCreate.as_view(), name='part-param-template-create'), re_path(r'^template/(?P\d+)/edit/', views.PartParameterTemplateEdit.as_view(), name='part-param-template-edit'), diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 78dcc5b63f..982fd1fa53 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -2,55 +2,44 @@ Django views for interacting with Part app """ -from django.core.files.base import ContentFile -from django.core.exceptions import ValidationError -from django.db import transaction -from django.db.utils import IntegrityError -from django.shortcuts import get_object_or_404 -from django.shortcuts import HttpResponseRedirect -from django.utils.translation import gettext_lazy as _ -from django.urls import reverse -from django.views.generic import DetailView, ListView -from django.forms import HiddenInput -from django.conf import settings -from django.contrib import messages - -from djmoney.contrib.exchange.models import convert_money -from djmoney.contrib.exchange.exceptions import MissingRate - -from PIL import Image - -import requests -import os import io - +import os from decimal import Decimal -from .models import PartCategory, Part -from .models import PartParameterTemplate -from .models import PartCategoryParameterTemplate +from django.conf import settings +from django.contrib import messages +from django.core.exceptions import ValidationError +from django.core.files.base import ContentFile +from django.db import transaction +from django.db.utils import IntegrityError +from django.forms import HiddenInput +from django.shortcuts import HttpResponseRedirect, get_object_or_404 +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ +from django.views.generic import DetailView, ListView -from common.models import InvenTreeSetting -from company.models import SupplierPart -from common.files import FileManager -from common.views import FileManagementFormView, FileManagementAjaxView - -from stock.models import StockItem, StockLocation +import requests +from djmoney.contrib.exchange.exceptions import MissingRate +from djmoney.contrib.exchange.models import convert_money +from PIL import Image import common.settings as inventree_settings +from common.files import FileManager +from common.models import InvenTreeSetting +from common.views import FileManagementAjaxView, FileManagementFormView +from company.models import SupplierPart +from InvenTree.helpers import str2bool +from InvenTree.views import (AjaxCreateView, AjaxDeleteView, AjaxUpdateView, + AjaxView, InvenTreeRoleMixin, QRCodeView) +from order.models import PurchaseOrderLineItem +from plugin.views import InvenTreePluginViewMixin +from stock.models import StockItem, StockLocation from . import forms as part_forms from . import settings as part_settings -from .bom import MakeBomTemplate, ExportBom, IsValidBOMFormat -from order.models import PurchaseOrderLineItem - -from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView -from InvenTree.views import QRCodeView -from InvenTree.views import InvenTreeRoleMixin - -from InvenTree.helpers import str2bool - -from plugin.views import InvenTreePluginViewMixin +from .bom import ExportBom, IsValidBOMFormat, MakeBomTemplate +from .models import (Part, PartCategory, PartCategoryParameterTemplate, + PartParameterTemplate) class PartIndex(InvenTreeRoleMixin, ListView): diff --git a/InvenTree/plugin/__init__.py b/InvenTree/plugin/__init__.py index 2f08d31eed..adb8235d29 100644 --- a/InvenTree/plugin/__init__.py +++ b/InvenTree/plugin/__init__.py @@ -2,9 +2,9 @@ Utility file to enable simper imports """ +from .helpers import MixinImplementationError, MixinNotImplementedError +from .plugin import IntegrationPluginBase, InvenTreePlugin from .registry import registry -from .plugin import InvenTreePlugin, IntegrationPluginBase -from .helpers import MixinNotImplementedError, MixinImplementationError __all__ = [ 'registry', diff --git a/InvenTree/plugin/api.py b/InvenTree/plugin/api.py index 4b0f809001..cfdd08d51b 100644 --- a/InvenTree/plugin/api.py +++ b/InvenTree/plugin/api.py @@ -5,18 +5,17 @@ JSON API for the plugin app from django.conf import settings from django.urls import include, re_path +from django_filters.rest_framework import DjangoFilterBackend from rest_framework import filters, generics, permissions, status from rest_framework.exceptions import NotFound from rest_framework.response import Response -from django_filters.rest_framework import DjangoFilterBackend - +import plugin.serializers as PluginSerializers from common.api import GlobalSettingsPermissions -from plugin.base.barcodes.api import barcode_api_urls from plugin.base.action.api import ActionPluginView +from plugin.base.barcodes.api import barcode_api_urls from plugin.base.locate.api import LocatePluginView from plugin.models import PluginConfig, PluginSetting -import plugin.serializers as PluginSerializers from plugin.registry import registry diff --git a/InvenTree/plugin/apps.py b/InvenTree/plugin/apps.py index c0e894fef1..9f9cb15d1a 100644 --- a/InvenTree/plugin/apps.py +++ b/InvenTree/plugin/apps.py @@ -11,7 +11,6 @@ from InvenTree.ready import canAppAccessDatabase from plugin import registry from plugin.helpers import check_git_version, log_error - logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/base/action/test_action.py b/InvenTree/plugin/base/action/test_action.py index 16790ccd62..995ce77be9 100644 --- a/InvenTree/plugin/base/action/test_action.py +++ b/InvenTree/plugin/base/action/test_action.py @@ -1,7 +1,7 @@ """ Unit tests for action plugins """ -from django.test import TestCase from django.contrib.auth import get_user_model +from django.test import TestCase from plugin import InvenTreePlugin from plugin.mixins import ActionMixin diff --git a/InvenTree/plugin/base/barcodes/api.py b/InvenTree/plugin/base/barcodes/api.py index edd9fc3dcc..a12150d88f 100644 --- a/InvenTree/plugin/base/barcodes/api.py +++ b/InvenTree/plugin/base/barcodes/api.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- -from django.urls import reverse, path, re_path +from django.urls import path, re_path, reverse from django.utils.translation import gettext_lazy as _ -from rest_framework.exceptions import ValidationError from rest_framework import permissions +from rest_framework.exceptions import ValidationError from rest_framework.response import Response from rest_framework.views import APIView +from plugin import registry +from plugin.base.barcodes.mixins import hash_barcode +from plugin.builtin.barcodes.inventree_barcode import InvenTreeBarcodePlugin from stock.models import StockItem from stock.serializers import StockItemSerializer -from plugin.builtin.barcodes.inventree_barcode import InvenTreeBarcodePlugin -from plugin.base.barcodes.mixins import hash_barcode -from plugin import registry - class BarcodeScan(APIView): """ diff --git a/InvenTree/plugin/base/barcodes/mixins.py b/InvenTree/plugin/base/barcodes/mixins.py index 417ca04bcd..ef3b6004ee 100644 --- a/InvenTree/plugin/base/barcodes/mixins.py +++ b/InvenTree/plugin/base/barcodes/mixins.py @@ -1,12 +1,12 @@ """ Plugin mixin classes for barcode plugin """ -import string import hashlib +import string -from stock.models import StockItem -from stock.serializers import StockItemSerializer, LocationSerializer from part.serializers import PartSerializer +from stock.models import StockItem +from stock.serializers import LocationSerializer, StockItemSerializer def hash_barcode(barcode_data): diff --git a/InvenTree/plugin/base/barcodes/test_barcode.py b/InvenTree/plugin/base/barcodes/test_barcode.py index 43a713a57b..88d4109069 100644 --- a/InvenTree/plugin/base/barcodes/test_barcode.py +++ b/InvenTree/plugin/base/barcodes/test_barcode.py @@ -7,8 +7,8 @@ Unit tests for Barcode endpoints from django.contrib.auth import get_user_model from django.urls import reverse -from rest_framework.test import APITestCase from rest_framework import status +from rest_framework.test import APITestCase from stock.models import StockItem diff --git a/InvenTree/plugin/base/event/events.py b/InvenTree/plugin/base/event/events.py index 4dea7525b3..d2294b4416 100644 --- a/InvenTree/plugin/base/event/events.py +++ b/InvenTree/plugin/base/event/events.py @@ -6,15 +6,13 @@ import logging from django.conf import settings from django.db import transaction -from django.db.models.signals import post_save, post_delete +from django.db.models.signals import post_delete, post_save from django.dispatch.dispatcher import receiver from InvenTree.ready import canAppAccessDatabase, isImportingData from InvenTree.tasks import offload_task - from plugin.registry import registry - logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/base/integration/mixins.py b/InvenTree/plugin/base/integration/mixins.py index 6977ef3dd9..18b4cb0fd4 100644 --- a/InvenTree/plugin/base/integration/mixins.py +++ b/InvenTree/plugin/base/integration/mixins.py @@ -2,22 +2,21 @@ Plugin mixin classes """ -import logging import json +import logging + +from django.db.utils import OperationalError, ProgrammingError +from django.urls import include, re_path + import requests -from django.urls import include, re_path -from django.db.utils import OperationalError, ProgrammingError - import InvenTree.helpers - -from plugin.helpers import MixinImplementationError, MixinNotImplementedError -from plugin.helpers import render_template, render_text +from plugin.helpers import (MixinImplementationError, MixinNotImplementedError, + render_template, render_text) from plugin.models import PluginConfig, PluginSetting from plugin.registry import registry from plugin.urls import PLUGIN_BASE - logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/base/integration/test_mixins.py b/InvenTree/plugin/base/integration/test_mixins.py index c1afa39fc2..d5dac21746 100644 --- a/InvenTree/plugin/base/integration/test_mixins.py +++ b/InvenTree/plugin/base/integration/test_mixins.py @@ -1,19 +1,19 @@ """ Unit tests for base mixins for plugins """ -from django.test import TestCase from django.conf import settings -from django.urls import include, re_path, reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import include, re_path, reverse from error_report.models import Error from plugin import InvenTreePlugin -from plugin.mixins import AppMixin, SettingsMixin, UrlsMixin, NavigationMixin, APICallMixin -from plugin.urls import PLUGIN_BASE from plugin.helpers import MixinNotImplementedError - +from plugin.mixins import (APICallMixin, AppMixin, NavigationMixin, + SettingsMixin, UrlsMixin) from plugin.registry import registry +from plugin.urls import PLUGIN_BASE class BaseMixinDefinition: diff --git a/InvenTree/plugin/base/label/label.py b/InvenTree/plugin/base/label/label.py index 7f29ba70f4..daaaaedbe2 100644 --- a/InvenTree/plugin/base/label/label.py +++ b/InvenTree/plugin/base/label/label.py @@ -3,9 +3,8 @@ import logging from django.utils.translation import gettext_lazy as _ -from plugin.registry import registry import common.notifications - +from plugin.registry import registry logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/base/locate/api.py b/InvenTree/plugin/base/locate/api.py index 3004abb262..da0488591f 100644 --- a/InvenTree/plugin/base/locate/api.py +++ b/InvenTree/plugin/base/locate/api.py @@ -1,12 +1,11 @@ """API for location plugins""" from rest_framework import permissions -from rest_framework.exceptions import ParseError, NotFound +from rest_framework.exceptions import NotFound, ParseError from rest_framework.response import Response from rest_framework.views import APIView from InvenTree.tasks import offload_task - from plugin.registry import registry from stock.models import StockItem, StockLocation diff --git a/InvenTree/plugin/base/locate/test_locate.py b/InvenTree/plugin/base/locate/test_locate.py index e145c2360b..361b791c4b 100644 --- a/InvenTree/plugin/base/locate/test_locate.py +++ b/InvenTree/plugin/base/locate/test_locate.py @@ -5,7 +5,6 @@ Unit tests for the 'locate' plugin mixin class from django.urls import reverse from InvenTree.api_tester import InvenTreeAPITestCase - from plugin.registry import registry from stock.models import StockItem, StockLocation diff --git a/InvenTree/plugin/builtin/action/test_simpleactionplugin.py b/InvenTree/plugin/builtin/action/test_simpleactionplugin.py index 92e1affa67..f9276ba7c3 100644 --- a/InvenTree/plugin/builtin/action/test_simpleactionplugin.py +++ b/InvenTree/plugin/builtin/action/test_simpleactionplugin.py @@ -1,7 +1,7 @@ """ Unit tests for action plugins """ -from django.test import TestCase from django.contrib.auth import get_user_model +from django.test import TestCase from plugin.builtin.action.simpleactionplugin import SimpleActionPlugin diff --git a/InvenTree/plugin/builtin/barcodes/inventree_barcode.py b/InvenTree/plugin/builtin/barcodes/inventree_barcode.py index f9f498ccd8..bbc2d29c68 100644 --- a/InvenTree/plugin/builtin/barcodes/inventree_barcode.py +++ b/InvenTree/plugin/builtin/barcodes/inventree_barcode.py @@ -13,13 +13,12 @@ references model objects actually exist in the database. import json +from rest_framework.exceptions import ValidationError + +from part.models import Part from plugin import InvenTreePlugin from plugin.mixins import BarcodeMixin - from stock.models import StockItem, StockLocation -from part.models import Part - -from rest_framework.exceptions import ValidationError class InvenTreeBarcodePlugin(BarcodeMixin, InvenTreePlugin): diff --git a/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py b/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py index 1424d89ff2..4226ff055b 100644 --- a/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py +++ b/InvenTree/plugin/builtin/barcodes/test_inventree_barcode.py @@ -4,8 +4,8 @@ from django.contrib.auth import get_user_model from django.urls import reverse -from rest_framework.test import APITestCase from rest_framework import status +from rest_framework.test import APITestCase class TestInvenTreeBarcode(APITestCase): diff --git a/InvenTree/plugin/builtin/integration/core_notifications.py b/InvenTree/plugin/builtin/integration/core_notifications.py index 67b61eea3b..179fb7994f 100644 --- a/InvenTree/plugin/builtin/integration/core_notifications.py +++ b/InvenTree/plugin/builtin/integration/core_notifications.py @@ -5,9 +5,9 @@ from django.utils.translation import ugettext_lazy as _ from allauth.account.models import EmailAddress +import InvenTree.tasks from plugin import InvenTreePlugin from plugin.mixins import BulkNotificationMethod, SettingsMixin -import InvenTree.tasks class PlgMixin: diff --git a/InvenTree/plugin/builtin/integration/test_core_notifications.py b/InvenTree/plugin/builtin/integration/test_core_notifications.py index e93d2a84cd..3badac2562 100644 --- a/InvenTree/plugin/builtin/integration/test_core_notifications.py +++ b/InvenTree/plugin/builtin/integration/test_core_notifications.py @@ -1,7 +1,8 @@ -from plugin.models import NotificationUserSetting from part.test_part import BaseNotificationIntegrationTest -from plugin.builtin.integration.core_notifications import CoreNotificationsPlugin from plugin import registry +from plugin.builtin.integration.core_notifications import \ + CoreNotificationsPlugin +from plugin.models import NotificationUserSetting class CoreNotificationTestTests(BaseNotificationIntegrationTest): diff --git a/InvenTree/plugin/events.py b/InvenTree/plugin/events.py index 66c6267d53..452e71d4ef 100644 --- a/InvenTree/plugin/events.py +++ b/InvenTree/plugin/events.py @@ -2,7 +2,8 @@ Import helper for events """ -from plugin.base.event.events import process_event, register_event, trigger_event +from plugin.base.event.events import (process_event, register_event, + trigger_event) __all__ = [ 'process_event', diff --git a/InvenTree/plugin/helpers.py b/InvenTree/plugin/helpers.py index 90ffe61478..8a3a38a4ca 100644 --- a/InvenTree/plugin/helpers.py +++ b/InvenTree/plugin/helpers.py @@ -1,21 +1,20 @@ """ Helpers for plugin app """ +import inspect +import logging import os -import subprocess import pathlib +import pkgutil +import subprocess import sysconfig import traceback -import inspect -import pkgutil -import logging from django import template from django.conf import settings from django.core.exceptions import AppRegistryNotReady from django.db.utils import IntegrityError - logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/mixins/__init__.py b/InvenTree/plugin/mixins/__init__.py index 5a2bf95be6..80088de561 100644 --- a/InvenTree/plugin/mixins/__init__.py +++ b/InvenTree/plugin/mixins/__init__.py @@ -2,13 +2,15 @@ Utility class to enable simpler imports """ -from ..base.integration.mixins import APICallMixin, AppMixin, SettingsMixin, ScheduleMixin, UrlsMixin, NavigationMixin, PanelMixin - -from common.notifications import SingleNotificationMethod, BulkNotificationMethod +from common.notifications import (BulkNotificationMethod, + SingleNotificationMethod) from ..base.action.mixins import ActionMixin from ..base.barcodes.mixins import BarcodeMixin from ..base.event.mixins import EventMixin +from ..base.integration.mixins import (APICallMixin, AppMixin, NavigationMixin, + PanelMixin, ScheduleMixin, + SettingsMixin, UrlsMixin) from ..base.label.mixins import LabelPrintingMixin from ..base.locate.mixins import LocateMixin diff --git a/InvenTree/plugin/models.py b/InvenTree/plugin/models.py index 27f77a9eb5..35becb9c47 100644 --- a/InvenTree/plugin/models.py +++ b/InvenTree/plugin/models.py @@ -4,13 +4,12 @@ Plugin model definitions import warnings -from django.utils.translation import gettext_lazy as _ -from django.db import models -from django.contrib.auth.models import User from django.conf import settings +from django.contrib.auth.models import User +from django.db import models +from django.utils.translation import gettext_lazy as _ import common.models - from plugin import InvenTreePlugin, registry diff --git a/InvenTree/plugin/plugin.py b/InvenTree/plugin/plugin.py index b008865f5c..d5f6a7bccf 100644 --- a/InvenTree/plugin/plugin.py +++ b/InvenTree/plugin/plugin.py @@ -2,21 +2,20 @@ """ Base Class for InvenTree plugins """ +import inspect import logging import os -import inspect -from datetime import datetime import pathlib import warnings +from datetime import datetime from django.conf import settings from django.db.utils import OperationalError, ProgrammingError +from django.urls.base import reverse from django.utils.text import slugify from django.utils.translation import gettext_lazy as _ -from django.urls.base import reverse - -from plugin.helpers import get_git_log, GitStatus +from plugin.helpers import GitStatus, get_git_log logger = logging.getLogger("inventree") diff --git a/InvenTree/plugin/registry.py b/InvenTree/plugin/registry.py index 1ec5adb161..40e5bd3ff5 100644 --- a/InvenTree/plugin/registry.py +++ b/InvenTree/plugin/registry.py @@ -6,28 +6,26 @@ Registry for loading and managing multiple plugins at run-time """ import importlib -import pathlib import logging import os +import pathlib import subprocess - +from importlib import metadata, reload from typing import OrderedDict -from importlib import reload, metadata from django.apps import apps from django.conf import settings -from django.db.utils import OperationalError, ProgrammingError, IntegrityError -from django.urls import include, re_path -from django.urls import clear_url_caches from django.contrib import admin +from django.db.utils import IntegrityError, OperationalError, ProgrammingError +from django.urls import clear_url_caches, include, re_path from django.utils.text import slugify -from maintenance_mode.core import maintenance_mode_on -from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode +from maintenance_mode.core import (get_maintenance_mode, maintenance_mode_on, + set_maintenance_mode) +from .helpers import (IntegrationPluginError, get_plugins, handle_error, + log_error) from .plugin import InvenTreePlugin -from .helpers import handle_error, log_error, get_plugins, IntegrationPluginError - logger = logging.getLogger('inventree') @@ -576,7 +574,8 @@ class PluginsRegistry: self.plugins_inactive = {} def _update_urls(self): - from InvenTree.urls import urlpatterns as global_pattern, frontendpatterns as urlpatterns + from InvenTree.urls import frontendpatterns as urlpatterns + from InvenTree.urls import urlpatterns as global_pattern from plugin.urls import get_plugin_urls for index, a in enumerate(urlpatterns): diff --git a/InvenTree/plugin/samples/integration/custom_panel_sample.py b/InvenTree/plugin/samples/integration/custom_panel_sample.py index 3d44bc0c5b..cb1a938504 100644 --- a/InvenTree/plugin/samples/integration/custom_panel_sample.py +++ b/InvenTree/plugin/samples/integration/custom_panel_sample.py @@ -2,10 +2,9 @@ Sample plugin which renders custom panels on certain pages """ +from part.views import PartDetail from plugin import InvenTreePlugin from plugin.mixins import PanelMixin, SettingsMixin - -from part.views import PartDetail from stock.views import StockLocationDetail diff --git a/InvenTree/plugin/samples/integration/sample.py b/InvenTree/plugin/samples/integration/sample.py index e2f10fcabe..a768fb3de3 100644 --- a/InvenTree/plugin/samples/integration/sample.py +++ b/InvenTree/plugin/samples/integration/sample.py @@ -2,12 +2,12 @@ Sample implementations for IntegrationPlugin """ -from plugin import InvenTreePlugin -from plugin.mixins import AppMixin, SettingsMixin, UrlsMixin, NavigationMixin - from django.http import HttpResponse -from django.utils.translation import gettext_lazy as _ from django.urls import include, re_path +from django.utils.translation import gettext_lazy as _ + +from plugin import InvenTreePlugin +from plugin.mixins import AppMixin, NavigationMixin, SettingsMixin, UrlsMixin class SampleIntegrationPlugin(AppMixin, SettingsMixin, UrlsMixin, NavigationMixin, InvenTreePlugin): diff --git a/InvenTree/plugin/samples/integration/test_sample.py b/InvenTree/plugin/samples/integration/test_sample.py index 733e443638..aaff9f9624 100644 --- a/InvenTree/plugin/samples/integration/test_sample.py +++ b/InvenTree/plugin/samples/integration/test_sample.py @@ -1,7 +1,7 @@ """ Unit tests for action plugins """ -from django.test import TestCase from django.contrib.auth import get_user_model +from django.test import TestCase class SampleIntegrationPluginTests(TestCase): diff --git a/InvenTree/plugin/samples/integration/test_scheduled_task.py b/InvenTree/plugin/samples/integration/test_scheduled_task.py index a232324958..c99a662ff9 100644 --- a/InvenTree/plugin/samples/integration/test_scheduled_task.py +++ b/InvenTree/plugin/samples/integration/test_scheduled_task.py @@ -2,10 +2,10 @@ from django.test import TestCase -from plugin import registry, InvenTreePlugin +from plugin import InvenTreePlugin, registry from plugin.helpers import MixinImplementationError -from plugin.registry import call_function from plugin.mixins import ScheduleMixin +from plugin.registry import call_function class ExampleScheduledTaskPluginTests(TestCase): diff --git a/InvenTree/plugin/samples/locate/locate_sample.py b/InvenTree/plugin/samples/locate/locate_sample.py index 32a2dd713c..99242ead35 100644 --- a/InvenTree/plugin/samples/locate/locate_sample.py +++ b/InvenTree/plugin/samples/locate/locate_sample.py @@ -9,7 +9,6 @@ import logging from plugin import InvenTreePlugin from plugin.mixins import LocateMixin - logger = logging.getLogger('inventree') diff --git a/InvenTree/plugin/serializers.py b/InvenTree/plugin/serializers.py index b3c57d9291..4ab067eebb 100644 --- a/InvenTree/plugin/serializers.py +++ b/InvenTree/plugin/serializers.py @@ -5,15 +5,15 @@ JSON serializers for plugin app import os import subprocess -from django.core.exceptions import ValidationError from django.conf import settings -from django.utils.translation import gettext_lazy as _ +from django.core.exceptions import ValidationError from django.utils import timezone +from django.utils.translation import gettext_lazy as _ from rest_framework import serializers -from plugin.models import PluginConfig, PluginSetting, NotificationUserSetting from common.serializers import GenericReferencedSettingSerializer +from plugin.models import NotificationUserSetting, PluginConfig, PluginSetting class MetadataSerializer(serializers.ModelSerializer): diff --git a/InvenTree/plugin/templatetags/plugin_extras.py b/InvenTree/plugin/templatetags/plugin_extras.py index 5eca037104..b949ced8e3 100644 --- a/InvenTree/plugin/templatetags/plugin_extras.py +++ b/InvenTree/plugin/templatetags/plugin_extras.py @@ -2,13 +2,13 @@ """ This module provides template tags for handeling plugins """ -from django.conf import settings as djangosettings from django import template +from django.conf import settings as djangosettings from django.urls import reverse from common.models import InvenTreeSetting -from plugin import registry from common.notifications import storage +from plugin import registry register = template.Library() diff --git a/InvenTree/plugin/test_api.py b/InvenTree/plugin/test_api.py index e3685969af..e04c0ee84b 100644 --- a/InvenTree/plugin/test_api.py +++ b/InvenTree/plugin/test_api.py @@ -76,8 +76,8 @@ class PluginDetailAPITest(InvenTreeAPITestCase): """ Test the PluginConfig action commands """ - from plugin.models import PluginConfig from plugin import registry + from plugin.models import PluginConfig url = reverse('admin:plugin_pluginconfig_changelist') fixtures = PluginConfig.objects.all() @@ -135,8 +135,8 @@ class PluginDetailAPITest(InvenTreeAPITestCase): """ Test the PluginConfig model """ - from plugin.models import PluginConfig from plugin import registry + from plugin.models import PluginConfig fixtures = PluginConfig.objects.all() diff --git a/InvenTree/plugin/test_plugin.py b/InvenTree/plugin/test_plugin.py index 5de813150f..1516c4eee8 100644 --- a/InvenTree/plugin/test_plugin.py +++ b/InvenTree/plugin/test_plugin.py @@ -6,10 +6,11 @@ from datetime import datetime from django.test import TestCase -from plugin.samples.integration.sample import SampleIntegrationPlugin -from plugin.samples.integration.another_sample import WrongIntegrationPlugin, NoIntegrationPlugin import plugin.templatetags.plugin_extras as plugin_tags -from plugin import registry, InvenTreePlugin, IntegrationPluginBase +from plugin import IntegrationPluginBase, InvenTreePlugin, registry +from plugin.samples.integration.another_sample import (NoIntegrationPlugin, + WrongIntegrationPlugin) +from plugin.samples.integration.sample import SampleIntegrationPlugin class PluginTagTests(TestCase): diff --git a/InvenTree/plugin/urls.py b/InvenTree/plugin/urls.py index 08f547aca2..be90ff1618 100644 --- a/InvenTree/plugin/urls.py +++ b/InvenTree/plugin/urls.py @@ -6,7 +6,6 @@ from django.urls import include, re_path from plugin import registry - PLUGIN_BASE = 'plugin' # Constant for links diff --git a/InvenTree/plugin/views.py b/InvenTree/plugin/views.py index ad4d54daea..066047d33f 100644 --- a/InvenTree/plugin/views.py +++ b/InvenTree/plugin/views.py @@ -9,7 +9,6 @@ from error_report.models import Error from plugin.registry import registry - logger = logging.getLogger('inventree') diff --git a/InvenTree/report/admin.py b/InvenTree/report/admin.py index 6456bf72c5..6e1b919633 100644 --- a/InvenTree/report/admin.py +++ b/InvenTree/report/admin.py @@ -1,11 +1,7 @@ from django.contrib import admin -from .models import ReportSnippet, ReportAsset -from .models import TestReport -from .models import BuildReport -from .models import BillOfMaterialsReport -from .models import PurchaseOrderReport -from .models import SalesOrderReport +from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport, + ReportAsset, ReportSnippet, SalesOrderReport, TestReport) class ReportTemplateAdmin(admin.ModelAdmin): diff --git a/InvenTree/report/api.py b/InvenTree/report/api.py index f8b31fef99..106da81f08 100644 --- a/InvenTree/report/api.py +++ b/InvenTree/report/api.py @@ -1,36 +1,26 @@ -from django.utils.translation import gettext_lazy as _ -from django.urls import include, path, re_path -from django.core.exceptions import ValidationError, FieldError +from django.core.exceptions import FieldError, ValidationError from django.http import HttpResponse - from django.template.exceptions import TemplateDoesNotExist +from django.urls import include, path, re_path +from django.utils.translation import gettext_lazy as _ from django_filters.rest_framework import DjangoFilterBackend - -from rest_framework import generics, filters +from rest_framework import filters, generics from rest_framework.response import Response +import build.models import common.models import InvenTree.helpers - +import order.models +import part.models from stock.models import StockItem -import build.models -import part.models -import order.models - -from .models import TestReport -from .models import BuildReport -from .models import BillOfMaterialsReport -from .models import PurchaseOrderReport -from .models import SalesOrderReport - -from .serializers import TestReportSerializer -from .serializers import BuildReportSerializer -from .serializers import BOMReportSerializer -from .serializers import PurchaseOrderReportSerializer -from .serializers import SalesOrderReportSerializer +from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport, + SalesOrderReport, TestReport) +from .serializers import (BOMReportSerializer, BuildReportSerializer, + PurchaseOrderReportSerializer, + SalesOrderReportSerializer, TestReportSerializer) class ReportListView(generics.ListAPIView): diff --git a/InvenTree/report/apps.py b/InvenTree/report/apps.py index fe01573ff5..cc7fd6eded 100644 --- a/InvenTree/report/apps.py +++ b/InvenTree/report/apps.py @@ -1,13 +1,12 @@ +import logging import os import shutil -import logging from django.apps import AppConfig from django.conf import settings from InvenTree.ready import canAppAccessDatabase - logger = logging.getLogger("inventree") diff --git a/InvenTree/report/models.py b/InvenTree/report/models.py index dcaa2a842d..bc852b4faa 100644 --- a/InvenTree/report/models.py +++ b/InvenTree/report/models.py @@ -2,33 +2,28 @@ Report template model definitions """ +import datetime +import logging import os import sys -import logging -import datetime - -from django.urls import reverse -from django.db import models from django.conf import settings from django.core.cache import cache -from django.core.exceptions import ValidationError, FieldError - -from django.template.loader import render_to_string -from django.template import Template, Context - +from django.core.exceptions import FieldError, ValidationError from django.core.validators import FileExtensionValidator +from django.db import models +from django.template import Context, Template +from django.template.loader import render_to_string +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ import build.models import common.models +import order.models import part.models import stock.models -import order.models - from InvenTree.helpers import validateFilterString -from django.utils.translation import gettext_lazy as _ - try: from django_weasyprint import WeasyTemplateResponseMixin except OSError as err: # pragma: no cover diff --git a/InvenTree/report/serializers.py b/InvenTree/report/serializers.py index 1db0cca1b9..daa1e254d5 100644 --- a/InvenTree/report/serializers.py +++ b/InvenTree/report/serializers.py @@ -1,11 +1,9 @@ -from InvenTree.serializers import InvenTreeModelSerializer -from InvenTree.serializers import InvenTreeAttachmentSerializerField +from InvenTree.serializers import (InvenTreeAttachmentSerializerField, + InvenTreeModelSerializer) -from .models import TestReport -from .models import BuildReport -from .models import BillOfMaterialsReport -from .models import PurchaseOrderReport, SalesOrderReport +from .models import (BillOfMaterialsReport, BuildReport, PurchaseOrderReport, + SalesOrderReport, TestReport) class TestReportSerializer(InvenTreeModelSerializer): diff --git a/InvenTree/report/templatetags/barcode.py b/InvenTree/report/templatetags/barcode.py index a47d45fdf0..8d8397d50a 100644 --- a/InvenTree/report/templatetags/barcode.py +++ b/InvenTree/report/templatetags/barcode.py @@ -7,8 +7,8 @@ from io import BytesIO from django import template -import qrcode as python_qrcode import barcode as python_barcode +import qrcode as python_qrcode register = template.Library() diff --git a/InvenTree/report/templatetags/report.py b/InvenTree/report/templatetags/report.py index 9593db1885..8a14501933 100644 --- a/InvenTree/report/templatetags/report.py +++ b/InvenTree/report/templatetags/report.py @@ -8,14 +8,12 @@ from django import template from django.conf import settings from django.utils.safestring import mark_safe +import InvenTree.helpers +from common.models import InvenTreeSetting from company.models import Company from part.models import Part from stock.models import StockItem -from common.models import InvenTreeSetting - -import InvenTree.helpers - register = template.Library() diff --git a/InvenTree/report/tests.py b/InvenTree/report/tests.py index d30a5814d9..38fbb491bf 100644 --- a/InvenTree/report/tests.py +++ b/InvenTree/report/tests.py @@ -2,16 +2,15 @@ import os import shutil +from django.conf import settings from django.http.response import StreamingHttpResponse from django.urls import reverse -from django.conf import settings - -from InvenTree.api_tester import InvenTreeAPITestCase import report.models as report_models -from common.models import InvenTreeUserSetting -from stock.models import StockItem from build.models import Build +from common.models import InvenTreeUserSetting +from InvenTree.api_tester import InvenTreeAPITestCase +from stock.models import StockItem class ReportTest(InvenTreeAPITestCase): diff --git a/InvenTree/script/translation_stats.py b/InvenTree/script/translation_stats.py index 4ee83120eb..e96708d1f2 100644 --- a/InvenTree/script/translation_stats.py +++ b/InvenTree/script/translation_stats.py @@ -2,8 +2,8 @@ This script calculates translation coverage for various languages """ -import os import json +import os import sys diff --git a/InvenTree/stock/admin.py b/InvenTree/stock/admin.py index 4b7cf38bf5..85d7b7afe0 100644 --- a/InvenTree/stock/admin.py +++ b/InvenTree/stock/admin.py @@ -1,19 +1,18 @@ from django.contrib import admin -from import_export.admin import ImportExportModelAdmin -from import_export.resources import ModelResource -from import_export.fields import Field import import_export.widgets as widgets - -from .models import StockLocation, StockItem, StockItemAttachment -from .models import StockItemTracking -from .models import StockItemTestResult +from import_export.admin import ImportExportModelAdmin +from import_export.fields import Field +from import_export.resources import ModelResource from build.models import Build from company.models import Company, SupplierPart from order.models import PurchaseOrder, SalesOrder from part.models import Part +from .models import (StockItem, StockItemAttachment, StockItemTestResult, + StockItemTracking, StockLocation) + class LocationResource(ModelResource): """ Class for managing StockLocation data import/export """ diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index 7bb5d7000b..4bc21df5a9 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -6,48 +6,36 @@ from collections import OrderedDict from datetime import datetime, timedelta from django.core.exceptions import ValidationError as DjangoValidationError -from django.urls import include, path, re_path -from django.http import JsonResponse -from django.db.models import Q, F from django.db import transaction +from django.db.models import F, Q +from django.http import JsonResponse +from django.urls import include, path, re_path from django.utils.translation import gettext_lazy as _ -from django_filters.rest_framework import DjangoFilterBackend from django_filters import rest_framework as rest_filters - -from rest_framework import status -from rest_framework.serializers import ValidationError +from django_filters.rest_framework import DjangoFilterBackend +from rest_framework import filters, generics, status from rest_framework.response import Response -from rest_framework import generics, filters +from rest_framework.serializers import ValidationError -from build.models import Build - -import common.settings import common.models - +import common.settings +import stock.serializers as StockSerializers +from build.models import Build from company.models import Company, SupplierPart from company.serializers import CompanySerializer, SupplierPartSerializer - -from InvenTree.helpers import str2bool, isNull, extract_serial_numbers -from InvenTree.helpers import DownloadFile -from InvenTree.api import AttachmentMixin, APIDownloadMixin +from InvenTree.api import APIDownloadMixin, AttachmentMixin from InvenTree.filters import InvenTreeOrderingFilter - -from order.models import PurchaseOrder -from order.models import SalesOrder, SalesOrderAllocation +from InvenTree.helpers import (DownloadFile, extract_serial_numbers, isNull, + str2bool) +from order.models import PurchaseOrder, SalesOrder, SalesOrderAllocation from order.serializers import PurchaseOrderSerializer - from part.models import BomItem, Part, PartCategory from part.serializers import PartBriefSerializer - from plugin.serializers import MetadataSerializer - from stock.admin import StockItemResource -from stock.models import StockLocation, StockItem -from stock.models import StockItemTracking -from stock.models import StockItemAttachment -from stock.models import StockItemTestResult -import stock.serializers as StockSerializers +from stock.models import (StockItem, StockItemAttachment, StockItemTestResult, + StockItemTracking, StockLocation) class StockDetail(generics.RetrieveUpdateDestroyAPIView): diff --git a/InvenTree/stock/models.py b/InvenTree/stock/models.py index 6cd0469b75..3faea832d9 100644 --- a/InvenTree/stock/models.py +++ b/InvenTree/stock/models.py @@ -3,49 +3,40 @@ Stock database model definitions """ import os +from datetime import datetime, timedelta +from decimal import Decimal, InvalidOperation + +from django.contrib.auth.models import User +from django.core.exceptions import FieldError, ValidationError +from django.core.validators import MinValueValidator +from django.db import models, transaction +from django.db.models import Q, Sum +from django.db.models.functions import Coalesce +from django.db.models.signals import post_delete, post_save, pre_delete +from django.dispatch import receiver +from django.urls import reverse +from django.utils.translation import gettext_lazy as _ from jinja2 import Template - -from django.utils.translation import gettext_lazy as _ -from django.core.exceptions import ValidationError, FieldError -from django.urls import reverse - -from django.db import models, transaction -from django.db.models import Sum, Q -from django.db.models.functions import Coalesce -from django.core.validators import MinValueValidator -from django.contrib.auth.models import User -from django.db.models.signals import pre_delete, post_save, post_delete -from django.dispatch import receiver - from markdownx.models import MarkdownxField - -from mptt.models import MPTTModel, TreeForeignKey from mptt.managers import TreeManager +from mptt.models import MPTTModel, TreeForeignKey -from decimal import Decimal, InvalidOperation -from datetime import datetime, timedelta - +import common.models import InvenTree.helpers import InvenTree.ready import InvenTree.tasks - -import common.models -import report.models import label.models - -from plugin.models import MetadataMixin -from plugin.events import trigger_event - -from InvenTree.status_codes import StockStatus, StockHistoryCode -from InvenTree.models import InvenTreeTree, InvenTreeAttachment -from InvenTree.fields import InvenTreeModelMoneyField, InvenTreeURLField -from InvenTree.serializers import extract_int - -from users.models import Owner - +import report.models from company import models as CompanyModels +from InvenTree.fields import InvenTreeModelMoneyField, InvenTreeURLField +from InvenTree.models import InvenTreeAttachment, InvenTreeTree +from InvenTree.serializers import extract_int +from InvenTree.status_codes import StockHistoryCode, StockStatus from part import models as PartModels +from plugin.events import trigger_event +from plugin.models import MetadataMixin +from users.models import Owner class StockLocation(MetadataMixin, InvenTreeTree): diff --git a/InvenTree/stock/serializers.py b/InvenTree/stock/serializers.py index 40303fc120..920052a0ec 100644 --- a/InvenTree/stock/serializers.py +++ b/InvenTree/stock/serializers.py @@ -2,39 +2,31 @@ JSON serializers for Stock app """ -from decimal import Decimal from datetime import datetime, timedelta -from django.db import transaction +from decimal import Decimal from django.core.exceptions import ValidationError as DjangoValidationError -from django.utils.translation import gettext_lazy as _ +from django.db import transaction +from django.db.models import BooleanField, Case, Q, Value, When from django.db.models.functions import Coalesce -from django.db.models import Case, When, Value -from django.db.models import BooleanField -from django.db.models import Q +from django.utils.translation import gettext_lazy as _ from rest_framework import serializers from rest_framework.serializers import ValidationError - -from sql_util.utils import SubquerySum, SubqueryCount - -from .models import StockItem, StockLocation -from .models import StockItemTracking -from .models import StockItemAttachment -from .models import StockItemTestResult +from sql_util.utils import SubqueryCount, SubquerySum import common.models -from common.settings import currency_code_default, currency_code_mappings - import company.models -from company.serializers import SupplierPartSerializer - import InvenTree.helpers import InvenTree.serializers +from common.settings import currency_code_default, currency_code_mappings +from company.serializers import SupplierPartSerializer from InvenTree.serializers import InvenTreeDecimalField, extract_int - from part.serializers import PartBriefSerializer +from .models import (StockItem, StockItemAttachment, StockItemTestResult, + StockItemTracking, StockLocation) + class LocationBriefSerializer(InvenTree.serializers.InvenTreeModelSerializer): """ diff --git a/InvenTree/stock/test_api.py b/InvenTree/stock/test_api.py index ccdac8d2c6..87d8bfaada 100644 --- a/InvenTree/stock/test_api.py +++ b/InvenTree/stock/test_api.py @@ -2,22 +2,21 @@ Unit testing for the Stock API """ -import os import io -import tablib - +import os from datetime import datetime, timedelta import django.http from django.urls import reverse + +import tablib from rest_framework import status -from InvenTree.status_codes import StockStatus -from InvenTree.api_tester import InvenTreeAPITestCase - -from common.models import InvenTreeSetting import company.models import part.models +from common.models import InvenTreeSetting +from InvenTree.api_tester import InvenTreeAPITestCase +from InvenTree.status_codes import StockStatus from stock.models import StockItem, StockLocation diff --git a/InvenTree/stock/test_views.py b/InvenTree/stock/test_views.py index d656201f81..dbe9a2a87e 100644 --- a/InvenTree/stock/test_views.py +++ b/InvenTree/stock/test_views.py @@ -1,9 +1,9 @@ """ Unit tests for Stock views (see views.py) """ -from django.test import TestCase -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse # from common.models import InvenTreeSetting diff --git a/InvenTree/stock/tests.py b/InvenTree/stock/tests.py index 97639b15bd..e0c09d8e34 100644 --- a/InvenTree/stock/tests.py +++ b/InvenTree/stock/tests.py @@ -1,17 +1,16 @@ -from django.test import TestCase -from django.db.models import Sum -from django.contrib.auth import get_user_model -from django.core.exceptions import ValidationError - import datetime -from InvenTree.status_codes import StockHistoryCode +from django.contrib.auth import get_user_model +from django.core.exceptions import ValidationError +from django.db.models import Sum +from django.test import TestCase -from .models import StockLocation, StockItem, StockItemTracking -from .models import StockItemTestResult - -from part.models import Part from build.models import Build +from InvenTree.status_codes import StockHistoryCode +from part.models import Part + +from .models import (StockItem, StockItemTestResult, StockItemTracking, + StockLocation) class StockTest(TestCase): diff --git a/InvenTree/stock/views.py b/InvenTree/stock/views.py index 15191b5fb7..f38d1777a6 100644 --- a/InvenTree/stock/views.py +++ b/InvenTree/stock/views.py @@ -4,26 +4,20 @@ Django views for interacting with Stock app from datetime import datetime -from django.views.generic import DetailView, ListView -from django.urls import reverse from django.http import HttpResponseRedirect - +from django.urls import reverse from django.utils.translation import gettext_lazy as _ - -from InvenTree.views import AjaxUpdateView, AjaxDeleteView, AjaxCreateView -from InvenTree.views import QRCodeView -from InvenTree.views import InvenTreeRoleMixin -from InvenTree.forms import ConfirmForm - -from InvenTree.helpers import str2bool - -from .models import StockItem, StockLocation, StockItemTracking +from django.views.generic import DetailView, ListView import common.settings +from InvenTree.forms import ConfirmForm +from InvenTree.helpers import str2bool +from InvenTree.views import (AjaxCreateView, AjaxDeleteView, AjaxUpdateView, + InvenTreeRoleMixin, QRCodeView) +from plugin.views import InvenTreePluginViewMixin from . import forms as StockForms - -from plugin.views import InvenTreePluginViewMixin +from .models import StockItem, StockItemTracking, StockLocation class StockIndex(InvenTreeRoleMixin, InvenTreePluginViewMixin, ListView): diff --git a/InvenTree/users/admin.py b/InvenTree/users/admin.py index 2784f28efe..2be478fa0e 100644 --- a/InvenTree/users/admin.py +++ b/InvenTree/users/admin.py @@ -1,15 +1,14 @@ +from django import forms +from django.contrib import admin, messages +from django.contrib.admin.widgets import FilteredSelectMultiple +from django.contrib.auth import get_user_model +from django.contrib.auth.admin import UserAdmin +from django.contrib.auth.models import Group +from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ -from django.contrib import admin, messages -from django import forms -from django.contrib.auth import get_user_model -from django.contrib.admin.widgets import FilteredSelectMultiple -from django.contrib.auth.models import Group -from django.contrib.auth.admin import UserAdmin -from django.utils.safestring import mark_safe - -from users.models import RuleSet, Owner +from users.models import Owner, RuleSet User = get_user_model() diff --git a/InvenTree/users/api.py b/InvenTree/users/api.py index 2a78abcbbf..d2b25ceb5b 100644 --- a/InvenTree/users/api.py +++ b/InvenTree/users/api.py @@ -1,19 +1,16 @@ from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist - from django.urls import include, path, re_path from django_filters.rest_framework import DjangoFilterBackend - -from rest_framework import filters, generics, permissions -from rest_framework.views import APIView +from rest_framework import filters, generics, permissions, status from rest_framework.authtoken.models import Token from rest_framework.response import Response -from rest_framework import status +from rest_framework.views import APIView -from users.models import RuleSet, Owner, check_user_role -from users.serializers import UserSerializer, OwnerSerializer +from users.models import Owner, RuleSet, check_user_role +from users.serializers import OwnerSerializer, UserSerializer class OwnerList(generics.ListAPIView): diff --git a/InvenTree/users/apps.py b/InvenTree/users/apps.py index b610e23488..b20927f0ed 100644 --- a/InvenTree/users/apps.py +++ b/InvenTree/users/apps.py @@ -1,6 +1,5 @@ -from django.db.utils import OperationalError, ProgrammingError - from django.apps import AppConfig +from django.db.utils import OperationalError, ProgrammingError from InvenTree.ready import canAppAccessDatabase @@ -25,6 +24,7 @@ class UsersConfig(AppConfig): def assign_permissions(self): from django.contrib.auth.models import Group + from users.models import RuleSet, update_group_roles # First, delete any rule_set objects which have become outdated! @@ -42,6 +42,7 @@ class UsersConfig(AppConfig): from django.contrib.auth import get_user_model from django.contrib.auth.models import Group + from users.models import Owner # Create group owners diff --git a/InvenTree/users/models.py b/InvenTree/users/models.py index 3c33614b97..be5fac1641 100644 --- a/InvenTree/users/models.py +++ b/InvenTree/users/models.py @@ -1,23 +1,21 @@ # -*- coding: utf-8 -*- -from django.urls import reverse +import logging + from django.contrib.auth import get_user_model from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType -from django.db.models import UniqueConstraint, Q -from django.db.utils import IntegrityError from django.db import models +from django.db.models import Q, UniqueConstraint +from django.db.models.signals import post_delete, post_save +from django.db.utils import IntegrityError +from django.dispatch import receiver +from django.urls import reverse from django.utils.translation import gettext_lazy as _ -from django.dispatch import receiver -from django.db.models.signals import post_save, post_delete - -import logging - from InvenTree.ready import canAppAccessDatabase - logger = logging.getLogger("inventree") diff --git a/InvenTree/users/serializers.py b/InvenTree/users/serializers.py index 2202cf299c..fcf1ed5678 100644 --- a/InvenTree/users/serializers.py +++ b/InvenTree/users/serializers.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- -from rest_framework import serializers from django.contrib.auth.models import User -from .models import Owner +from rest_framework import serializers from InvenTree.serializers import InvenTreeModelSerializer +from .models import Owner + class UserSerializer(InvenTreeModelSerializer): """ Serializer for a User diff --git a/InvenTree/users/tests.py b/InvenTree/users/tests.py index 9dc90f5d2c..f545acc682 100644 --- a/InvenTree/users/tests.py +++ b/InvenTree/users/tests.py @@ -1,12 +1,12 @@ -from django.test import TestCase from django.apps import apps -from django.urls import reverse from django.contrib.auth import get_user_model from django.contrib.auth.models import Group +from django.test import TestCase +from django.urls import reverse from rest_framework.authtoken.models import Token -from users.models import RuleSet, Owner +from users.models import Owner, RuleSet class RuleSetModelTest(TestCase): diff --git a/ci/check_api_endpoint.py b/ci/check_api_endpoint.py index 0d110379ef..dffacfcf3a 100644 --- a/ci/check_api_endpoint.py +++ b/ci/check_api_endpoint.py @@ -3,6 +3,7 @@ Test that the root API endpoint is available. """ import json + import requests # We expect the server to be running on the local host diff --git a/ci/check_js_templates.py b/ci/check_js_templates.py index 4f35e57eb4..84e5198982 100644 --- a/ci/check_js_templates.py +++ b/ci/check_js_templates.py @@ -7,10 +7,10 @@ This is because the "translated" javascript files are compiled into the "static" They should only contain template tags that render static information. """ -import sys -import re import os import pathlib +import re +import sys here = os.path.abspath(os.path.dirname(__file__)) template_dir = os.path.abspath(os.path.join(here, '..', 'InvenTree', 'templates')) diff --git a/ci/check_locale_files.py b/ci/check_locale_files.py index d17fe27e3d..808e3ab797 100644 --- a/ci/check_locale_files.py +++ b/ci/check_locale_files.py @@ -1,7 +1,7 @@ """ Check that there are no database migration files which have not been committed. """ -import sys import subprocess +import sys print("Checking for uncommitted locale files...") diff --git a/ci/check_migration_files.py b/ci/check_migration_files.py index 16bd87485d..2f40d49a9d 100644 --- a/ci/check_migration_files.py +++ b/ci/check_migration_files.py @@ -1,7 +1,7 @@ """ Check that there are no database migration files which have not been committed. """ -import sys import subprocess +import sys print("Checking for unstaged migration files...") diff --git a/ci/check_version_number.py b/ci/check_version_number.py index 732102ff52..3845cdfe27 100644 --- a/ci/check_version_number.py +++ b/ci/check_version_number.py @@ -2,10 +2,10 @@ On release, ensure that the release tag matches the InvenTree version number! """ -import sys -import re -import os import argparse +import os +import re +import sys if __name__ == '__main__': diff --git a/docker/gunicorn.conf.py b/docker/gunicorn.conf.py index 67b098fcb4..291f3ff198 100644 --- a/docker/gunicorn.conf.py +++ b/docker/gunicorn.conf.py @@ -1,7 +1,6 @@ +import logging import multiprocessing import os -import logging - logger = logging.getLogger('inventree') diff --git a/tasks.py b/tasks.py index 43b240e6bf..a5d1ac0e5b 100644 --- a/tasks.py +++ b/tasks.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -import os import json -import sys +import os import pathlib import re +import sys from invoke import task From 4868947be0eddfe003fa2b5d1a8a509c58e93098 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 17:25:50 +0200 Subject: [PATCH 5/6] remove comments from imports --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index f1b744aa0f..3aa96371ec 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,6 +28,4 @@ source = ./InvenTree src_paths=InvenTree skip_glob =*/migrations/*.py known_django=django -import_heading_firstparty=InvenTree imports -import_heading_thirdparty=Third-Party imports sections=FUTURE, STDLIB, DJANGO, THIRDPARTY, FIRSTPARTY, LOCALFOLDER From c50456297e21ca90799d5212673ee0af9f9306ec Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Fri, 20 May 2022 17:27:08 +0200 Subject: [PATCH 6/6] fix assertation --- InvenTree/plugin/test_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/plugin/test_helpers.py b/InvenTree/plugin/test_helpers.py index 5187b30619..1b9cd104cc 100644 --- a/InvenTree/plugin/test_helpers.py +++ b/InvenTree/plugin/test_helpers.py @@ -15,7 +15,7 @@ class HelperTests(TestCase): # working sample response = render_template(ErrorSource(), 'sample/sample.html', {'abc': 123}) - self.assertEqual(response, '

    123

    ') + self.assertEqual(response, '

    123

    \n') # Wrong sample response = render_template(ErrorSource(), 'sample/wrongsample.html', {'abc': 123})