There are some steps that need to be done as the tmetric admin and the OpenProject admin.
- get the client ID by selecting the client, whose data you want to sync with OpenProject, from Manage->Clients and copying the last number from the URL. For example, if the URL is
https://app.tmetric.com/#/account/12345/clients/67890
, the client ID is67890
. - create a dummy project. You can give it any name you like. No time will be logged to this project, but it's needed to create links to OpenProject.
- get the ID of the dummy project. For example, if the URL is
https://app.tmetric.com/#/account/12345/projects/989898
the project ID is989898
. - create work types. The names of the Work Types must match the names of the time tracking activities in OpenProject.
- assign the work types to the project which data you want to sync to OpenProject.
- create a tag called
transferred-to-openproject
. This tag will be used to mark time entries that have been transferred to OpenProject.
- enable the 'Time and costs' module for the projects you want to sync with tmetric
- go to your profile (by clicking on your avatar in the top right corner)
- click on
My account
- click on
Access tokens
- click on
+ API token
- give the token a name and click on
Create
- copy the token
- go to your profile (by clicking on your avatar in the top right corner)
- click on
Profile Settings
- click on
Get new API token
- copy the token
in your home folder create a file called .OpenProjectTmetricIntegration.yaml
with the following content (enter your tokens):
openproject:
url: 'https://community.openproject.org'
token: <openproject token>
tmetric:
token: <t-metric token>
clientId: <id of the client in tmetric>
dummyProjectId: <id of the dummy project the admin created>
go run main.go check tmetric
The tool with show you any invalid or inconsistent time entries and ask you for data to fix them. This step will only adjust data on tmetric, no data will be written to OpenProject.
go run main.go copy
This will copy the time entries from tmetric to OpenProject. The time entries will be marked with the tag transferred-to-openproject
in tmetric. Any entry that already has this tag will be skipped.
go run main.go diff
This will show you a table with the time entries in both systems and if there is any difference in the logged time per day. Check if the data is correct.
- If some data is in tmetric but not in OpenProject, run the
copy
command again. - If some data is in OpenProject but not in tmetric, delete or edit it in OpenProject. To do so use the cost-report feature.
- If you want to sync data again from tmetric to OpenProject, remove the
transferred-to-openproject
tag from the time entries in tmetric. This will create new entries in OpenProject and by that might lead to duplication.
By default, the script will work with the current calendar month, but the start and end date can be configured with the --start
and --end
flags. The date format is YYYY-MM-DD
.