2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-19 05:25:42 +00:00

Merge remote-tracking branch 'origin/master' into scheduling

This commit is contained in:
Oliver
2022-02-25 23:01:17 +11:00
46 changed files with 39409 additions and 27197 deletions

View File

@ -1,5 +1,7 @@
# Generated by Django 3.0.7 on 2020-11-10 11:25
import logging
from django.db import migrations
from moneyed import CURRENCIES
@ -7,6 +9,9 @@ from django.db import migrations, connection
from company.models import SupplierPriceBreak
logger = logging.getLogger('inventree')
def migrate_currencies(apps, schema_editor):
"""
Migrate from the 'old' method of handling currencies,
@ -19,7 +24,7 @@ def migrate_currencies(apps, schema_editor):
for the SupplierPriceBreak model, to a new django-money compatible currency.
"""
print("Updating currency references for SupplierPriceBreak model...")
logger.info("Updating currency references for SupplierPriceBreak model...")
# A list of available currency codes
currency_codes = CURRENCIES.keys()

View File

@ -789,21 +789,20 @@ class BomImportExtractSerializer(DataFileExtractSerializer):
pass
# No direct match, where else can we look?
if part is None:
if part_name or part_ipn:
queryset = Part.objects.all()
if part is None and (part_name or part_ipn):
queryset = Part.objects.all()
if part_name:
queryset = queryset.filter(name=part_name)
if part_name:
queryset = queryset.filter(name=part_name)
if part_ipn:
queryset = queryset.filter(IPN=part_ipn)
if part_ipn:
queryset = queryset.filter(IPN=part_ipn)
if queryset.exists():
if queryset.count() == 1:
part = queryset.first()
else:
row['errors']['part'] = _('Multiple matching parts found')
if queryset.exists():
if queryset.count() == 1:
part = queryset.first()
else:
row['errors']['part'] = _('Multiple matching parts found')
if part is None:
row['errors']['part'] = _('No matching part found')

View File

@ -41,7 +41,7 @@ class BomUploadTest(InvenTreeAPITestCase):
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(
filename,
@ -49,9 +49,6 @@ class BomUploadTest(InvenTreeAPITestCase):
content_type=content_type,
)
if part is None:
part = self.part.pk
if clear_existing is None:
clear_existing = False
@ -189,7 +186,7 @@ class BomUploadTest(InvenTreeAPITestCase):
self.assertIn('No part column specified', str(response.data))
response = self.post(
self.post(
url,
{
'rows': rows,