Add HarvestUser.person association

importer does not set this; you must do so manually
This commit is contained in:
Lance Edgar 2022-01-30 17:40:19 -06:00
parent 3883a8551f
commit ec78f8c9c4
6 changed files with 210 additions and 8 deletions

View file

@ -33,7 +33,7 @@ import sqlalchemy as sa
from rattail import importing
from rattail.util import OrderedDict
from rattail_harvest import importing as rattail_harvest_importing
from rattail_harvest.harvest.webapi import HarvestWebAPI
from rattail_harvest.harvest.webapi import make_harvest_webapi
log = logging.getLogger(__name__)
@ -71,13 +71,7 @@ class FromHarvest(importing.Importer):
def setup(self):
super(FromHarvest, self).setup()
access_token = self.config.require('harvest', 'api.access_token')
account_id = self.config.require('harvest', 'api.account_id')
user_agent = self.config.require('harvest', 'api.user_agent')
self.webapi = HarvestWebAPI(access_token=access_token,
account_id=account_id,
user_agent=user_agent)
self.webapi = make_harvest_webapi(self.config)
def time_from_harvest(self, value):
# all harvest times appear to come as UTC, so no conversion needed
@ -105,6 +99,9 @@ class HarvestUserImporter(FromHarvest, rattail_harvest_importing.model.HarvestUs
def supported_fields(self):
fields = list(super(HarvestUserImporter, self).supported_fields)
# this is for local tracking only; is not in harvest
fields.remove('person_uuid')
# this used to be in harvest i thought, but is no longer?
fields.remove('name')