Use Grid.make_sorter()
instead of legacy code
b/c multi-column sorting relies on this
This commit is contained in:
parent
659f5a8fe1
commit
919d8d109f
14 changed files with 198 additions and 176 deletions
|
@ -175,9 +175,10 @@ class PurchasingBatchView(BatchMasterView):
|
|||
g.set_filter('vendor', model.Vendor.name,
|
||||
default_active=True, default_verb='contains')
|
||||
|
||||
g.joiners['department'] = lambda q: q.join(model.Department)
|
||||
g.filters['department'] = g.make_filter('department', model.Department.name)
|
||||
g.sorters['department'] = g.make_sorter(model.Department.name)
|
||||
# department
|
||||
g.set_joiner('department', lambda q: q.join(model.Department))
|
||||
g.set_filter('department', model.Department.name)
|
||||
g.set_sorter('department', model.Department.name)
|
||||
|
||||
g.set_joiner('buyer', lambda q: q.join(model.Employee).join(model.Person))
|
||||
g.set_filter('buyer', model.Person.display_name)
|
||||
|
@ -212,7 +213,7 @@ class PurchasingBatchView(BatchMasterView):
|
|||
# return form
|
||||
|
||||
def configure_common_form(self, f):
|
||||
super(PurchasingBatchView, self).configure_common_form(f)
|
||||
super().configure_common_form(f)
|
||||
|
||||
# po_total
|
||||
if self.creating:
|
||||
|
@ -225,7 +226,7 @@ class PurchasingBatchView(BatchMasterView):
|
|||
f.set_type('po_total_calculated', 'currency')
|
||||
|
||||
def configure_form(self, f):
|
||||
super(PurchasingBatchView, self).configure_form(f)
|
||||
super().configure_form(f)
|
||||
model = self.model
|
||||
batch = f.model_instance
|
||||
app = self.get_rattail_app()
|
||||
|
@ -598,7 +599,7 @@ class PurchasingBatchView(BatchMasterView):
|
|||
# return query.options(orm.joinedload(model.PurchaseBatchRow.credits))
|
||||
|
||||
def configure_row_grid(self, g):
|
||||
super(PurchasingBatchView, self).configure_row_grid(g)
|
||||
super().configure_row_grid(g)
|
||||
|
||||
g.set_type('upc', 'gpc')
|
||||
g.set_type('cases_ordered', 'quantity')
|
||||
|
@ -685,7 +686,7 @@ class PurchasingBatchView(BatchMasterView):
|
|||
return 'notice'
|
||||
|
||||
def configure_row_form(self, f):
|
||||
super(PurchasingBatchView, self).configure_row_form(f)
|
||||
super().configure_row_form(f)
|
||||
row = f.model_instance
|
||||
if self.creating:
|
||||
batch = self.get_instance()
|
||||
|
@ -894,7 +895,7 @@ class PurchasingBatchView(BatchMasterView):
|
|||
batch.invoice_total -= row.invoice_total
|
||||
|
||||
# do the "normal" save logic...
|
||||
row = super(PurchasingBatchView, self).save_edit_row_form(form)
|
||||
row = super().save_edit_row_form(form)
|
||||
|
||||
# TODO: is this needed?
|
||||
# self.handler.refresh_row(row)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue