add LabelProfile.visible field support
This commit is contained in:
parent
5f7fd2401e
commit
78f0dad6d0
|
@ -33,6 +33,7 @@ import formalchemy
|
||||||
from webhelpers.html import HTML
|
from webhelpers.html import HTML
|
||||||
|
|
||||||
from edbob.pyramid import Session
|
from edbob.pyramid import Session
|
||||||
|
from edbob.pyramid.grids.search import BooleanSearchFilter
|
||||||
from edbob.pyramid.views import SearchableAlchemyGridView, CrudView
|
from edbob.pyramid.views import SearchableAlchemyGridView, CrudView
|
||||||
|
|
||||||
import rattail
|
import rattail
|
||||||
|
@ -46,11 +47,15 @@ class ProfilesGrid(SearchableAlchemyGridView):
|
||||||
|
|
||||||
def filter_map(self):
|
def filter_map(self):
|
||||||
return self.make_filter_map(
|
return self.make_filter_map(
|
||||||
exact=['code'],
|
exact=['code', 'visible'],
|
||||||
ilike=['description'])
|
ilike=['description'])
|
||||||
|
|
||||||
|
def filter_config(self):
|
||||||
|
return self.make_filter_config(
|
||||||
|
filter_factory_visible=BooleanSearchFilter)
|
||||||
|
|
||||||
def sort_map(self):
|
def sort_map(self):
|
||||||
return self.make_sort_map('ordinal', 'code', 'description')
|
return self.make_sort_map('ordinal', 'code', 'description', 'visible')
|
||||||
|
|
||||||
def grid(self):
|
def grid(self):
|
||||||
g = self.make_grid()
|
g = self.make_grid()
|
||||||
|
@ -59,6 +64,7 @@ class ProfilesGrid(SearchableAlchemyGridView):
|
||||||
g.ordinal,
|
g.ordinal,
|
||||||
g.code,
|
g.code,
|
||||||
g.description,
|
g.description,
|
||||||
|
g.visible,
|
||||||
],
|
],
|
||||||
readonly=True)
|
readonly=True)
|
||||||
if self.request.has_perm('label_profiles.read'):
|
if self.request.has_perm('label_profiles.read'):
|
||||||
|
@ -104,6 +110,7 @@ class ProfileCrud(CrudView):
|
||||||
fs.printer_spec,
|
fs.printer_spec,
|
||||||
fs.formatter_spec,
|
fs.formatter_spec,
|
||||||
fs.format,
|
fs.format,
|
||||||
|
fs.visible,
|
||||||
])
|
])
|
||||||
return fs
|
return fs
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ class ProductsGrid(SearchableAlchemyGridView):
|
||||||
|
|
||||||
def render_kwargs(self):
|
def render_kwargs(self):
|
||||||
q = Session.query(rattail.LabelProfile)
|
q = Session.query(rattail.LabelProfile)
|
||||||
|
q = q.filter(rattail.LabelProfile.visible == True)
|
||||||
q = q.order_by(rattail.LabelProfile.ordinal)
|
q = q.order_by(rattail.LabelProfile.ordinal)
|
||||||
return {'label_profiles': q.all()}
|
return {'label_profiles': q.all()}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue