mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
add test for so
This commit is contained in:
parent
03328088a2
commit
05cc34f573
@ -140,6 +140,7 @@ class TestAdditionalLineMigration(MigratorTestCase):
|
|||||||
# Create a purchase order from a supplier
|
# Create a purchase order from a supplier
|
||||||
Company = self.old_state.apps.get_model('company', 'company')
|
Company = self.old_state.apps.get_model('company', 'company')
|
||||||
PurchaseOrder = self.old_state.apps.get_model('order', 'purchaseorder')
|
PurchaseOrder = self.old_state.apps.get_model('order', 'purchaseorder')
|
||||||
|
SalesOrder = self.old_state.apps.get_model('order', 'salesorder')
|
||||||
Part = self.old_state.apps.get_model('part', 'part')
|
Part = self.old_state.apps.get_model('part', 'part')
|
||||||
Supplierpart = self.old_state.apps.get_model('company', 'supplierpart')
|
Supplierpart = self.old_state.apps.get_model('company', 'supplierpart')
|
||||||
|
|
||||||
@ -184,16 +185,31 @@ class TestAdditionalLineMigration(MigratorTestCase):
|
|||||||
received=1
|
received=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sales_order = SalesOrder.objects.create(
|
||||||
|
customer=supplier,
|
||||||
|
reference=f"{ii}-xyz",
|
||||||
|
description="A test sales order",
|
||||||
|
)
|
||||||
|
sales_order.lines.create(
|
||||||
|
part=part,
|
||||||
|
quantity=12,
|
||||||
|
received=1
|
||||||
|
)
|
||||||
|
|
||||||
def test_po_migration(self):
|
def test_po_migration(self):
|
||||||
"""
|
"""
|
||||||
Test that the the PO lines where converted correctly
|
Test that the the PO lines where converted correctly
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PurchaseOrder = self.new_state.apps.get_model('order', 'purchaseorder')
|
PurchaseOrder = self.new_state.apps.get_model('order', 'purchaseorder')
|
||||||
|
SalesOrder = self.new_state.apps.get_model('order', 'salesorder')
|
||||||
|
|
||||||
for ii in range(10):
|
for ii in range(10):
|
||||||
|
|
||||||
po = PurchaseOrder.objects.get(reference=f"{ii}-abcde")
|
po = PurchaseOrder.objects.get(reference=f"{ii}-abcde")
|
||||||
|
so = SalesOrder.objects.get(reference=f"{ii}-xyz")
|
||||||
|
|
||||||
self.assertEqual(po.extra_lines.count(), 1)
|
self.assertEqual(po.extra_lines.count(), 1)
|
||||||
self.assertEqual(po.lines.count(), 1)
|
self.assertEqual(po.lines.count(), 1)
|
||||||
|
self.assertEqual(so.extra_lines, 1)
|
||||||
|
self.assertEqual(so.lines.count(), 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user