mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-08 16:28:49 +00:00
bump pre-commit refs (#8219)
This commit is contained in:
parent
5638895f54
commit
af6f179f7e
@ -17,7 +17,7 @@ repos:
|
|||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: mixed-line-ending
|
- id: mixed-line-ending
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.6.1
|
rev: v0.6.8
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
args: [--preview]
|
args: [--preview]
|
||||||
@ -28,7 +28,7 @@ repos:
|
|||||||
--preview
|
--preview
|
||||||
]
|
]
|
||||||
- repo: https://github.com/astral-sh/uv-pre-commit
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
||||||
rev: 0.2.37
|
rev: 0.4.17
|
||||||
hooks:
|
hooks:
|
||||||
- id: pip-compile
|
- id: pip-compile
|
||||||
name: pip-compile requirements-dev.in
|
name: pip-compile requirements-dev.in
|
||||||
@ -51,7 +51,7 @@ repos:
|
|||||||
args: [contrib/container/requirements.in, -o, contrib/container/requirements.txt, --python-version=3.11, --no-strip-extras, --generate-hashes]
|
args: [contrib/container/requirements.in, -o, contrib/container/requirements.txt, --python-version=3.11, --no-strip-extras, --generate-hashes]
|
||||||
files: contrib/container/requirements\.(in|txt)$
|
files: contrib/container/requirements\.(in|txt)$
|
||||||
- repo: https://github.com/Riverside-Healthcare/djLint
|
- repo: https://github.com/Riverside-Healthcare/djLint
|
||||||
rev: v1.34.1
|
rev: v1.35.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: djlint-django
|
- id: djlint-django
|
||||||
- repo: https://github.com/codespell-project/codespell
|
- repo: https://github.com/codespell-project/codespell
|
||||||
@ -78,7 +78,7 @@ repos:
|
|||||||
- "prettier@^2.4.1"
|
- "prettier@^2.4.1"
|
||||||
- "@trivago/prettier-plugin-sort-imports"
|
- "@trivago/prettier-plugin-sort-imports"
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||||
rev: "v9.9.0"
|
rev: "v9.11.1"
|
||||||
hooks:
|
hooks:
|
||||||
- id: eslint
|
- id: eslint
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
@ -90,7 +90,7 @@ repos:
|
|||||||
- "@typescript-eslint/parser"
|
- "@typescript-eslint/parser"
|
||||||
files: ^src/frontend/.*\.(js|jsx|ts|tsx)$
|
files: ^src/frontend/.*\.(js|jsx|ts|tsx)$
|
||||||
- repo: https://github.com/gitleaks/gitleaks
|
- repo: https://github.com/gitleaks/gitleaks
|
||||||
rev: v8.18.4
|
rev: v8.19.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: gitleaks
|
- id: gitleaks
|
||||||
#- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
#- repo: https://github.com/jumanjihouse/pre-commit-hooks
|
||||||
|
@ -53,6 +53,8 @@ ignore = [
|
|||||||
"N812",
|
"N812",
|
||||||
# - D417 Missing argument descriptions in the docstring
|
# - D417 Missing argument descriptions in the docstring
|
||||||
"D417",
|
"D417",
|
||||||
|
# - RUF032 - decimal-from-float-literal
|
||||||
|
"RUF032",
|
||||||
|
|
||||||
# TODO These should be followed up and fixed
|
# TODO These should be followed up and fixed
|
||||||
# - B904 Within an `except` clause, raise exceptions
|
# - B904 Within an `except` clause, raise exceptions
|
||||||
|
@ -133,9 +133,9 @@ class DatePickerFormField(forms.DateField):
|
|||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Set up custom values."""
|
"""Set up custom values."""
|
||||||
help_text = kwargs.get('help_text', _('Enter date'))
|
help_text = kwargs.get('help_text', _('Enter date'))
|
||||||
label = kwargs.get('label', None)
|
label = kwargs.get('label')
|
||||||
required = kwargs.get('required', False)
|
required = kwargs.get('required', False)
|
||||||
initial = kwargs.get('initial', None)
|
initial = kwargs.get('initial')
|
||||||
|
|
||||||
widget = forms.DateInput(attrs={'type': 'date'})
|
widget = forms.DateInput(attrs={'type': 'date'})
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ def progress_bar(val, max_val, *args, **kwargs):
|
|||||||
|
|
||||||
style_tags = []
|
style_tags = []
|
||||||
|
|
||||||
max_width = kwargs.get('max_width', None)
|
max_width = kwargs.get('max_width')
|
||||||
|
|
||||||
if max_width:
|
if max_width:
|
||||||
style_tags.append(f'max-width: {max_width};')
|
style_tags.append(f'max-width: {max_width};')
|
||||||
|
@ -402,7 +402,7 @@ class InvenTreeAPITestCase(ExchangeRateMixin, UserMixin, APITestCase):
|
|||||||
|
|
||||||
def options(self, url, expected_code=None, **kwargs):
|
def options(self, url, expected_code=None, **kwargs):
|
||||||
"""Issue an OPTIONS request."""
|
"""Issue an OPTIONS request."""
|
||||||
kwargs['data'] = kwargs.get('data', None)
|
kwargs['data'] = kwargs.get('data')
|
||||||
|
|
||||||
return self.query(
|
return self.query(
|
||||||
url, self.client.options, expected_code=expected_code, **kwargs
|
url, self.client.options, expected_code=expected_code, **kwargs
|
||||||
|
@ -339,13 +339,13 @@ class InvenTreeNotificationBodies:
|
|||||||
|
|
||||||
def trigger_notification(obj, category=None, obj_ref='pk', **kwargs):
|
def trigger_notification(obj, category=None, obj_ref='pk', **kwargs):
|
||||||
"""Send out a notification."""
|
"""Send out a notification."""
|
||||||
targets = kwargs.get('targets', None)
|
targets = kwargs.get('targets')
|
||||||
target_fnc = kwargs.get('target_fnc', None)
|
target_fnc = kwargs.get('target_fnc')
|
||||||
target_args = kwargs.get('target_args', [])
|
target_args = kwargs.get('target_args', [])
|
||||||
target_kwargs = kwargs.get('target_kwargs', {})
|
target_kwargs = kwargs.get('target_kwargs', {})
|
||||||
target_exclude = kwargs.get('target_exclude', None)
|
target_exclude = kwargs.get('target_exclude')
|
||||||
context = kwargs.get('context', {})
|
context = kwargs.get('context', {})
|
||||||
delivery_methods = kwargs.get('delivery_methods', None)
|
delivery_methods = kwargs.get('delivery_methods')
|
||||||
|
|
||||||
# Check if data is importing currently
|
# Check if data is importing currently
|
||||||
if isImportingData():
|
if isImportingData():
|
||||||
|
@ -188,7 +188,7 @@ class MachineSetting(common.models.BaseInvenTreeSetting):
|
|||||||
if 'settings' not in kwargs:
|
if 'settings' not in kwargs:
|
||||||
machine_config: MachineConfig = kwargs.pop('machine_config', None)
|
machine_config: MachineConfig = kwargs.pop('machine_config', None)
|
||||||
if machine_config and machine_config.machine:
|
if machine_config and machine_config.machine:
|
||||||
config_type = kwargs.get('config_type', None)
|
config_type = kwargs.get('config_type')
|
||||||
if config_type == cls.ConfigType.DRIVER:
|
if config_type == cls.ConfigType.DRIVER:
|
||||||
kwargs['settings'] = machine_config.machine.driver_settings
|
kwargs['settings'] = machine_config.machine.driver_settings
|
||||||
elif config_type == cls.ConfigType.MACHINE:
|
elif config_type == cls.ConfigType.MACHINE:
|
||||||
|
@ -791,13 +791,13 @@ class PurchaseOrder(TotalPriceMixin, Order):
|
|||||||
batch_code = kwargs.get('batch_code', '')
|
batch_code = kwargs.get('batch_code', '')
|
||||||
|
|
||||||
# Extract optional list of serial numbers
|
# Extract optional list of serial numbers
|
||||||
serials = kwargs.get('serials', None)
|
serials = kwargs.get('serials')
|
||||||
|
|
||||||
# Extract optional notes field
|
# Extract optional notes field
|
||||||
notes = kwargs.get('notes', '')
|
notes = kwargs.get('notes', '')
|
||||||
|
|
||||||
# Extract optional packaging field
|
# Extract optional packaging field
|
||||||
packaging = kwargs.get('packaging', None)
|
packaging = kwargs.get('packaging')
|
||||||
|
|
||||||
if not packaging:
|
if not packaging:
|
||||||
# Default to the packaging field for the linked supplier part
|
# Default to the packaging field for the linked supplier part
|
||||||
@ -805,7 +805,7 @@ class PurchaseOrder(TotalPriceMixin, Order):
|
|||||||
packaging = line.part.packaging
|
packaging = line.part.packaging
|
||||||
|
|
||||||
# Extract optional barcode field
|
# Extract optional barcode field
|
||||||
barcode = kwargs.get('barcode', None)
|
barcode = kwargs.get('barcode')
|
||||||
|
|
||||||
# Prevent null values for barcode
|
# Prevent null values for barcode
|
||||||
if barcode is None:
|
if barcode is None:
|
||||||
@ -1882,25 +1882,25 @@ class SalesOrderShipment(
|
|||||||
self.shipped_by = user
|
self.shipped_by = user
|
||||||
|
|
||||||
# Was a tracking number provided?
|
# Was a tracking number provided?
|
||||||
tracking_number = kwargs.get('tracking_number', None)
|
tracking_number = kwargs.get('tracking_number')
|
||||||
|
|
||||||
if tracking_number is not None:
|
if tracking_number is not None:
|
||||||
self.tracking_number = tracking_number
|
self.tracking_number = tracking_number
|
||||||
|
|
||||||
# Was an invoice number provided?
|
# Was an invoice number provided?
|
||||||
invoice_number = kwargs.get('invoice_number', None)
|
invoice_number = kwargs.get('invoice_number')
|
||||||
|
|
||||||
if invoice_number is not None:
|
if invoice_number is not None:
|
||||||
self.invoice_number = invoice_number
|
self.invoice_number = invoice_number
|
||||||
|
|
||||||
# Was a link provided?
|
# Was a link provided?
|
||||||
link = kwargs.get('link', None)
|
link = kwargs.get('link')
|
||||||
|
|
||||||
if link is not None:
|
if link is not None:
|
||||||
self.link = link
|
self.link = link
|
||||||
|
|
||||||
# Was a delivery date provided?
|
# Was a delivery date provided?
|
||||||
delivery_date = kwargs.get('delivery_date', None)
|
delivery_date = kwargs.get('delivery_date')
|
||||||
|
|
||||||
if delivery_date is not None:
|
if delivery_date is not None:
|
||||||
self.delivery_date = delivery_date
|
self.delivery_date = delivery_date
|
||||||
|
@ -45,7 +45,7 @@ def perform_stocktake(
|
|||||||
In this case, the stocktake *report* will be limited to the specified location.
|
In this case, the stocktake *report* will be limited to the specified location.
|
||||||
"""
|
"""
|
||||||
# Determine which locations are "valid" for the generated report
|
# Determine which locations are "valid" for the generated report
|
||||||
location = kwargs.get('location', None)
|
location = kwargs.get('location')
|
||||||
locations = location.get_descendants(include_self=True) if location else []
|
locations = location.get_descendants(include_self=True) if location else []
|
||||||
|
|
||||||
# Grab all "available" stock items for the Part
|
# Grab all "available" stock items for the Part
|
||||||
@ -169,24 +169,24 @@ def generate_stocktake_report(**kwargs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
parts = part.models.Part.objects.all()
|
parts = part.models.Part.objects.all()
|
||||||
user = kwargs.get('user', None)
|
user = kwargs.get('user')
|
||||||
|
|
||||||
generate_report = kwargs.get('generate_report', True)
|
generate_report = kwargs.get('generate_report', True)
|
||||||
update_parts = kwargs.get('update_parts', True)
|
update_parts = kwargs.get('update_parts', True)
|
||||||
|
|
||||||
# Filter by 'Part' instance
|
# Filter by 'Part' instance
|
||||||
if p := kwargs.get('part', None):
|
if p := kwargs.get('part'):
|
||||||
variants = p.get_descendants(include_self=True)
|
variants = p.get_descendants(include_self=True)
|
||||||
parts = parts.filter(pk__in=[v.pk for v in variants])
|
parts = parts.filter(pk__in=[v.pk for v in variants])
|
||||||
|
|
||||||
# Filter by 'Category' instance (cascading)
|
# Filter by 'Category' instance (cascading)
|
||||||
if category := kwargs.get('category', None):
|
if category := kwargs.get('category'):
|
||||||
categories = category.get_descendants(include_self=True)
|
categories = category.get_descendants(include_self=True)
|
||||||
parts = parts.filter(category__in=categories)
|
parts = parts.filter(category__in=categories)
|
||||||
|
|
||||||
# Filter by 'Location' instance (cascading)
|
# Filter by 'Location' instance (cascading)
|
||||||
# Stocktake report will be limited to parts which have stock items within this location
|
# Stocktake report will be limited to parts which have stock items within this location
|
||||||
if location := kwargs.get('location', None):
|
if location := kwargs.get('location'):
|
||||||
# Extract flat list of all sublocations
|
# Extract flat list of all sublocations
|
||||||
locations = list(location.get_descendants(include_self=True))
|
locations = list(location.get_descendants(include_self=True))
|
||||||
|
|
||||||
|
@ -720,7 +720,7 @@ class CategoryDetail(InvenTreeRoleMixin, InvenTreePluginViewMixin, DetailView):
|
|||||||
context['part_count'] = 0
|
context['part_count'] = 0
|
||||||
|
|
||||||
# Get current category
|
# Get current category
|
||||||
category = kwargs.get('object', None)
|
category = kwargs.get('object')
|
||||||
|
|
||||||
if category:
|
if category:
|
||||||
# Insert "starred" information
|
# Insert "starred" information
|
||||||
|
@ -290,7 +290,7 @@ class BarcodeAssign(BarcodeView):
|
|||||||
label = model.barcode_model_type()
|
label = model.barcode_model_type()
|
||||||
valid_labels.append(label)
|
valid_labels.append(label)
|
||||||
|
|
||||||
if instance := kwargs.get(label, None):
|
if instance := kwargs.get(label):
|
||||||
# Check that the user has the required permission
|
# Check that the user has the required permission
|
||||||
app_label = model._meta.app_label
|
app_label = model._meta.app_label
|
||||||
model_name = model._meta.model_name
|
model_name = model._meta.model_name
|
||||||
@ -497,8 +497,8 @@ class BarcodePOReceive(BarcodeView):
|
|||||||
logger.debug("BarcodePOReceive: scanned barcode - '%s'", barcode)
|
logger.debug("BarcodePOReceive: scanned barcode - '%s'", barcode)
|
||||||
|
|
||||||
# Extract optional fields from the dataset
|
# Extract optional fields from the dataset
|
||||||
purchase_order = kwargs.get('purchase_order', None)
|
purchase_order = kwargs.get('purchase_order')
|
||||||
location = kwargs.get('location', None)
|
location = kwargs.get('location')
|
||||||
|
|
||||||
plugins = registry.with_mixin('barcode')
|
plugins = registry.with_mixin('barcode')
|
||||||
|
|
||||||
@ -588,7 +588,7 @@ class BarcodeSOAllocate(BarcodeView):
|
|||||||
sales_order = kwargs['sales_order']
|
sales_order = kwargs['sales_order']
|
||||||
|
|
||||||
# Next, check if a line-item is provided (optional field)
|
# Next, check if a line-item is provided (optional field)
|
||||||
if line_item := kwargs.get('line', None):
|
if line_item := kwargs.get('line'):
|
||||||
return line_item
|
return line_item
|
||||||
|
|
||||||
# If not provided, we need to find the correct line item
|
# If not provided, we need to find the correct line item
|
||||||
@ -615,7 +615,7 @@ class BarcodeSOAllocate(BarcodeView):
|
|||||||
"""
|
"""
|
||||||
sales_order = kwargs['sales_order']
|
sales_order = kwargs['sales_order']
|
||||||
|
|
||||||
if shipment := kwargs.get('shipment', None):
|
if shipment := kwargs.get('shipment'):
|
||||||
if shipment.order != sales_order:
|
if shipment.order != sales_order:
|
||||||
raise ValidationError(_('Shipment does not match sales order'))
|
raise ValidationError(_('Shipment does not match sales order'))
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ class BarcodeSOAllocate(BarcodeView):
|
|||||||
self.log_scan(request, response, False)
|
self.log_scan(request, response, False)
|
||||||
raise ValidationError(response)
|
raise ValidationError(response)
|
||||||
|
|
||||||
quantity = kwargs.get('quantity', None)
|
quantity = kwargs.get('quantity')
|
||||||
|
|
||||||
# Override quantity for serialized items
|
# Override quantity for serialized items
|
||||||
if stock_item.serialized:
|
if stock_item.serialized:
|
||||||
|
@ -38,7 +38,7 @@ def print_label(plugin_slug: str, **kwargs):
|
|||||||
# Plugin threw an error - notify the user who attempted to print
|
# Plugin threw an error - notify the user who attempted to print
|
||||||
ctx = {'name': _('Label printing failed'), 'message': str(e)}
|
ctx = {'name': _('Label printing failed'), 'message': str(e)}
|
||||||
|
|
||||||
user = kwargs.get('user', None)
|
user = kwargs.get('user')
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
# Log an error message to the database
|
# Log an error message to the database
|
||||||
|
@ -83,7 +83,7 @@ class LabelPrintingMixin:
|
|||||||
[`pdf2image.convert_from_bytes`](https://pdf2image.readthedocs.io/en/latest/reference.html#pdf2image.pdf2image.convert_from_bytes) method (optional)
|
[`pdf2image.convert_from_bytes`](https://pdf2image.readthedocs.io/en/latest/reference.html#pdf2image.pdf2image.convert_from_bytes) method (optional)
|
||||||
"""
|
"""
|
||||||
# Check if pdf data is provided
|
# Check if pdf data is provided
|
||||||
pdf_data = kwargs.get('pdf_data', None)
|
pdf_data = kwargs.get('pdf_data')
|
||||||
|
|
||||||
if not pdf_data:
|
if not pdf_data:
|
||||||
pdf_data = (
|
pdf_data = (
|
||||||
|
@ -151,11 +151,11 @@ class SampleValidatorPlugin(SettingsMixin, ValidationMixin, InvenTreePlugin):
|
|||||||
batch = f'SAMPLE-BATCH-{now.year}:{now.month}:{now.day}'
|
batch = f'SAMPLE-BATCH-{now.year}:{now.month}:{now.day}'
|
||||||
|
|
||||||
# If a Part instance is provided, prepend the part name to the batch code
|
# If a Part instance is provided, prepend the part name to the batch code
|
||||||
if part := kwargs.get('part', None):
|
if part := kwargs.get('part'):
|
||||||
batch = f'{part.name}-{batch}'
|
batch = f'{part.name}-{batch}'
|
||||||
|
|
||||||
# If a Build instance is provided, prepend the build number to the batch code
|
# If a Build instance is provided, prepend the build number to the batch code
|
||||||
if build := kwargs.get('build_order', None):
|
if build := kwargs.get('build_order'):
|
||||||
batch = f'{build.reference}-{batch}'
|
batch = f'{build.reference}-{batch}'
|
||||||
|
|
||||||
return batch
|
return batch
|
||||||
|
@ -112,7 +112,7 @@ def plugin_static(context, file: str, **kwargs):
|
|||||||
"""
|
"""
|
||||||
plugin = context.get('plugin', None)
|
plugin = context.get('plugin', None)
|
||||||
|
|
||||||
plugin = plugin.slug if plugin else kwargs.get('plugin', None)
|
plugin = plugin.slug if plugin else kwargs.get('plugin')
|
||||||
|
|
||||||
if not plugin:
|
if not plugin:
|
||||||
return file
|
return file
|
||||||
|
@ -169,8 +169,8 @@ def uploaded_image(
|
|||||||
# A placeholder image showing that the image is missing
|
# A placeholder image showing that the image is missing
|
||||||
img = Image.new('RGB', (64, 64), color='red')
|
img = Image.new('RGB', (64, 64), color='red')
|
||||||
|
|
||||||
width = kwargs.get('width', None)
|
width = kwargs.get('width')
|
||||||
height = kwargs.get('height', None)
|
height = kwargs.get('height')
|
||||||
|
|
||||||
if width is not None:
|
if width is not None:
|
||||||
try:
|
try:
|
||||||
@ -199,7 +199,7 @@ def uploaded_image(
|
|||||||
img = img.resize((wsize, height))
|
img = img.resize((wsize, height))
|
||||||
|
|
||||||
# Optionally rotate the image
|
# Optionally rotate the image
|
||||||
if rotate := kwargs.get('rotate', None):
|
if rotate := kwargs.get('rotate'):
|
||||||
try:
|
try:
|
||||||
rotate = int(rotate)
|
rotate = int(rotate)
|
||||||
img = img.rotate(rotate)
|
img = img.rotate(rotate)
|
||||||
@ -417,7 +417,7 @@ def format_number(number, **kwargs):
|
|||||||
# Normalize the number (remove trailing zeroes)
|
# Normalize the number (remove trailing zeroes)
|
||||||
number = number.normalize()
|
number = number.normalize()
|
||||||
|
|
||||||
decimals = kwargs.get('decimal_places', None)
|
decimals = kwargs.get('decimal_places')
|
||||||
|
|
||||||
if decimals is not None:
|
if decimals is not None:
|
||||||
try:
|
try:
|
||||||
@ -431,7 +431,7 @@ def format_number(number, **kwargs):
|
|||||||
value = format(value, 'f')
|
value = format(value, 'f')
|
||||||
value = str(value)
|
value = str(value)
|
||||||
|
|
||||||
leading = kwargs.get('leading', None)
|
leading = kwargs.get('leading')
|
||||||
|
|
||||||
if leading is not None:
|
if leading is not None:
|
||||||
try:
|
try:
|
||||||
|
@ -1209,10 +1209,10 @@ class StockItem(
|
|||||||
"""
|
"""
|
||||||
query = self.sales_order_allocations.all()
|
query = self.sales_order_allocations.all()
|
||||||
|
|
||||||
if filter_allocations := kwargs.get('filter_allocations', None):
|
if filter_allocations := kwargs.get('filter_allocations'):
|
||||||
query = query.filter(**filter_allocations)
|
query = query.filter(**filter_allocations)
|
||||||
|
|
||||||
if exclude_allocations := kwargs.get('exclude_allocations', None):
|
if exclude_allocations := kwargs.get('exclude_allocations'):
|
||||||
query = query.exclude(**exclude_allocations)
|
query = query.exclude(**exclude_allocations)
|
||||||
|
|
||||||
if active is True:
|
if active is True:
|
||||||
@ -1461,13 +1461,13 @@ class StockItem(
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Has a location been specified?
|
# Has a location been specified?
|
||||||
location = kwargs.get('location', None)
|
location = kwargs.get('location')
|
||||||
|
|
||||||
if location:
|
if location:
|
||||||
deltas['location'] = location.id
|
deltas['location'] = location.id
|
||||||
|
|
||||||
# Quantity specified?
|
# Quantity specified?
|
||||||
quantity = kwargs.get('quantity', None)
|
quantity = kwargs.get('quantity')
|
||||||
|
|
||||||
if quantity:
|
if quantity:
|
||||||
deltas['quantity'] = float(quantity)
|
deltas['quantity'] = float(quantity)
|
||||||
@ -1619,7 +1619,7 @@ class StockItem(
|
|||||||
user: The user who performed the test
|
user: The user who performed the test
|
||||||
notes: Any notes associated with the test
|
notes: Any notes associated with the test
|
||||||
"""
|
"""
|
||||||
template = kwargs.get('template', None)
|
template = kwargs.get('template')
|
||||||
test_name = kwargs.pop('test_name', None)
|
test_name = kwargs.pop('test_name', None)
|
||||||
|
|
||||||
test_key = InvenTree.helpers.generateTestKey(test_name)
|
test_key = InvenTree.helpers.generateTestKey(test_name)
|
||||||
@ -1727,9 +1727,9 @@ class StockItem(
|
|||||||
# Keep track of the tree IDs that are being merged
|
# Keep track of the tree IDs that are being merged
|
||||||
tree_ids = {self.tree_id}
|
tree_ids = {self.tree_id}
|
||||||
|
|
||||||
user = kwargs.get('user', None)
|
user = kwargs.get('user')
|
||||||
location = kwargs.get('location', self.location)
|
location = kwargs.get('location', self.location)
|
||||||
notes = kwargs.get('notes', None)
|
notes = kwargs.get('notes')
|
||||||
|
|
||||||
parent_id = self.parent.pk if self.parent else None
|
parent_id = self.parent.pk if self.parent else None
|
||||||
|
|
||||||
@ -2113,10 +2113,10 @@ class StockItem(
|
|||||||
if self.updateQuantity(self.quantity - quantity):
|
if self.updateQuantity(self.quantity - quantity):
|
||||||
deltas = {'removed': float(quantity), 'quantity': float(self.quantity)}
|
deltas = {'removed': float(quantity), 'quantity': float(self.quantity)}
|
||||||
|
|
||||||
if location := kwargs.get('location', None):
|
if location := kwargs.get('location'):
|
||||||
deltas['location'] = location.pk
|
deltas['location'] = location.pk
|
||||||
|
|
||||||
if stockitem := kwargs.get('stockitem', None):
|
if stockitem := kwargs.get('stockitem'):
|
||||||
deltas['stockitem'] = stockitem.pk
|
deltas['stockitem'] = stockitem.pk
|
||||||
|
|
||||||
self.add_tracking_entry(code, user, notes=notes, deltas=deltas)
|
self.add_tracking_entry(code, user, notes=notes, deltas=deltas)
|
||||||
|
@ -92,7 +92,7 @@ class StockItemDetail(InvenTreeRoleMixin, InvenTreePluginViewMixin, DetailView):
|
|||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
"""Check if item exists else return to stock index."""
|
"""Check if item exists else return to stock index."""
|
||||||
stock_pk = kwargs.get('pk', None)
|
stock_pk = kwargs.get('pk')
|
||||||
|
|
||||||
if stock_pk:
|
if stock_pk:
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user