mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #1 from matmair/fix-eeintech
Looks good, thanks @matmair !
This commit is contained in:
commit
6857964c17
@ -195,7 +195,7 @@ class FileManagementFormView(MultiStepFormView):
|
|||||||
def get_context_data(self, form, **kwargs):
|
def get_context_data(self, form, **kwargs):
|
||||||
context = super().get_context_data(form=form, **kwargs)
|
context = super().get_context_data(form=form, **kwargs)
|
||||||
|
|
||||||
if self.steps.current == 'fields' or self.steps.current == 'items':
|
if self.steps.current in ('fields', 'items'):
|
||||||
|
|
||||||
# Get columns and row data
|
# Get columns and row data
|
||||||
self.columns = self.file_manager.columns()
|
self.columns = self.file_manager.columns()
|
||||||
@ -333,20 +333,34 @@ class FileManagementFormView(MultiStepFormView):
|
|||||||
'errors': {},
|
'errors': {},
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
|
if self.column_names:
|
||||||
|
rows_shown = []
|
||||||
|
|
||||||
# Update the row data
|
# Update the row data
|
||||||
for row in self.rows:
|
for row in self.rows:
|
||||||
row_data = row['data']
|
row_data = row['data']
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
show_data = []
|
||||||
|
|
||||||
for idx, item in enumerate(row_data):
|
for idx, item in enumerate(row_data):
|
||||||
data.append({
|
column_data = {
|
||||||
'cell': item,
|
'cell': item,
|
||||||
'idx': idx,
|
'idx': idx,
|
||||||
'column': self.columns[idx],
|
'column': self.columns[idx],
|
||||||
})
|
}
|
||||||
|
data.append(column_data)
|
||||||
|
if not self.column_names or self.columns[idx]['name'] in self.column_names:
|
||||||
|
show_data.append(column_data)
|
||||||
|
|
||||||
row['data'] = data
|
row['data'] = data
|
||||||
|
if self.column_names:
|
||||||
|
current_row = row
|
||||||
|
current_row['data'] = show_data
|
||||||
|
rows_shown.append(current_row)
|
||||||
|
|
||||||
|
if self.column_names and self.get_step_index() == 3:
|
||||||
|
self.rows = rows_shown
|
||||||
|
|
||||||
# In the item selection step: update row data to contain fields
|
# In the item selection step: update row data to contain fields
|
||||||
if form and self.steps.current == 'items':
|
if form and self.steps.current == 'items':
|
||||||
@ -435,7 +449,7 @@ class FileManagementFormView(MultiStepFormView):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Data validation
|
# Data validation
|
||||||
valid = len(self.extra_context_data.get('missing_columns', [])) == 0 and not self.extra_context_data.get('duplicates', [])
|
valid = not missing_columns and not duplicates
|
||||||
|
|
||||||
return valid
|
return valid
|
||||||
|
|
||||||
@ -452,7 +466,7 @@ class FileManagementFormView(MultiStepFormView):
|
|||||||
valid = self.check_field_selection(form)
|
valid = self.check_field_selection(form)
|
||||||
|
|
||||||
if not valid:
|
if not valid:
|
||||||
form.add_error(None, 'Fields matching failed')
|
form.add_error(None, _('Fields matching failed'))
|
||||||
|
|
||||||
elif step == 'items':
|
elif step == 'items':
|
||||||
pass
|
pass
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{% block details %}
|
{% block details %}
|
||||||
|
|
||||||
<p>{% trans "Step" %} {{ wizard.steps.step1 }} {% trans "of" %} {{ wizard.steps.count }}
|
<p>{% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{step}} of {{count}}{% endblocktrans %}
|
||||||
{% if description %}- {{ description }}{% endif %}</p>
|
{% if description %}- {{ description }}{% endif %}</p>
|
||||||
|
|
||||||
{% block form_alert %}
|
{% block form_alert %}
|
||||||
|
Loading…
Reference in New Issue
Block a user