diff --git a/rattail_harvest/harvest/importing/model.py b/rattail_harvest/harvest/importing/model.py index 47e85de..582c159 100644 --- a/rattail_harvest/harvest/importing/model.py +++ b/rattail_harvest/harvest/importing/model.py @@ -40,7 +40,9 @@ class TimeEntryImporter(ToHarvest): Harvest time entry data importer. """ model_name = 'TimeEntry' + key = 'id' supported_fields = [ + 'id', 'user_id', 'project_id', 'task_id', @@ -69,6 +71,7 @@ class TimeEntryImporter(ToHarvest): def normalize_local_object(self, entry): data = { + 'id': entry['id'], 'project_id': entry['project']['id'], 'task_id': entry['task']['id'], 'spent_date': entry['spent_date'], @@ -83,6 +86,14 @@ class TimeEntryImporter(ToHarvest): return data + def get_next_harvest_id(self): + if hasattr(self, 'next_harvest_id'): + next_id = self.next_harvest_id + else: + next_id = 1 + self.next_harvest_id = next_id + 1 + return -next_id + def create_object(self, key, host_data): if self.dry_run: # mock out return value