In this page
Tempo Timesheets integration features
Tempo Timesheets integration vs. the Tempo Timesheets built-in PDF exports
Tutorial video
Tempo Timesheets PDF export samples
Jira timesheet
Time-based invoice from Jira
Tempo Timesheets for invoicing
Configuration
Configuring the Tempo Timesheets custom fields
Configuring the Tempo Timesheets REST API access
Configuring the Tempo Timesheets worklogs in PDF templates
Configuring the customer invoice addresses
Configuring the period filter for Tempo Timesheets worklogs
Configuring the pre-loader for Tempo Timesheets worklogs
Configuring the Tempo REST API version
Troubleshooting
I see "java.io.FileNotFoundException: https://api.tempo.io/core/3/..." errors in the exported PDF.
Learn more about Tempo Timesheets
What is Tempo Timesheets?
(supported since Better PDF Exporter 1.1.0)
Tempo Timesheets is the most widely used time tracking solution for Jira.
Tempo Timesheets integration features
- You can export Tempo Timesheets-managed custom field types, like Account and Team to PDF.
- You can export Tempo Timesheets-managed worklogs to PDF. Exporting custom work attributes is optional.
- You can filter Tempo Timesheets worklogs by start date and end date.
- You can export worklogs created by all users or the current user only.
- You can implement other types of custom filtering, for example excluding the non-billable worklogs
- Better PDF Exporter also offers a customizable timesheet/invoice template to generate custom timesheets and time-based invoices from Tempo Timesheets worklogs.
- Known limitation: you cannot start exports directly from the Tempo Timesheets screens, because Tempo Timesheets for Jira Cloud does not allow extending its interface by external actions. We will absolutely implement PDF export also for these screens as soon as they support external actions. Note that only the Tempo Cloud team can remove this blocker.
To indicate its importance:- Please vote on the corresponding idea on the Tempo Ideas portal. Leave a comment explaining your use case and its impact on your team's work. The more votes and comments this feature request receives, the higher probability it will be implemented. Voting and commenting takes only 2 minutes of your time, and it also makes sure you will get notified when there is an update.
- Also, there is a counter-part feature request at Midori. Although the Tempo feature request must be solved first, we use this one to collect feedback and interest on our side. Vote for this by clicking the "thumbs-up" icon, add your use case as a comment and click "Follow". All future updates on this story will be posted there.
(Need more features? Tell us in a support ticket!)
Tempo Timesheets integration vs. the Tempo Timesheets built-in PDF exports
You may want to ask: if Tempo Timesheets has a built-in PDF export feature, why would you use another app for the same?
While the Tempo Timesheets built-in PDF exports may be sufficient for basic use cases, the Better PDF Exporter integration is more powerful in, at least, these:
-
It is extremely customizable.
Instead of accepting the pre-defined export types in Tempo Timesheets, you can define your own types via PDF templates. -
It supports all the powerful PDF features.
You can use custom calculations in Groovy (sorting, complex math, data integration, etc.), embedded attachments, PDF bookmarks, charts, graphics (in Groovy, SVG, etc.), among others. -
It is integrated with all the popular Jira apps.
You can freely combine Tempo Timesheets data and other apps' data in the same PDF file. -
It comes with powerful templates optimized for Tempo Timesheets.
You can use those "as is", or customize them to your needs. - It is well-documented with the customization guide, the Expression Reference Manual, the recipes, and such.
If at least one of these is important for you, give the app a try.
Tutorial video
Create customized timesheets or invoices from the Tempo timesheets with one click! (Although the video below was captured about the app's Server version, the Cloud version is very similar. The only major difference is that in the Cloud version you cannot export directly from the Tempo Timesheets screens, due to a limitation in Atlassian Connect.)
Tempo Timesheets PDF export samples
Jira timesheet
This is a simplistic PDF timesheet created from the worklogs of a Jira issue list, perfect to share with your clients. Even in this simple format, you can add your company logo, address and the client information.
Time-based invoice from Jira
This invoice was created using the same PDF export template as before, but after specifying the hourly rate, it will include money information as well (amout due, net, gross). You may event want to add tax information, payment information (SWIFT code and IBAN). If you run time and material based projects, you can easily turn Jira into a powerful billing system with this PDF export template.
Tempo Timesheets for invoicing
Invoices can also be created from Tempo Timesheets worklogs, making use of the additional Tempo Timesheets domain data like Account, Team and price tables.
Configuration
Configuring the Tempo Timesheets custom fields
There is nothing to do. Better PDF Exporter will automatically recognize the Tempo Timesheets-managed fields and export them accordingly.
Configuring the Tempo Timesheets REST API access
As this integration relies on the Tempo Timesheets REST API, you need to configure the access token for the REST API calls in the templates:
- Go to Jira → Apps → Tempo → Settings → API Integration.
- Click New Token.
- Enter a name for the token. (Recommendation: "Better PDF Exporter".)
- Set a desired expiration date. (Recommendation: select the maximum.)
- Under Custom access, check all "View xxx" permissions.
- Click Confirm.
- Copy the access token from the panel to the clipboard, and click Close. (From this point, don't overwrite the clipboard until the end of the guide, otherwise you may lose the access token!)
- Still on the Settings page, go to Permission Roles.
- Click Add permission role in the top right.
- Enter a name for the role. (Recommendation: "Better PDF Exporter".)
- Check the "View Worklogs" permission.
- Click Add users, and add your user account. (As you created the access token, it will grant the "view worklogs" permission to the token, too. And, using the token, the app will be able to access and export everyone's worklogs!)
- Click the check mark icon "✔" to save your changes.
- Click the cog icon "⚙" in the top right → Apps → PDF Templates (under Better PDF Exporter).
-
Open the issue-fo.vm template for editing, uncomment this variable in the top part, and paste the access token from the clipboard to the value (don't remove the quotation marks around the string!):
## issue-fo.vm ## Tempo Timesheets #set($tempoAccessToken = 'AwjMZRE5TfVlj6xU8Zj452BclUhAch')
- Save the changes. (Don't worry about storing tokens here: this file is visible only for Jira administrators, who would have super-user permissions anyway.)
- Similarly, set the same access token in the timesheet-invoice-fo.vm template.
Configuring the Tempo Timesheets worklogs in PDF templates
After you set up the Tempo Timesheets REST API access, you may want to configure the details of exporting the worklogs.
There are configuration parameters in the top part of the issue-fo.vm template to filter the worklogs:
## issue-fo.vm #set($tempoDateFrom = '2000-01-01') ## start date for the exportable Tempo Timesheets worklog period #set($tempoDateTo = '2099-12-31') ## end date for the exportable Tempo Timesheets worklog period #set($tempoFilterByUser = false) ## set to "true" to export the Tempo Timesheets worklogs of the current user only, or "false" to export everyone's
There are multiple configuration parameters in timesheet-invoice-fo.vm to look up the customer from Tempo Timesheets, to export the custom work attributes, and to export the billable hours only (i.e. to exclude the non-billable hours):
## timesheet-invoice-fo.vm #set($tempoDateFrom = '2000-01-01') ## start date for the exportable Tempo Timesheets worklog period #set($tempoDateTo = '2099-12-31') ## end date for the exportable Tempo Timesheets worklog period #set($tempoExportCustomer = true) ## whether to look up the "Customer" from Tempo Timesheets based on the account set in the first issue to be exported #set($tempoExportWorkAttributes = true) ## whether to display the work attributes for each worklog #set($tempoExportBillableHours = true) ## whether to export the billable hours only
Configuring the customer invoice addresses
When the timesheet-invoice-fo.vm template is rendered in "invoice" mode, it will automatically figure out the customer's invoice address based on the Tempo Timesheets worklogs. This section explains how.
First, let's see the underlying Tempo Timesheets concepts!
In Tempo Timesheets, each worklog is linked to a Tempo account in one of these two ways:
- Either the worklog inherits the account from the Account custom field of its owning issue. (This is the default.)
- Or, the worklog has the account set by using an "Account" type work attribute.
Plus, each Tempo account is linked to a Tempo customer. Consequently, each worklog is indirectly linked to a Tempo customer. Note that both accounts and customers are identified by unique textual keys.
So, how is the customer address figured out by the timesheet-invoice-fo.vm template?
-
First, it tries to get the account from the "Account" field:
- It takes the first issue.
- It gets the value of the "Account" field.
-
If the "Account" field wasn't found or if it is unset, it tries to get the account from the work attributes:
- It takes the first worklog of the first issue.
- It gets the value of the first "Account" type work attribute.
- If the account was found in either way, it gets the key and the name of the customer linked to the account. (You can maintain your customers in Tempo Timesheets.)
-
Using the customer key, it looks up the customer address from a map in the template code.
You can maintain the list of the customer addresses in this code block:
## timesheet-invoice-fo.vm ## mapping of Tempo customer keys to customer address lines (note: keys are case-sensitive) #set($tempoCustomerAddresses = { "ACME": [ "17 boulevard Saint-Marcel", "75013 Paris", "France" ], "MEGACORP": [ "45 Stirling Highway", "Crawley WA 6009 Perth", "Australia" ], "XYZINC": [ "Schwanthaler Strasse 85a", "Munich 80336", "Germany" ] })
As this customer address finder logic is coded in the template, it can be easily customized if necessary.
Of course, every invoice must be created for one specific customer. The simplistic logic above assumes that all the worklogs of all the issues passed to the template are created for the same customer. It means that:
- It is safe to check only the first issue and its first worklog to figure out the customer.
- It is your responsibility to export only those issues that are created for the same customer to an invoice.
To troubleshoot the case when the customer or its address is not found by template, check these:
- Is the first issue has a Tempo account set in the "Account" field?
- If not, is the first issue's first worklog linked to a Tempo account?
- Is that Tempo account linked to a Tempo customer?
- Is there a $tempoCustomerAddresses entry with the key of that Tempo customer?
Configuring the period filter for Tempo Timesheets worklogs
You can configure a time period, and the tempo-tool.groovy script exports only the worklogs in that time period. The time period is specified by its start date and end date.
You can configure the period by setting these values in the templates:
## issue-fo.vm or timesheet-invoice-fo.vm #set($tempoDateFrom = '2000-01-01') ## start date for the exportable Tempo Timesheets worklog period #set($tempoDateTo = '2099-12-31') ## end date for the exportable Tempo Timesheets worklog period
Configuring the pre-loader for Tempo Timesheets worklogs
To minimize the number of Tempo Timesheets REST API calls, thus to achieve the best performance, the worklogs are pre-loaded for all issues by one or more optimized REST API calls. One REST API call bulk-loads the worklogs of multiple issues. Therefore, the total number of REST API calls depends on the total number of issues.
When the REST API call is made, the issue IDs are passed in the URL. It can eventually lead to "URL is too long!" problems if your issue IDs are overly long, which could theoretically happen if your Jira instance has a huge number of issues. The number of issue IDs passed in one REST API call is configurable in the top part of the tempo-tool.groovy script:
// tempo-tool.groovy /* Maximum number of issue IDs to pass in the URL in a single REST API call. */ def ISSUE_IDS_PER_REQUEST = 50
Configuring the Tempo REST API version
The REST API version can be changed with the following configuration option in the tempo-tool.groovy script:
// tempo-tool.groovy def TEMPO_REST_API_VERSION = "4" // change to "core/3" to revert to the previous REST API version (as long as it's available for your site)
Troubleshooting
I see "java.io.FileNotFoundException: https://api.tempo.io/core/3/..." errors in the exported PDF.
This error means that the v3 REST API is not available for your Jira instance anymore, but you are still using an outdated version of the tempo-tool.groovy script. You need to update it to the latest version available in the version history page (look for the ZIP archive for the most recent version with upgrade steps).
If you switch to the v4 REST API and you have custom templates, you might have to adjust them. To see what changes you have to apply, review and compare both REST API version's documentation:
Learn more about Tempo Timesheets
- Tempo Timesheets product information (at its own vendor)
- Tempo Timesheets documentation
- Tempo Timesheets app page (on the Atlassian Marketplace)