mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
* fix spelling Thanks @Stephano120 Good catch! * add migration * I18n merge (#2582) * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Adds a warning if no build outputs are created * Throw validation error if no build outputs have been started * Prevent AttributeError from being thrown Ref: https://github.com/inventree/InvenTree/issues/2587 * fix: use default storage backend for Maint Mode * Experimenting with children models permissions * Prevent build outputs being created with zero quantity * PEP style fixes * Reload build output table when an active build output is deleted * Reload completed output table * Fixes issue with BOM export - Cascading BOM export was broken * Boolean settings are now directly clickable * Layout changes * Display error if setting update failes * Skips some specific steps when importing data - We need to prevent certain operations from running when we are importing data - This is to prevent unique database constraints from being violated - Do not register plugins during data import - Do not launch notification events * PEP fixes * Adds new setting to optionally display or hide part pricing information * Hide pricing history tab if not enabled * Only calculate pricing data if required * Disable multi-level BOM requests * Adds serializer for uploading a BOM file and extracting fields * Fix existing bug with BomExport functionality - could not select BOM format * POST request now returns extracted data rows (as an array of dicts) * Attempt to auto-extract part information based on provided data * Basic javascript function to construct BOM table from extracted data * Initialize related field for "part" selection * Add callback for "remove row" button * Construct required form fields - required some additional functionality in forms.js * Add "clear input" callback function * Add optional part lookup by "part" field * Allow decimal values for BOM overage * Adds a BomUpload endpoint to handle upload of complete BOM * Check for duplicate BOM items as part of serializer validation * bug fix * Adds options to clear existing BOM data when uploading * Update upload file template * Remove old templates * PEP fixes * Handle errors when connecting to currency exchange - Also adds timeout when connecting * JS linting * Only update rates on server launch if there are no rates available * PEP fixes * unit test fixes * Do not hide the "submit order" button * Remove incorrect validation routine * Refactored and added permission check for children models * Reverted print statement to logger * Improved approach to permission check at runtime * Fix logic for enabling "place order" button * Update README.md Add "follow on twitter" button * Allow POST of files for unit testing * Update README.md Reorder sections * Catch potential file processing errors * Add unit testing for uploading invalid BOM files * Raise error if imported dataset contains no data rows * Return per-row error messages when extracting data * PEP fixes * Adds check for duplicate parts when importing * Increased error checking when uploading BOM data * Catch potential error when posting invalid numbers via REST API * Improve part "guess" algorithm * Display initial errors when importing data * Add button to display original row data * Disable "submit" button to prevent multiple simultaneous uploads * Add more unit testing for BOM file upload - Test "levels" functionality - Test part guessing / introspection * Adds API endpoint to delete build outputs * Remove old form code which is no longer used * Cleanup * js linting * Update base django version * fix quotes * ignore the django import check * ignore import error * ignore migration * ignore branches * remove coverage from parts migrations * fix migration coverage for orders * fix migration coverage for company * fix migration coverage for build * simpler coverage ignore * run test paralell * ignore coverage on ruleset checks * remove dead code * move up comment so unneeded functions are not not covered * remove dead code * ignore database not ready * imports are not tested * no test for malformed paths * ignore exception ref * only run sqlite paralell * fix import * remove dead code * PEP fix * ignore wrong control view safeties * ignore controls that should not be reached in coverage * test wrong setting defaults * remove paralell coverage * fix setting coverage * Remove settings mods * Pep * Allow BOM file to be "re-uploaded" * ignore ci render_test * add comment about function * ignore debug toolbar * app not ready can not be simulated by tests * use same style for AppNotReady Exception * database not ready events are hard to reproduce consistently * remove dead test * ignore not testable condition * ignore coverage in exsisting migrations * will never be true in testing * add test for system healt checks * test test mode * test Isimporting * ignore whole file * ignore system exit conditions in coverage * ignore testing coditions in coverage * do not cover secret key * ignore db optm in coverage * ignore some default in coverage * ignore currently dead code in coverage * ignore wsgi * remove dead code * should not be reached - ignore in cov * ignore sanity checks for coverage * update system health check * fix label tests * omit coverage via setup.cfg * fix reporting emition * catch more explicit * fix coverage * except import errors * add coverage for labels * PEP fix * do not count unreachable code * ignore unreachable things * user api tests * PEP fix * remove coverage that is not reachable * remove cov from not used feature * remove dead code * make git log call simpler * return cov from feature only used for debug * should not be reached * add more plugin coverage * PEP fixes * spellcheck * add test for non existing token * remove dead code -> permission class does that already * add more user api tests * disable broken test * Enforce proper formatting for 'quantity' field when importing BOM data * Adds unit tests for index page Some fairly simple unit tests to ensure that the index page is being correctly loaded. * Adds a new API endpoint for creating build outputs * Adds query function to Part model to return trackable parts in the BOM * Extract serial numbers from submitted form data * Optionally auto-allocate stock items when creating a new build output * remove code which is now unused * PEP style fixes * Form improvements * Automatically select Bom Items with matching serial numbers when allocating stock to a build order output * Adds generic API endpoint for extracting data from a tabulated file * Adds model mixin for generically determining which fields can be imported on any particular model * Adds functionality to map file columns to model fiels * Refactoring API endpoints - Improved URL naming scheme * Adds generic javascript function for mapping file columns to model fields * Adds a button to quickly "pass" a test * js linting * Fix field name * unit test fixes * Fix breadcrumb tree for stock item page * Create FUNDING.yml Add sponsor file * Update FUNDING.yml Add ko_fi username * Spelling fix * Implement unit test for missing columns * Improve unit testing * Further improvements to unit tests * Adds information on test result being deleted * Adds "refresh" button for stock test table * Ensure unit tests are more resilient * Adds API endpoint for installing stock items into other stock items - Requires more filtering for the Part API - Adds more BOM related functionality for Part model - Removes old server-side form * PEP fixes * Critical bug fix: Check if serial numbers already exist when creating new StockItem * Allow processing of "null" cells (caused by xls / xlsx import) * Reintroduce option to clear (delete) BOM before uploading new data * When uploading a report template, keep the existing filename (if it is the same report!) * Improved error messages when report templates (or snippets) are missing! * Delete template files from cache as they are uploaded * Set default error message visibility in modal options * remove unused code * remove unneeded assignment * merge satement * merge statments * remove unneeded continue * PEP fix * I18n merge (#2647) * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * fix caps * fix string concat * use f-string annotation * I18n release merge (#2654) * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix: New translations django.po from Crowdin * Fix conflict * Removes outdated templates Co-authored-by: Matthias Mair <66015116+matmair@users.noreply.github.com> Co-authored-by: Matthias <matthias.mair@oewf.org> Co-authored-by: Nigel <nigel.w@nosun.ca> Co-authored-by: eeintech <eeintech@eeinte.ch>
577 lines
13 KiB
Python
577 lines
13 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
import json
|
|
import sys
|
|
import pathlib
|
|
import re
|
|
|
|
try:
|
|
from invoke import ctask as task
|
|
except:
|
|
from invoke import task
|
|
|
|
|
|
def apps():
|
|
"""
|
|
Returns a list of installed apps
|
|
"""
|
|
|
|
return [
|
|
'barcode',
|
|
'build',
|
|
'common',
|
|
'company',
|
|
'label',
|
|
'order',
|
|
'part',
|
|
'report',
|
|
'stock',
|
|
'InvenTree',
|
|
'users',
|
|
]
|
|
|
|
|
|
def localDir():
|
|
"""
|
|
Returns the directory of *THIS* file.
|
|
Used to ensure that the various scripts always run
|
|
in the correct directory.
|
|
"""
|
|
return os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
def managePyDir():
|
|
"""
|
|
Returns the directory of the manage.py file
|
|
"""
|
|
|
|
return os.path.join(localDir(), 'InvenTree')
|
|
|
|
|
|
def managePyPath():
|
|
"""
|
|
Return the path of the manage.py file
|
|
"""
|
|
|
|
return os.path.join(managePyDir(), 'manage.py')
|
|
|
|
|
|
def manage(c, cmd, pty=False):
|
|
"""
|
|
Runs a given command against django's "manage.py" script.
|
|
|
|
Args:
|
|
c - Command line context
|
|
cmd - django command to run
|
|
"""
|
|
|
|
result = c.run('cd "{path}" && python3 manage.py {cmd}'.format(
|
|
path=managePyDir(),
|
|
cmd=cmd
|
|
), pty=pty)
|
|
|
|
@task
|
|
def plugins(c):
|
|
"""
|
|
Installs all plugins as specified in 'plugins.txt'
|
|
"""
|
|
|
|
from InvenTree.InvenTree.config import get_plugin_file
|
|
|
|
plugin_file = get_plugin_file()
|
|
|
|
print(f"Installing plugin packages from '{plugin_file}'")
|
|
|
|
# Install the plugins
|
|
c.run(f"pip3 install -U -r '{plugin_file}'")
|
|
|
|
@task(post=[plugins])
|
|
def install(c):
|
|
"""
|
|
Installs required python packages
|
|
"""
|
|
|
|
print("Installing required python packages from 'requirements.txt'")
|
|
|
|
# Install required Python packages with PIP
|
|
c.run('pip3 install -U -r requirements.txt')
|
|
|
|
@task
|
|
def shell(c):
|
|
"""
|
|
Open a python shell with access to the InvenTree database models.
|
|
"""
|
|
|
|
manage(c, 'shell', pty=True)
|
|
|
|
|
|
@task
|
|
def superuser(c):
|
|
"""
|
|
Create a superuser (admin) account for the database.
|
|
"""
|
|
|
|
manage(c, 'createsuperuser', pty=True)
|
|
|
|
|
|
@task
|
|
def check(c):
|
|
"""
|
|
Check validity of django codebase
|
|
"""
|
|
|
|
manage(c, "check")
|
|
|
|
|
|
@task
|
|
def wait(c):
|
|
"""
|
|
Wait until the database connection is ready
|
|
"""
|
|
|
|
return manage(c, "wait_for_db")
|
|
|
|
|
|
@task(pre=[wait])
|
|
def worker(c):
|
|
"""
|
|
Run the InvenTree background worker process
|
|
"""
|
|
|
|
manage(c, 'qcluster', pty=True)
|
|
|
|
|
|
@task
|
|
def rebuild_models(c):
|
|
"""
|
|
Rebuild database models with MPTT structures
|
|
"""
|
|
|
|
manage(c, "rebuild_models", pty=True)
|
|
|
|
|
|
@task
|
|
def rebuild_thumbnails(c):
|
|
"""
|
|
Rebuild missing image thumbnails
|
|
"""
|
|
|
|
manage(c, "rebuild_thumbnails", pty=True)
|
|
|
|
|
|
@task
|
|
def clean_settings(c):
|
|
"""
|
|
Clean the setting tables of old settings
|
|
"""
|
|
|
|
manage(c, "clean_settings")
|
|
|
|
|
|
@task(help={'mail': 'mail of the user whos MFA should be disabled'})
|
|
def remove_mfa(c, mail=''):
|
|
"""
|
|
Remove MFA for a user
|
|
"""
|
|
|
|
if not mail:
|
|
print('You must provide a users mail')
|
|
|
|
manage(c, f"remove_mfa {mail}")
|
|
|
|
|
|
@task(post=[rebuild_models, rebuild_thumbnails])
|
|
def migrate(c):
|
|
"""
|
|
Performs database migrations.
|
|
This is a critical step if the database schema have been altered!
|
|
"""
|
|
|
|
print("Running InvenTree database migrations...")
|
|
print("========================================")
|
|
|
|
manage(c, "makemigrations")
|
|
manage(c, "migrate --noinput")
|
|
manage(c, "migrate --run-syncdb")
|
|
manage(c, "check")
|
|
|
|
print("========================================")
|
|
print("InvenTree database migrations completed!")
|
|
|
|
|
|
@task
|
|
def static(c):
|
|
"""
|
|
Copies required static files to the STATIC_ROOT directory,
|
|
as per Django requirements.
|
|
"""
|
|
|
|
manage(c, "prerender")
|
|
manage(c, "collectstatic --no-input")
|
|
|
|
|
|
@task
|
|
def translate_stats(c):
|
|
"""
|
|
Collect translation stats.
|
|
The file generated from this is needed for the UI.
|
|
"""
|
|
|
|
path = os.path.join('InvenTree', 'script', 'translation_stats.py')
|
|
c.run(f'python3 {path}')
|
|
|
|
|
|
@task(post=[translate_stats, static])
|
|
def translate(c):
|
|
"""
|
|
Regenerate translation files.
|
|
|
|
Run this command after added new translatable strings,
|
|
or after adding translations for existing strings.
|
|
"""
|
|
|
|
# Translate applicable .py / .html / .js files
|
|
manage(c, "makemessages --all -e py,html,js --no-wrap")
|
|
manage(c, "compilemessages")
|
|
|
|
|
|
@task(pre=[install, migrate, translate_stats, static, clean_settings])
|
|
def update(c):
|
|
"""
|
|
Update InvenTree installation.
|
|
|
|
This command should be invoked after source code has been updated,
|
|
e.g. downloading new code from GitHub.
|
|
|
|
The following tasks are performed, in order:
|
|
|
|
- install
|
|
- migrate
|
|
- translate_stats
|
|
- static
|
|
- clean_settings
|
|
"""
|
|
pass
|
|
|
|
|
|
@task
|
|
def style(c):
|
|
"""
|
|
Run PEP style checks against InvenTree sourcecode
|
|
"""
|
|
|
|
print("Running PEP style checks...")
|
|
c.run('flake8 InvenTree')
|
|
|
|
|
|
@task
|
|
def test(c, database=None):
|
|
"""
|
|
Run unit-tests for InvenTree codebase.
|
|
"""
|
|
# Run sanity check on the django install
|
|
manage(c, 'check')
|
|
|
|
# Run coverage tests
|
|
manage(c, 'test', pty=True)
|
|
|
|
|
|
@task
|
|
def coverage(c):
|
|
"""
|
|
Run code-coverage of the InvenTree codebase,
|
|
using the 'coverage' code-analysis tools.
|
|
|
|
Generates a code coverage report (available in the htmlcov directory)
|
|
"""
|
|
|
|
# Run sanity check on the django install
|
|
manage(c, 'check')
|
|
|
|
# Run coverage tests
|
|
c.run('coverage run {manage} test {apps}'.format(
|
|
manage=managePyPath(),
|
|
apps=' '.join(apps())
|
|
))
|
|
|
|
# Generate coverage report
|
|
c.run('coverage html')
|
|
|
|
|
|
def content_excludes():
|
|
"""
|
|
Returns a list of content types to exclude from import/export
|
|
"""
|
|
|
|
excludes = [
|
|
"contenttypes",
|
|
"auth.permission",
|
|
"authtoken.token",
|
|
"error_report.error",
|
|
"admin.logentry",
|
|
"django_q.schedule",
|
|
"django_q.task",
|
|
"django_q.ormq",
|
|
"users.owner",
|
|
"exchange.rate",
|
|
"exchange.exchangebackend",
|
|
"common.notificationentry",
|
|
"user_sessions.session",
|
|
]
|
|
|
|
output = ""
|
|
|
|
for e in excludes:
|
|
output += f"--exclude {e} "
|
|
|
|
return output
|
|
|
|
|
|
@task(help={'filename': "Output filename (default = 'data.json')"})
|
|
def export_records(c, filename='data.json'):
|
|
"""
|
|
Export all database records to a file
|
|
"""
|
|
|
|
# Get an absolute path to the file
|
|
if not os.path.isabs(filename):
|
|
filename = os.path.join(localDir(), filename)
|
|
filename = os.path.abspath(filename)
|
|
|
|
print(f"Exporting database records to file '{filename}'")
|
|
|
|
if os.path.exists(filename):
|
|
response = input("Warning: file already exists. Do you want to overwrite? [y/N]: ")
|
|
response = str(response).strip().lower()
|
|
|
|
if response not in ['y', 'yes']:
|
|
print("Cancelled export operation")
|
|
sys.exit(1)
|
|
|
|
tmpfile = f"{filename}.tmp"
|
|
|
|
cmd = f"dumpdata --indent 2 --output '{tmpfile}' {content_excludes()}"
|
|
|
|
# Dump data to temporary file
|
|
manage(c, cmd, pty=True)
|
|
|
|
print("Running data post-processing step...")
|
|
|
|
# Post-process the file, to remove any "permissions" specified for a user or group
|
|
with open(tmpfile, "r") as f_in:
|
|
data = json.loads(f_in.read())
|
|
|
|
for entry in data:
|
|
if "model" in entry:
|
|
|
|
# Clear out any permissions specified for a group
|
|
if entry["model"] == "auth.group":
|
|
entry["fields"]["permissions"] = []
|
|
|
|
# Clear out any permissions specified for a user
|
|
if entry["model"] == "auth.user":
|
|
entry["fields"]["user_permissions"] = []
|
|
|
|
# Write the processed data to file
|
|
with open(filename, "w") as f_out:
|
|
f_out.write(json.dumps(data, indent=2))
|
|
|
|
print("Data export completed")
|
|
|
|
|
|
@task(help={'filename': 'Input filename'}, post=[rebuild_models, rebuild_thumbnails])
|
|
def import_records(c, filename='data.json'):
|
|
"""
|
|
Import database records from a file
|
|
"""
|
|
|
|
# Get an absolute path to the supplied filename
|
|
if not os.path.isabs(filename):
|
|
filename = os.path.join(localDir(), filename)
|
|
|
|
if not os.path.exists(filename):
|
|
print(f"Error: File '{filename}' does not exist")
|
|
sys.exit(1)
|
|
|
|
print(f"Importing database records from '{filename}'")
|
|
|
|
# Pre-process the data, to remove any "permissions" specified for a user or group
|
|
tmpfile = f"{filename}.tmp.json"
|
|
|
|
with open(filename, "r") as f_in:
|
|
data = json.loads(f_in.read())
|
|
|
|
for entry in data:
|
|
if "model" in entry:
|
|
|
|
# Clear out any permissions specified for a group
|
|
if entry["model"] == "auth.group":
|
|
entry["fields"]["permissions"] = []
|
|
|
|
# Clear out any permissions specified for a user
|
|
if entry["model"] == "auth.user":
|
|
entry["fields"]["user_permissions"] = []
|
|
|
|
# Write the processed data to the tmp file
|
|
with open(tmpfile, "w") as f_out:
|
|
f_out.write(json.dumps(data, indent=2))
|
|
|
|
cmd = f"loaddata '{tmpfile}' -i {content_excludes()}"
|
|
|
|
manage(c, cmd, pty=True)
|
|
|
|
print("Data import completed")
|
|
|
|
|
|
@task
|
|
def delete_data(c, force=False):
|
|
"""
|
|
Delete all database records!
|
|
|
|
Warning: This will REALLY delete all records in the database!!
|
|
"""
|
|
|
|
if force:
|
|
manage(c, 'flush --noinput')
|
|
else:
|
|
manage(c, 'flush')
|
|
|
|
|
|
@task(post=[rebuild_models, rebuild_thumbnails])
|
|
def import_fixtures(c):
|
|
"""
|
|
Import fixture data into the database.
|
|
|
|
This command imports all existing test fixture data into the database.
|
|
|
|
Warning:
|
|
- Intended for testing / development only!
|
|
- Running this command may overwrite existing database data!!
|
|
- Don't say you were not warned...
|
|
"""
|
|
|
|
fixtures = [
|
|
# Build model
|
|
'build',
|
|
|
|
# Common models
|
|
'settings',
|
|
|
|
# Company model
|
|
'company',
|
|
'price_breaks',
|
|
'supplier_part',
|
|
|
|
# Order model
|
|
'order',
|
|
|
|
# Part model
|
|
'bom',
|
|
'category',
|
|
'params',
|
|
'part',
|
|
'test_templates',
|
|
|
|
# Stock model
|
|
'location',
|
|
'stock_tests',
|
|
'stock',
|
|
|
|
# Users
|
|
'users'
|
|
]
|
|
|
|
command = 'loaddata ' + ' '.join(fixtures)
|
|
|
|
manage(c, command, pty=True)
|
|
|
|
|
|
@task(help={'address': 'Server address:port (default=127.0.0.1:8000)'})
|
|
def server(c, address="127.0.0.1:8000"):
|
|
"""
|
|
Launch a (deveopment) server using Django's in-built webserver.
|
|
|
|
Note: This is *not* sufficient for a production installation.
|
|
"""
|
|
|
|
manage(c, "runserver {address}".format(address=address), pty=True)
|
|
|
|
|
|
@task(post=[translate_stats, static, server])
|
|
def test_translations(c):
|
|
"""
|
|
Add a fictional language to test if each component is ready for translations
|
|
"""
|
|
import django
|
|
from django.conf import settings
|
|
|
|
# setup django
|
|
base_path = os.getcwd()
|
|
new_base_path = pathlib.Path('InvenTree').absolute()
|
|
sys.path.append(str(new_base_path))
|
|
os.chdir(new_base_path)
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'InvenTree.settings')
|
|
django.setup()
|
|
|
|
# Add language
|
|
print("Add dummy language...")
|
|
print("========================================")
|
|
manage(c, "makemessages -e py,html,js --no-wrap -l xx")
|
|
|
|
# change translation
|
|
print("Fill in dummy translations...")
|
|
print("========================================")
|
|
|
|
file_path = pathlib.Path(settings.LOCALE_PATHS[0], 'xx', 'LC_MESSAGES', 'django.po')
|
|
new_file_path = str(file_path) + '_new'
|
|
|
|
# complie regex
|
|
reg = re.compile(
|
|
r"[a-zA-Z0-9]{1}"+ # match any single letter and number
|
|
r"(?![^{\(\<]*[}\)\>])"+ # that is not inside curly brackets, brackets or a tag
|
|
r"(?<![^\%][^\(][)][a-z])"+ # that is not a specially formatted variable with singles
|
|
r"(?![^\\][\n])" # that is not a newline
|
|
)
|
|
last_string = ''
|
|
|
|
# loop through input file lines
|
|
with open(file_path, "rt") as file_org:
|
|
with open(new_file_path, "wt") as file_new:
|
|
for line in file_org:
|
|
if line.startswith('msgstr "'):
|
|
# write output -> replace regex matches with x in the read in (multi)string
|
|
file_new.write(f'msgstr "{reg.sub("x", last_string[7:-2])}"\n')
|
|
last_string = "" # reset (multi)string
|
|
elif line.startswith('msgid "'):
|
|
last_string = last_string + line # a new translatable string starts -> start append
|
|
file_new.write(line)
|
|
else:
|
|
if last_string:
|
|
last_string = last_string + line # a string is beeing read in -> continue appending
|
|
file_new.write(line)
|
|
|
|
# change out translation files
|
|
os.rename(file_path, str(file_path) + '_old')
|
|
os.rename(new_file_path, file_path)
|
|
|
|
# compile languages
|
|
print("Compile languages ...")
|
|
print("========================================")
|
|
manage(c, "compilemessages")
|
|
|
|
# reset cwd
|
|
os.chdir(base_path)
|
|
|
|
# set env flag
|
|
os.environ['TEST_TRANSLATIONS'] = 'True'
|
|
|
|
|
|
@task
|
|
def render_js_files(c):
|
|
"""
|
|
Render templated javascript files (used for static testing).
|
|
"""
|
|
|
|
manage(c, "test InvenTree.ci_render_js")
|