diff --git a/tailbone/views/trainwreck/base.py b/tailbone/views/trainwreck/base.py index 8ac243a0..82c5c163 100644 --- a/tailbone/views/trainwreck/base.py +++ b/tailbone/views/trainwreck/base.py @@ -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')