fix: fix default filter verbs logic for workorder status
This commit is contained in:
parent
83586ef90f
commit
21f90f3f32
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2023 Lance Edgar
|
||||
# Copyright © 2010-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
|
@ -83,12 +83,12 @@ class WorkOrderView(MasterView):
|
|||
]
|
||||
|
||||
def __init__(self, request):
|
||||
super(WorkOrderView, self).__init__(request)
|
||||
super().__init__(request)
|
||||
app = self.get_rattail_app()
|
||||
self.workorder_handler = app.get_workorder_handler()
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(WorkOrderView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
model = self.model
|
||||
|
||||
# customer
|
||||
|
@ -113,7 +113,7 @@ class WorkOrderView(MasterView):
|
|||
return 'warning'
|
||||
|
||||
def configure_form(self, f):
|
||||
super(WorkOrderView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
model = self.model
|
||||
SelectWidget = forms.widgets.JQuerySelectWidget
|
||||
|
||||
|
@ -208,7 +208,7 @@ class WorkOrderView(MasterView):
|
|||
return event.workorder
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(WorkOrderView, self).configure_row_grid(g)
|
||||
super().configure_row_grid(g)
|
||||
g.set_enum('type_code', self.enum.WORKORDER_EVENT)
|
||||
g.set_sort_defaults('occurred')
|
||||
|
||||
|
@ -353,7 +353,7 @@ class WorkOrderView(MasterView):
|
|||
class StatusFilter(grids.filters.AlchemyIntegerFilter):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(StatusFilter, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
from drild import enum
|
||||
|
||||
|
@ -369,14 +369,14 @@ class StatusFilter(grids.filters.AlchemyIntegerFilter):
|
|||
|
||||
@property
|
||||
def verb_labels(self):
|
||||
labels = dict(super(StatusFilter, self).verb_labels)
|
||||
labels = dict(super().verb_labels)
|
||||
labels['is_active'] = "Is Active"
|
||||
labels['not_active'] = "Is Not Active"
|
||||
return labels
|
||||
|
||||
@property
|
||||
def valueless_verbs(self):
|
||||
verbs = list(super(StatusFilter, self).valueless_verbs)
|
||||
verbs = list(super().valueless_verbs)
|
||||
verbs.extend([
|
||||
'is_active',
|
||||
'not_active',
|
||||
|
@ -385,7 +385,11 @@ class StatusFilter(grids.filters.AlchemyIntegerFilter):
|
|||
|
||||
@property
|
||||
def default_verbs(self):
|
||||
verbs = list(super(StatusFilter, self).default_verbs)
|
||||
verbs = super().default_verbs
|
||||
if callable(verbs):
|
||||
verbs = verbs()
|
||||
|
||||
verbs = list(verbs or [])
|
||||
verbs.insert(0, 'is_active')
|
||||
verbs.insert(1, 'not_active')
|
||||
return verbs
|
||||
|
|
Loading…
Reference in a new issue