Fix label profile type field when editing label batch row

This commit is contained in:
Lance Edgar 2018-05-09 15:12:44 -05:00
parent 4ee30feb0f
commit 177d9d2e3d
2 changed files with 17 additions and 1 deletions

View file

@ -26,10 +26,13 @@ Views for label batches
from __future__ import unicode_literals, absolute_import
import six
from rattail.db import model
from webhelpers2.html import HTML, tags
from tailbone import forms
from tailbone.views.batch import BatchMasterView
@ -181,6 +184,17 @@ class LabelBatchView(BatchMasterView):
else:
f.remove_field('product')
# label_profile
if self.editing:
f.replace('label_profile', 'label_profile_uuid')
f.set_label('label_profile_uuid', "Label Type")
profiles = self.Session.query(model.LabelProfile)\
.filter(model.LabelProfile.visible == True)\
.order_by(model.LabelProfile.ordinal)
profile_values = [(p.uuid, six.text_type(p))
for p in profiles]
f.set_widget('label_profile_uuid', forms.widgets.JQuerySelectWidget(values=profile_values))
def includeme(config):
LabelBatchView.defaults(config)

View file

@ -2450,7 +2450,9 @@ class MasterView(View):
'parent_instance': parent,
'instance_title': self.get_row_instance_title(row),
'instance_deletable': self.row_deletable(row),
'form': form})
'form': form,
'dform': form.make_deform_form(),
})
def mobile_edit_row(self):
"""