From 58336482fe481f889bd40cb0ab233834ac3ac9a5 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 28 Jun 2019 19:48:22 +1000 Subject: [PATCH] POST the data back again --- InvenTree/part/bom.py | 8 ++++++-- .../part/templates/part/bom_upload/select_fields.html | 4 +++- InvenTree/part/views.py | 2 -- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/InvenTree/part/bom.py b/InvenTree/part/bom.py index 5108672e66..fe973efaf0 100644 --- a/InvenTree/part/bom.py +++ b/InvenTree/part/bom.py @@ -79,7 +79,7 @@ class BomUploadManager: except tablib.UnsupportedFormat: raise ValidationError({'bom_file': _('Error reading BOM file (invalid data)')}) - def guess_headers(self, header, threshold=80): + def guess_header(self, header, threshold=80): """ Try to match a header (from the file) to a list of known headers Args: @@ -145,7 +145,11 @@ class BomUploadManager: rows = [] for i in range(self.row_count()): - row = self.get_row_data(i) + + row = { + 'data': self.get_row_data(i), + 'index': i + } if row: rows.append(row) diff --git a/InvenTree/part/templates/part/bom_upload/select_fields.html b/InvenTree/part/templates/part/bom_upload/select_fields.html index 709cf7a18d..db09b2a3fb 100644 --- a/InvenTree/part/templates/part/bom_upload/select_fields.html +++ b/InvenTree/part/templates/part/bom_upload/select_fields.html @@ -25,6 +25,7 @@ {% endfor %} + {{ col.name }} {% endfor %} @@ -34,8 +35,9 @@ {% for row in bom_rows %} {% add forloop.counter 1 %} - {% for item in row %} + {% for item in row.data %} + {{ item }} {% endfor %} diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index ad55f75f3d..6858e3e179 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -721,8 +721,6 @@ class BomUpload(AjaxView, FormMixin): form = part_forms.BomUploadSelectFields self.ajax_template_name = 'part/bom_upload/select_fields.html' - # Try to guess at the - # Provide context to the next form ctx = { 'req_cols': BomUploadManager.HEADERS,