Show yesterday by default for Trainwreck if so configured
This commit is contained in:
parent
836fc0bf5b
commit
3d6cc8a490
|
@ -165,16 +165,22 @@ class TransactionView(MasterView):
|
|||
return TrainwreckSession()
|
||||
|
||||
def configure_grid(self, g):
|
||||
super(TransactionView, self).configure_grid(g)
|
||||
super().configure_grid(g)
|
||||
app = self.get_rattail_app()
|
||||
|
||||
g.filters['receipt_number'].default_active = True
|
||||
g.filters['receipt_number'].default_verb = 'equal'
|
||||
|
||||
# end_time
|
||||
g.set_sort_defaults('end_time', 'desc')
|
||||
g.filters['end_time'].default_active = True
|
||||
g.filters['end_time'].default_verb = 'equal'
|
||||
g.filters['end_time'].default_value = str(app.today())
|
||||
g.set_sort_defaults('end_time', 'desc')
|
||||
# TODO: should expose this setting somewhere
|
||||
if self.rattail_config.getbool('trainwreck', 'show_yesterday_first'):
|
||||
date = app.yesterday()
|
||||
else:
|
||||
date = app.today()
|
||||
g.filters['end_time'].default_value = str(date)
|
||||
|
||||
g.set_enum('system', self.enum.TRAINWRECK_SYSTEM)
|
||||
g.set_type('total', 'currency')
|
||||
|
|
Loading…
Reference in a new issue