From fe0daf00bc8fe68f863b4468fa7b7d3afbce24e4 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 5 Oct 2023 09:50:12 -0500 Subject: [PATCH] Add logic to fetch single Harvest time entry via API for one-off imports --- rattail_harvest/harvest/importing/model.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rattail_harvest/harvest/importing/model.py b/rattail_harvest/harvest/importing/model.py index 3a874c5..611680d 100644 --- a/rattail_harvest/harvest/importing/model.py +++ b/rattail_harvest/harvest/importing/model.py @@ -79,6 +79,12 @@ class TimeEntryImporter(ToHarvest): cache[key] = normal return cache + def get_single_local_object(self, key): + assert len(self.key) == 1 and self.key[0] == 'id' + entry_id = key[0] + if entry_id > 0: + return self.webapi.get_time_entry(entry_id) + def normalize_local_object(self, entry): data = { 'id': entry['id'],