Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.11]
python-version: [3.12]

steps:
- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.11]
python-version: [3.12]

steps:
- name: Checkout Code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.11]
python-version: [3.12]

steps:
- name: Checkout Code
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.12
- name: Check Release Tag
run: |
python3 ci/check_version_number.py ${{ github.event.release.tag_name }}
Expand All @@ -36,4 +36,3 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_REPOSITORY: pypi

29 changes: 16 additions & 13 deletions test/test_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

from test_api import InvenTreeTestCase # noqa: E402

from inventree.base import Attachment # noqa: E402
from inventree import company # noqa: E402
from inventree import order # noqa: E402
from inventree import part # noqa: E402
from inventree import stock # noqa: E402
from inventree.base import Attachment # noqa: E402


class POTest(InvenTreeTestCase):
Expand Down Expand Up @@ -84,7 +84,7 @@ def test_po_create(self):
n = len(order.PurchaseOrder.list(self.api))

# Create a PO with unique reference
ref = f"PO-{n+1}"
ref = f"PO-{n + 1}"

po = supplier.createPurchaseOrder(
reference=ref,
Expand Down Expand Up @@ -284,6 +284,9 @@ def test_order_complete_with_receive(self):
result = po.receiveAll(location=use_location)
self.assertIsNone(result)

# hold the order, then complete it
po._statusupdate(status='hold')

# Complete the order, do not accept any incomplete lines
po.complete(accept_incomplete=False)
po.reload()
Expand Down Expand Up @@ -396,7 +399,7 @@ def test_po_attachment(self):

def test_invalid_list(self):
"""Test list with an invalid parameter.

Ref: https://github.com/inventree/inventree-python/issues/246
"""

Expand All @@ -405,7 +408,7 @@ def test_invalid_list(self):
results = order.PurchaseOrder.list(self.api, project_code=999999999)
self.assertEqual(len(results), 0)

# Try the same again, but raise the eror
# Try the same again, but raise the error
with self.assertRaises(HTTPError):
results = order.PurchaseOrder.list(
self.api,
Expand All @@ -418,7 +421,7 @@ def test_invalid_list(self):

# Create a new project code
pc = ProjectCode.create(self.api, {
'code': f"TEST-{n+1}",
'code': f"TEST-{n + 1}",
'description': 'Test project code',
})

Expand Down Expand Up @@ -619,7 +622,7 @@ def test_so_shipment(self):
shipment_1 = order.SalesOrderShipment.create(
self.api, data={
'order': so.pk,
'reference': f'Package {num_shipments+1}'
'reference': f'Package {num_shipments + 1}'
}
)

Expand All @@ -639,7 +642,7 @@ def test_so_shipment(self):
shipment_2 = so.addShipment(f'Package {num_shipments}')

# Create new shipment - use addShipment method. No extra data
shipment_2 = so.addShipment(f'Package {num_shipments+1}')
shipment_2 = so.addShipment(f'Package {num_shipments + 1}')

# Assert the shipment is not created
self.assertIsNotNone(shipment_2)
Expand All @@ -648,7 +651,7 @@ def test_so_shipment(self):
self.assertEqual(shipment_2.getOrder().pk, so.pk)

# Assert shipment reference is as expected
self.assertEqual(shipment_2.reference, f'Package {num_shipments+1}')
self.assertEqual(shipment_2.reference, f'Package {num_shipments + 1}')

# Count number of current shipments
self.assertEqual(len(so.getShipments()), num_shipments + 1)
Expand All @@ -657,11 +660,11 @@ def test_so_shipment(self):
# Create another shipment - use addShipment method.
# With some extra data, including non-sense order
# (which should be overwritten)
notes = f'Test shipment number {num_shipments+1} for order {so.pk}'
notes = f'Test shipment number {num_shipments + 1} for order {so.pk}'
tracking_number = '93414134343'

shipment_2 = so.addShipment(
reference=f'Package {num_shipments+1}',
reference=f'Package {num_shipments + 1}',
order=10103413,
notes=notes,
tracking_number=tracking_number
Expand All @@ -674,7 +677,7 @@ def test_so_shipment(self):
self.assertEqual(shipment_2.getOrder().pk, so.pk)

# Assert shipment reference is as expected
self.assertEqual(shipment_2.reference, f'Package {num_shipments+1}')
self.assertEqual(shipment_2.reference, f'Package {num_shipments + 1}')

# Make sure extra data is also as expected
self.assertEqual(shipment_2.tracking_number, tracking_number)
Expand Down Expand Up @@ -729,11 +732,11 @@ def test_so_shipment(self):
if len(allocations) == 0:
shp.delete()
continue

# If the shipment has no date, try to mark it shipped
if shp.shipment_date is None:
shp.ship()

so.complete()
self.assertEqual(so.status, 20)
self.assertEqual(so.status_text, 'Shipped')
Expand Down
Loading