mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 19:45:46 +00:00
[Pricing] Add option to convert received items currency (#8970)
* Add new global setting * Convert to base currency on receipt * Fix total price rendering in PO table * Fix for tasks.py * Update .gitignore - Ignore auto-generated files * Update docs Improved documentation for pricing/currency support * Updates * Fix caching for default currency - Now managed better by session caching * Add unit test for new feature * Playwright test fixes * Validate copying of media files * Validate media files * Adjust playwright setup * Allow multiple attempts to fetch release information * Tweak unit tests * Revert changes to .gitignore file - Just trying stuff at this point * Add debug msg * Try hard-coded paths * Remove debug prints * Abs path for database * More debug * Fix typos * Revert change to db name * Remove debug statements (again) * Cleanup playwright tests * More test tweaks --------- Co-authored-by: Matthias Mair <code@mjmair.com>
This commit is contained in:
49
tasks.py
49
tasks.py
@ -428,7 +428,9 @@ def rebuild_models(c):
|
||||
@task
|
||||
def rebuild_thumbnails(c):
|
||||
"""Rebuild missing image thumbnails."""
|
||||
info('Rebuilding image thumbnails')
|
||||
from src.backend.InvenTree.InvenTree.config import get_media_dir
|
||||
|
||||
info(f'Rebuilding image thumbnails in {get_media_dir()}')
|
||||
manage(c, 'rebuild_thumbnails', pty=True)
|
||||
|
||||
|
||||
@ -1125,8 +1127,19 @@ def test(
|
||||
manage(c, cmd, pty=pty)
|
||||
|
||||
|
||||
@task(help={'dev': 'Set up development environment at the end'})
|
||||
def setup_test(c, ignore_update=False, dev=False, path='inventree-demo-dataset'):
|
||||
@task(
|
||||
help={
|
||||
'dev': 'Set up development environment at the end',
|
||||
'validate_files': 'Validate media files are correctly copied',
|
||||
}
|
||||
)
|
||||
def setup_test(
|
||||
c,
|
||||
ignore_update=False,
|
||||
dev=False,
|
||||
validate_files=False,
|
||||
path='inventree-demo-dataset',
|
||||
):
|
||||
"""Setup a testing environment."""
|
||||
from src.backend.InvenTree.InvenTree.config import get_media_dir
|
||||
|
||||
@ -1156,13 +1169,35 @@ def setup_test(c, ignore_update=False, dev=False, path='inventree-demo-dataset')
|
||||
import_records(c, filename=template_dir.joinpath('inventree_data.json'), clear=True)
|
||||
|
||||
# Copy media files
|
||||
info('Copying media files ...')
|
||||
src = template_dir.joinpath('media')
|
||||
dst = get_media_dir()
|
||||
|
||||
info(f'Copying media files - "{src}" to "{dst}"')
|
||||
shutil.copytree(src, dst, dirs_exist_ok=True)
|
||||
|
||||
if validate_files:
|
||||
info(' - Validating media files')
|
||||
missing = False
|
||||
# Check that the media files are correctly copied across
|
||||
for dirpath, _dirnames, filenames in os.walk(src):
|
||||
rel_path = os.path.relpath(dirpath, src)
|
||||
dst_path = os.path.join(dst, rel_path)
|
||||
|
||||
if not os.path.exists(dst_path):
|
||||
error(f' - Missing directory: {dst_path}')
|
||||
missing = True
|
||||
continue
|
||||
|
||||
for filename in filenames:
|
||||
dst_file = os.path.join(dst_path, filename)
|
||||
if not os.path.exists(dst_file):
|
||||
missing = True
|
||||
error(f' - Missing file: {dst_file}')
|
||||
|
||||
if missing:
|
||||
raise FileNotFoundError('Media files not correctly copied')
|
||||
else:
|
||||
success(' - All media files correctly copied')
|
||||
|
||||
info('Done setting up test environment...')
|
||||
|
||||
# Set up development setup if flag is set
|
||||
@ -1587,9 +1622,7 @@ via your signed in browser, or consider using a point release download via invok
|
||||
def docs_server(c, address='localhost:8080', compile_schema=False):
|
||||
"""Start a local mkdocs server to view the documentation."""
|
||||
# Extract settings definitions
|
||||
export_settings_definitions(
|
||||
c, filename='docs/inventree_settings.json', overwrite=True
|
||||
)
|
||||
export_definitions(c, basedir='docs')
|
||||
|
||||
if compile_schema:
|
||||
# Build the schema docs first
|
||||
|
Reference in New Issue
Block a user