-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/inventree/InvenTree
- Loading branch information
Showing
19 changed files
with
175 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Packages needed for CI/packages | ||
requests==2.32.3 | ||
pyyaml==6.0.2 | ||
jc==1.25.3 | ||
jc==1.25.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Custom query filters for the Company app.""" | ||
|
||
from decimal import Decimal | ||
|
||
from django.db.models import DecimalField, ExpressionWrapper, F, Q | ||
from django.db.models.functions import Coalesce | ||
|
||
from sql_util.utils import SubquerySum | ||
|
||
from order.status_codes import PurchaseOrderStatusGroups | ||
|
||
|
||
def annotate_on_order_quantity(): | ||
"""Annotate the 'on_order' quantity for each SupplierPart in a queryset. | ||
- This is the total quantity of parts on order from all open purchase orders | ||
- Takes into account the 'received' quantity for each order line | ||
""" | ||
# Filter only 'active' purhase orders | ||
# Filter only line with outstanding quantity | ||
order_filter = Q( | ||
order__status__in=PurchaseOrderStatusGroups.OPEN, quantity__gt=F('received') | ||
) | ||
|
||
return Coalesce( | ||
SubquerySum( | ||
ExpressionWrapper( | ||
F('purchase_order_line_items__quantity') | ||
- F('purchase_order_line_items__received'), | ||
output_field=DecimalField(), | ||
), | ||
filter=order_filter, | ||
), | ||
Decimal(0), | ||
output_field=DecimalField(), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.