feat: Added client tempo report generation for Jira
This feature automates sending the tempo hour reports to the client. The idea is to run two crons:
- To generate the report from 1-15
- To generate the report from 16-30
The reports should be mailed to the client.
JIRA tickets: https://tasks.opencraft.com/browse/BB-7752
Discussions: Link to any public dicussions about this PR or the design/architecture. Otherwise omit this.
Dependencies: None
Screenshots: Always include screenshots if there is any change to the UI.
Sandbox URL: TBD - sandbox is being provisioned.
Merge deadline: "None" if there's no rush, "ASAP" if it's critical, or provide a specific date if there is one.
Testing instructions:
- Setup the account repo first by adding the env variable, you need to add(The production branch is billing-v1)
a. We have to make
.env
as mentioned in set-up document
b. make dev.up
doesn't work we have do docker-compose up -d
c. Put/edit the below variables in .env
JIRA_SERVER_URL="https://tasks.opencraft.com"
TEMPO_API_TOKEN=<Token>
REPORT_CC_EMAIL='billing@opencraft.com'
TEMPO_API_TOKEN from here
- Run
docker-compose up -d
this will start all docker container - Exec in the docker container by
docker-compose exec web bash
. - We need to install wkthmltopdf. Run
apt update
,apt upgrade
andapt install wkhtmltopdf
, you have to symlink the binary toln -s /usr/bin/wkhtmltopdf .
- Make the changes below because in docker wkhtmltopdf is not able to get the CSS file.
diff --git a/accounting/invoice/templates/report/report.html b/accounting/invoice/templates/report/report.html
index 51fb8a2..739ef26 100644
--- a/accounting/invoice/templates/report/report.html
+++ b/accounting/invoice/templates/report/report.html
@@ -17,7 +17,7 @@
-
-->
-{% load static %}
+<!-- {% load static %} -->
<!DOCTYPE html>
<html lang="en">
@@ -25,8 +25,8 @@
<base href="{{ site.domain }}">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <link rel="stylesheet" type="text/css" href="{% static 'vendor/css/bootstrap.min.css' %}"/>
- <link rel="stylesheet" type="text/css" href="{% static 'default/css/default.css' %}"/>
+ <link rel="stylesheet" type="text/css" href="http://localhost:1786/static/vendor/css/bootstrap.min.css"/>
+ <link rel="stylesheet" type="text/css" href="http://localhost:1786/static/default/css/default.css"/>
</head>
<body>
<div class="container">
- We need to add Client Info
a. Account: UQ-LEARNX-MAINTENANCE,UQXSUPPORT
b. Emails: farhaan@opencraft.com,farhaan+test@opencraft.com (We can check for duplicates and wrong email addresses)
c. Name: University of Queensland
4. and enter the python shell ./manage.py shell_plus
5. Run
from accounting.invoice import tasks
tasks.send_post_mid_month_report()
tasks.send_mid_month_report()
a. You will see the mail content on the terminal.
-
This will produce a report in media directory, you might have to change the ownership with
chown -R <user>:<user> media/
on host not on docker. -
Open the PDF and see the report.