Fix label profile type field when editing label batch row
This commit is contained in:
parent
4ee30feb0f
commit
177d9d2e3d
2 changed files with 17 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue