Show member type names for CORE member batch

This commit is contained in:
Lance Edgar 2021-11-05 20:36:38 -05:00
parent 170996e675
commit 5dcb027eea

View file

@ -24,12 +24,15 @@
Views for CORE member batches Views for CORE member batches
""" """
from tailbone.views.batch import BatchMasterView from corepos.db.office_op import model as corepos
from rattail_corepos.db.model import CoreMemberBatch, CoreMemberBatchRow from rattail_corepos.db.model import CoreMemberBatch, CoreMemberBatchRow
from rattail_corepos.batch.coremember import CoreMemberBatchHandler from rattail_corepos.batch.coremember import CoreMemberBatchHandler
from rattail_corepos.config import core_office_url, core_office_customer_account_url from rattail_corepos.config import core_office_url, core_office_customer_account_url
from tailbone.views.batch import BatchMasterView
from tailbone_corepos.db import CoreOfficeSession
class CoreMemberBatchView(BatchMasterView): class CoreMemberBatchView(BatchMasterView):
""" """
@ -92,6 +95,13 @@ class CoreMemberBatchView(BatchMasterView):
def configure_row_grid(self, g): def configure_row_grid(self, g):
super(CoreMemberBatchView, self).configure_row_grid(g) super(CoreMemberBatchView, self).configure_row_grid(g)
app = self.get_rattail_app()
member_types = app.cache_model(CoreOfficeSession(),
corepos.MemberType,
normalizer=lambda mtype: mtype.description,
key=lambda mtype, normal: mtype.id)
g.set_enum('member_type_id', member_types)
g.set_link('card_number') g.set_link('card_number')
g.set_link('first_name') g.set_link('first_name')
g.set_link('last_name') g.set_link('last_name')
@ -109,7 +119,7 @@ class CoreMemberBatchView(BatchMasterView):
kwargs['batch'] = batch kwargs['batch'] = batch
kwargs['instance_title'] = batch.id_str kwargs['instance_title'] = batch.id_str
fields = list(self.handler.importing_fields) fields = batch.get_param('fields')
kwargs['diff_fields'] = fields kwargs['diff_fields'] = fields
kwargs['diff_old_values'] = dict([ kwargs['diff_old_values'] = dict([