Skip customer record with no member type, for blue line update
otherwise would just raise error, and prevent the rest of updates from happening
This commit is contained in:
parent
02107d32a4
commit
5dc1392ef7
|
@ -24,6 +24,7 @@
|
||||||
CORE-POS -> "self" data import
|
CORE-POS -> "self" data import
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from corepos.db.office_op import model as corepos
|
from corepos.db.office_op import model as corepos
|
||||||
|
@ -34,6 +35,9 @@ from rattail_corepos.corepos.office.importing.db.corepos import FromCoreHandler
|
||||||
from rattail_corepos.corepos.office.util import get_fannie_config_value
|
from rattail_corepos.corepos.office.util import get_fannie_config_value
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class FromCoreOfficeToSelf(FromCoreHandler, corepos_importing.model.ToCoreHandler):
|
class FromCoreOfficeToSelf(FromCoreHandler, corepos_importing.model.ToCoreHandler):
|
||||||
"""
|
"""
|
||||||
Common base class for import handlers which read data from the
|
Common base class for import handlers which read data from the
|
||||||
|
@ -85,6 +89,12 @@ class CustDataImporter(FromCoreOffice, corepos_importing.model.CustDataImporter)
|
||||||
'BLUELINE_TEMPLATE')
|
'BLUELINE_TEMPLATE')
|
||||||
|
|
||||||
def normalize_host_object(self, customer):
|
def normalize_host_object(self, customer):
|
||||||
|
|
||||||
|
if not customer.member_type:
|
||||||
|
log.warning("skipping customer #%s with no member type: %s",
|
||||||
|
customer.card_number, customer)
|
||||||
|
return
|
||||||
|
|
||||||
blueline = self.blueline_template
|
blueline = self.blueline_template
|
||||||
blueline = blueline.replace('{{ACCOUNTNO}}', str(customer.card_number))
|
blueline = blueline.replace('{{ACCOUNTNO}}', str(customer.card_number))
|
||||||
blueline = blueline.replace('{{ACCOUNTTYPE}}', customer.member_type.description)
|
blueline = blueline.replace('{{ACCOUNTTYPE}}', customer.member_type.description)
|
||||||
|
|
Loading…
Reference in a new issue