mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge branch 'inventree:master' into translation-fixes
This commit is contained in:
commit
8b8e95385b
@ -475,7 +475,6 @@ def extract_serial_numbers(serials, expected_quantity, next_number: int):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
errors.append(_("Invalid group: {g}").format(g=group))
|
errors.append(_("Invalid group: {g}").format(g=group))
|
||||||
continue
|
|
||||||
|
|
||||||
# plus signals either
|
# plus signals either
|
||||||
# 1: 'start+': expected number of serials, starting at start
|
# 1: 'start+': expected number of serials, starting at start
|
||||||
@ -500,7 +499,6 @@ def extract_serial_numbers(serials, expected_quantity, next_number: int):
|
|||||||
# no case
|
# no case
|
||||||
else:
|
else:
|
||||||
errors.append(_("Invalid group: {g}").format(g=group))
|
errors.append(_("Invalid group: {g}").format(g=group))
|
||||||
continue
|
|
||||||
|
|
||||||
# Group should be a number
|
# Group should be a number
|
||||||
elif group:
|
elif group:
|
||||||
|
@ -789,21 +789,20 @@ class BomImportExtractSerializer(DataFileExtractSerializer):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# No direct match, where else can we look?
|
# No direct match, where else can we look?
|
||||||
if part is None:
|
if part is None and (part_name or part_ipn):
|
||||||
if part_name or part_ipn:
|
queryset = Part.objects.all()
|
||||||
queryset = Part.objects.all()
|
|
||||||
|
|
||||||
if part_name:
|
if part_name:
|
||||||
queryset = queryset.filter(name=part_name)
|
queryset = queryset.filter(name=part_name)
|
||||||
|
|
||||||
if part_ipn:
|
if part_ipn:
|
||||||
queryset = queryset.filter(IPN=part_ipn)
|
queryset = queryset.filter(IPN=part_ipn)
|
||||||
|
|
||||||
if queryset.exists():
|
if queryset.exists():
|
||||||
if queryset.count() == 1:
|
if queryset.count() == 1:
|
||||||
part = queryset.first()
|
part = queryset.first()
|
||||||
else:
|
else:
|
||||||
row['errors']['part'] = _('Multiple matching parts found')
|
row['errors']['part'] = _('Multiple matching parts found')
|
||||||
|
|
||||||
if part is None:
|
if part is None:
|
||||||
row['errors']['part'] = _('No matching part found')
|
row['errors']['part'] = _('No matching part found')
|
||||||
|
@ -41,7 +41,7 @@ class BomUploadTest(InvenTreeAPITestCase):
|
|||||||
assembly=False,
|
assembly=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def post_bom(self, filename, file_data, part=None, clear_existing=None, expected_code=None, content_type='text/plain'):
|
def post_bom(self, filename, file_data, clear_existing=None, expected_code=None, content_type='text/plain'):
|
||||||
|
|
||||||
bom_file = SimpleUploadedFile(
|
bom_file = SimpleUploadedFile(
|
||||||
filename,
|
filename,
|
||||||
@ -49,9 +49,6 @@ class BomUploadTest(InvenTreeAPITestCase):
|
|||||||
content_type=content_type,
|
content_type=content_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
if part is None:
|
|
||||||
part = self.part.pk
|
|
||||||
|
|
||||||
if clear_existing is None:
|
if clear_existing is None:
|
||||||
clear_existing = False
|
clear_existing = False
|
||||||
|
|
||||||
@ -189,7 +186,7 @@ class BomUploadTest(InvenTreeAPITestCase):
|
|||||||
|
|
||||||
self.assertIn('No part column specified', str(response.data))
|
self.assertIn('No part column specified', str(response.data))
|
||||||
|
|
||||||
response = self.post(
|
self.post(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
'rows': rows,
|
'rows': rows,
|
||||||
|
@ -516,10 +516,8 @@ class StockList(generics.ListCreateAPIView):
|
|||||||
data['location'] = location.pk
|
data['location'] = location.pk
|
||||||
|
|
||||||
# An expiry date was *not* specified - try to infer it!
|
# An expiry date was *not* specified - try to infer it!
|
||||||
if 'expiry_date' not in data:
|
if 'expiry_date' not in data and part.default_expiry > 0:
|
||||||
|
data['expiry_date'] = datetime.now().date() + timedelta(days=part.default_expiry)
|
||||||
if part.default_expiry > 0:
|
|
||||||
data['expiry_date'] = datetime.now().date() + timedelta(days=part.default_expiry)
|
|
||||||
|
|
||||||
# Attempt to extract serial numbers from submitted data
|
# Attempt to extract serial numbers from submitted data
|
||||||
serials = None
|
serials = None
|
||||||
|
@ -393,7 +393,7 @@ class StockItemTest(StockAPITestCase):
|
|||||||
self.assertEqual(trackable_part.get_stock_count(), 0)
|
self.assertEqual(trackable_part.get_stock_count(), 0)
|
||||||
|
|
||||||
# This should fail, incorrect serial number count
|
# This should fail, incorrect serial number count
|
||||||
response = self.post(
|
self.post(
|
||||||
self.list_url,
|
self.list_url,
|
||||||
data={
|
data={
|
||||||
'part': trackable_part.pk,
|
'part': trackable_part.pk,
|
||||||
|
Loading…
Reference in New Issue
Block a user