mirror of
https://github.com/inventree/InvenTree.git
synced 2026-09-02 19:08:47 +00:00
frontend UI elements
This commit is contained in:
@@ -5,6 +5,7 @@ from datetime import datetime
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.test.utils import CaptureQueriesContext
|
from django.test.utils import CaptureQueriesContext
|
||||||
@@ -18,7 +19,7 @@ import build.models
|
|||||||
import company.models
|
import company.models
|
||||||
import order.models
|
import order.models
|
||||||
from build.status_codes import BuildStatus
|
from build.status_codes import BuildStatus
|
||||||
from common.models import InvenTreeSetting, ParameterTemplate
|
from common.models import InvenTreeSetting, Note, ParameterTemplate
|
||||||
from company.models import Company, SupplierPart
|
from company.models import Company, SupplierPart
|
||||||
from InvenTree.config import get_testfolder_dir
|
from InvenTree.config import get_testfolder_dir
|
||||||
from InvenTree.unit_test import InvenTreeAPIPerformanceTestCase, InvenTreeAPITestCase
|
from InvenTree.unit_test import InvenTreeAPIPerformanceTestCase, InvenTreeAPITestCase
|
||||||
@@ -1639,6 +1640,14 @@ class PartCreationTests(PartAPITestBase):
|
|||||||
description=f'Test template {key} for duplication',
|
description=f'Test template {key} for duplication',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Attach a note to the base part
|
||||||
|
Note.objects.create(
|
||||||
|
model_type=ContentType.objects.get_for_model(Part),
|
||||||
|
model_id=base_part.pk,
|
||||||
|
title='Duplication test note',
|
||||||
|
content='Some note content',
|
||||||
|
)
|
||||||
|
|
||||||
for do_copy in [True, False]:
|
for do_copy in [True, False]:
|
||||||
response = self.post(
|
response = self.post(
|
||||||
reverse('api-part-list'),
|
reverse('api-part-list'),
|
||||||
@@ -1664,7 +1673,7 @@ class PartCreationTests(PartAPITestBase):
|
|||||||
|
|
||||||
# Check new part
|
# Check new part
|
||||||
self.assertEqual(part.bom_items.count(), 4 if do_copy else 0)
|
self.assertEqual(part.bom_items.count(), 4 if do_copy else 0)
|
||||||
self.assertEqual(part.notes, base_part.notes if do_copy else None)
|
self.assertEqual(part.notes.count(), 1 if do_copy else 0)
|
||||||
self.assertEqual(part.parameters.count(), 2 if do_copy else 0)
|
self.assertEqual(part.parameters.count(), 2 if do_copy else 0)
|
||||||
self.assertEqual(part.test_templates.count(), 3 if do_copy else 0)
|
self.assertEqual(part.test_templates.count(), 3 if do_copy else 0)
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,8 @@ export function useBuildOrderFields({
|
|||||||
duplicate: DuplicateField({
|
duplicate: DuplicateField({
|
||||||
originalId: duplicateBuildId,
|
originalId: duplicateBuildId,
|
||||||
extraFields: {
|
extraFields: {
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ export function useSupplierPartFields({
|
|||||||
duplicate: DuplicateField({
|
duplicate: DuplicateField({
|
||||||
originalId: duplicateSupplierPartId,
|
originalId: duplicateSupplierPartId,
|
||||||
extraFields: {
|
extraFields: {
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -146,7 +147,8 @@ export function useManufacturerPartFields({
|
|||||||
duplicate: DuplicateField({
|
duplicate: DuplicateField({
|
||||||
originalId: duplicateManufacturerPartId,
|
originalId: duplicateManufacturerPartId,
|
||||||
extraFields: {
|
extraFields: {
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -191,7 +193,8 @@ export function companyFields({
|
|||||||
duplicate: DuplicateField({
|
duplicate: DuplicateField({
|
||||||
originalId: duplicateCompanyId,
|
originalId: duplicateCompanyId,
|
||||||
extraFields: {
|
extraFields: {
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -322,7 +322,8 @@ export function usePurchaseOrderFields({
|
|||||||
},
|
},
|
||||||
copy_lines: {},
|
copy_lines: {},
|
||||||
copy_extra_lines: {},
|
copy_extra_lines: {},
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ export function useReturnOrderFields({
|
|||||||
value: duplicateOrderId
|
value: duplicateOrderId
|
||||||
},
|
},
|
||||||
copy_extra_lines: {},
|
copy_extra_lines: {},
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ export function useSalesOrderFields({
|
|||||||
},
|
},
|
||||||
copy_lines: {},
|
copy_lines: {},
|
||||||
copy_extra_lines: {},
|
copy_extra_lines: {},
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ export function useTransferOrderFields({
|
|||||||
value: duplicateOrderId
|
value: duplicateOrderId
|
||||||
},
|
},
|
||||||
copy_lines: {},
|
copy_lines: {},
|
||||||
copy_parameters: {}
|
copy_parameters: {},
|
||||||
|
copy_notes: {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user