Skip to content

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:

  1. To generate the report from 1-15
  2. 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:

  1. 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

  1. Run docker-compose up -d this will start all docker container
  2. Exec in the docker container by docker-compose exec web bash.
  3. We need to install wkthmltopdf. Run apt update, apt upgrade and apt install wkhtmltopdf, you have to symlink the binary to ln -s /usr/bin/wkhtmltopdf .
  4. 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">
  1. 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 image 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.

  1. 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.

  2. Open the PDF and see the report.

Edited by Farhaan Bukhsh

Merge request reports