mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
refactor: use cls.globalTestRecords instead of declaring test_records
This commit is contained in:
@@ -98,7 +98,7 @@ class TestMaintenanceSchedule(IntegrationTestCase):
|
||||
def test_serial_no_filters(self):
|
||||
# Without serial no. set in schedule -> returns None
|
||||
item_code = "_Test Serial Item"
|
||||
make_serial_item_with_serial(item_code)
|
||||
make_serial_item_with_serial(self, item_code)
|
||||
ms = make_maintenance_schedule(item_code=item_code)
|
||||
ms.submit()
|
||||
|
||||
@@ -109,7 +109,7 @@ class TestMaintenanceSchedule(IntegrationTestCase):
|
||||
self.assertEqual(serial_nos, None)
|
||||
|
||||
# With serial no. set in schedule -> returns serial nos.
|
||||
make_serial_item_with_serial(item_code)
|
||||
make_serial_item_with_serial(self, item_code)
|
||||
ms = make_maintenance_schedule(item_code=item_code, serial_no="TEST001, TEST002")
|
||||
ms.submit()
|
||||
|
||||
@@ -125,7 +125,7 @@ class TestMaintenanceSchedule(IntegrationTestCase):
|
||||
# Checks whether serials are automatically updated when changing in items table.
|
||||
# Also checks if other fields trigger generate schdeule if changed in items table.
|
||||
item_code = "_Test Serial Item"
|
||||
make_serial_item_with_serial(item_code)
|
||||
make_serial_item_with_serial(self, item_code)
|
||||
ms = make_maintenance_schedule(item_code=item_code, serial_no="TEST001, TEST002")
|
||||
ms.save()
|
||||
|
||||
@@ -152,7 +152,7 @@ class TestMaintenanceSchedule(IntegrationTestCase):
|
||||
frappe.db.rollback()
|
||||
|
||||
|
||||
def make_serial_item_with_serial(item_code):
|
||||
def make_serial_item_with_serial(self, item_code):
|
||||
serial_item_doc = create_item(item_code, is_stock_item=1)
|
||||
if not serial_item_doc.has_serial_no or not serial_item_doc.serial_no_series:
|
||||
serial_item_doc.has_serial_no = 1
|
||||
@@ -160,7 +160,7 @@ def make_serial_item_with_serial(item_code):
|
||||
serial_item_doc.save(ignore_permissions=True)
|
||||
active_serials = frappe.db.get_all("Serial No", {"status": "Active", "item_code": item_code})
|
||||
if len(active_serials) < 2:
|
||||
make_serialized_item(item_code=item_code)
|
||||
make_serialized_item(self, item_code=item_code)
|
||||
|
||||
|
||||
def get_events(ms):
|
||||
|
||||
Reference in New Issue
Block a user