From e239ea70e4775967c4434ec47be437187b1225d8 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 14 Nov 2022 17:43:26 -0600 Subject: [PATCH] Stop importing certain fields for HarvestUser cache table since the Harvest API is suddenly no longer providing the values --- rattail_harvest/importing/harvest.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rattail_harvest/importing/harvest.py b/rattail_harvest/importing/harvest.py index 6fe466b..6153348 100644 --- a/rattail_harvest/importing/harvest.py +++ b/rattail_harvest/importing/harvest.py @@ -114,6 +114,17 @@ class HarvestUserImporter(FromHarvest, rattail_harvest_importing.model.HarvestUs data = super(HarvestUserImporter, self).normalize_host_object(user) if data: + # TODO: for some reason the API used to include the these + # fields, but no longer does as of 2022-11-11, so null is + # kinda the only thing that makes sense now. if possible, + # should figure out "what changed" at Harvest, but maybe + # these fields should just be removed from our cache + # schema? + data.setdefault('is_admin', None) + data.setdefault('is_project_manager', None) + data.setdefault('can_see_rates', None) + data.setdefault('can_create_invoices', None) + if data['telephone'] == '': data['telephone'] = None