2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-01 03:00:54 +00:00

Stocktake external (#5182)

* Add 'location' filtering option for part.stock_entries

* Add "exclude_external" field to stocktake report

* Add "stocktake_exclude_external" default option

* Implement setting to exclude external stock

* Split stocktake functionality out into separate file

* Change name of internal setting

* Refactoring

* Add 'exclude_external' field to stocktake form
This commit is contained in:
Oliver
2023-07-05 22:53:44 +10:00
committed by GitHub
parent c91fbdbc48
commit 831693e941
8 changed files with 315 additions and 270 deletions

View File

@ -23,6 +23,7 @@ import InvenTree.helpers
import InvenTree.serializers
import InvenTree.status
import part.filters
import part.stocktake
import part.tasks
import stock.models
from InvenTree.status_codes import BuildStatusGroups
@ -932,6 +933,12 @@ class PartStocktakeReportGenerateSerializer(serializers.Serializer):
label=_('Location'), help_text=_('Limit stocktake report to a particular stock location, and any child locations')
)
exclude_external = serializers.BooleanField(
default=True,
label=_('Exclude External Stock'),
help_text=_('Exclude stock items in external locations')
)
generate_report = serializers.BooleanField(
default=True,
label=_('Generate Report'),
@ -965,12 +972,13 @@ class PartStocktakeReportGenerateSerializer(serializers.Serializer):
# Generate a new report
offload_task(
part.tasks.generate_stocktake_report,
part.stocktake.generate_stocktake_report,
force_async=True,
user=user,
part=data.get('part', None),
category=data.get('category', None),
location=data.get('location', None),
exclude_external=data.get('exclude_external', True),
generate_report=data.get('generate_report', True),
update_parts=data.get('update_parts', True),
)