Add 'id' key field for exporting TimeEntry to Harvest

This commit is contained in:
Lance Edgar 2022-01-30 19:34:15 -06:00
parent ec78f8c9c4
commit 1f54ddc9e4

View file

@ -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