This commit is contained in:
Oliver Walters 2019-06-28 00:15:23 +10:00
parent 872329c340
commit 67b53d9983
4 changed files with 5 additions and 16 deletions

View File

@ -6,7 +6,6 @@ import io
import json
import os.path
from PIL import Image
import tablib
from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse

View File

@ -9,7 +9,6 @@ import os
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from .models import Part, BomItem
from InvenTree.helpers import DownloadFile
@ -100,10 +99,6 @@ class BomUploadManager:
self.header_map[header] = match
# Now we have mapped data to each header
for k,v in self.header_map.items():
print(k, '->', v)
def get_header(self, header_name):
""" Returns the matching header name for the internal name """
@ -146,14 +141,12 @@ class BomUploadManager:
return matches[0]['header']
return None
def get_headers(self):
""" Return a list of headers for the thingy """
headers = []
return headers
def col_count(self):
if self.data is None:

View File

@ -12,6 +12,7 @@ register = template.Library()
def inrange(n, *args, **kwargs):
""" Return range(n) for iterating through a numeric quantity """
return range(n)
@register.simple_tag()
def multiply(x, y, *args, **kwargs):

View File

@ -5,9 +5,6 @@ Django views for interacting with Part app
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import tablib
import os
from django.core.exceptions import ValidationError
from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy as _
@ -24,7 +21,7 @@ from .models import match_part_names
from company.models import SupplierPart
from . import forms as part_forms
from .bom import MakeBomTemplate, BomUploadManager
from .bom import MakeBomTemplate, BomUploadManager
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
from InvenTree.views import QRCodeView
@ -663,14 +660,14 @@ class BomUpload(AjaxView, FormMixin):
return part_forms.BomUploadSelectFile
def get_context_data(self):
ctx = {
ctx = {
'part': self.part
}
return ctx
def get(self, request, *args, **kwargs):
""" Perform the initial 'GET' request.
""" Perform the initial 'GET' request.
Initially returns a form for file upload """
@ -701,7 +698,7 @@ class BomUpload(AjaxView, FormMixin):
except ValidationError as e:
errors = e.error_dict
for k,v in errors.items():
for k, v in errors.items():
self.form.errors[k] = v
data = {
@ -743,7 +740,6 @@ class BomUpload(AjaxView, FormMixin):
# Did the user POST a file named bom_file?
form_step = request.POST.get('form_step', None)
if form_step == 'select_file':