Add client_id field for TimeEntry export to Harvest

This commit is contained in:
Lance Edgar 2022-01-30 20:28:24 -06:00
parent 1f54ddc9e4
commit 14f9dfdaa9

View file

@ -44,6 +44,7 @@ class TimeEntryImporter(ToHarvest):
supported_fields = [
'id',
'user_id',
'client_id',
'project_id',
'task_id',
'spent_date',
@ -72,6 +73,7 @@ class TimeEntryImporter(ToHarvest):
def normalize_local_object(self, entry):
data = {
'id': entry['id'],
'client_id': entry['client']['id'],
'project_id': entry['project']['id'],
'task_id': entry['task']['id'],
'spent_date': entry['spent_date'],
@ -100,11 +102,14 @@ class TimeEntryImporter(ToHarvest):
result = dict(host_data)
if 'user_id' in self.fields:
result['user'] = {'id': result['user_id']}
if 'client_id' in self.fields:
result['client'] = {'id': result['client_id']}
result['project'] = {'id': result['project_id']}
result['task'] = {'id': result['task_id']}
return result
kwargs = {
'client_id': host_data['client_id'],
'project_id': host_data['project_id'],
'task_id': host_data['task_id'],
'spent_date': host_data['spent_date'],