From 14f9dfdaa9455fe85f1b27f4107a5dcdacd4d27b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 30 Jan 2022 20:28:24 -0600 Subject: [PATCH] Add `client_id` field for TimeEntry export to Harvest --- rattail_harvest/harvest/importing/model.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rattail_harvest/harvest/importing/model.py b/rattail_harvest/harvest/importing/model.py index 582c159..8b55b15 100644 --- a/rattail_harvest/harvest/importing/model.py +++ b/rattail_harvest/harvest/importing/model.py @@ -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'],