From 5dcb027eeac9f196db997f9880b55a90c381f325 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 5 Nov 2021 20:36:38 -0500 Subject: [PATCH] Show member type names for CORE member batch --- tailbone_corepos/views/batch/coremember.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tailbone_corepos/views/batch/coremember.py b/tailbone_corepos/views/batch/coremember.py index 2e4886d..084e66e 100644 --- a/tailbone_corepos/views/batch/coremember.py +++ b/tailbone_corepos/views/batch/coremember.py @@ -24,12 +24,15 @@ 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.batch.coremember import CoreMemberBatchHandler 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): """ @@ -92,6 +95,13 @@ class CoreMemberBatchView(BatchMasterView): def configure_row_grid(self, 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('first_name') g.set_link('last_name') @@ -109,7 +119,7 @@ class CoreMemberBatchView(BatchMasterView): kwargs['batch'] = batch kwargs['instance_title'] = batch.id_str - fields = list(self.handler.importing_fields) + fields = batch.get_param('fields') kwargs['diff_fields'] = fields kwargs['diff_old_values'] = dict([