Skip to content

feat: multiple invoice automation improvements

Description

This MR brings the following changes (It would be best to review the changes commit-wise) :

Support for multiple bulk payment senders

Currently we can set only one bulk payment sender through the TRANSFERWISE_BULK_PAYMENT_SENDER django setting.

The changes here allows us to set a list of senders through that setting and create bulk payments for each.

Upload invoices and bulk payment CSVs to different folders for each account

Currently all the invoices generated for all clients are uploaded to the same directory in Drive.

The changes here allows configuration of seperate drives for each account where the respective invoices would be uploaded.

Delete duplicate file uploads

Currently if an invoice is regenrated, the old and the new copy of the invoice are both retained in the same Drive directory with the same name.

This MR introduces the ability to find and remove existing duplicate files before uploading new ones.

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions. Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

Support for multiple bulk payment senders

  1. Login to stage.billing.opencraft.com
  2. Go to invoices
  3. Verify that the latest two invoices are not marked as paid
  4. Trigger the send_bulk_payment_csv function from django shell (Let me know when ready, I can run this for you)
  5. Go to bulk payments page and verify two new entries have been created, one for OpenCraft and the other for Flouzo
  6. Click on the CSV links to make sure respective CSVs have been generated and saved in google drive. Make sure each CSV has one entry in it.
  7. Go to payments page and verify two new entries have been created corresponding to the CSV entries.

Upload invoices and bulk payment CSVs to different folders for each account

  1. Login to stage.billing.opencraft.com
  2. Go to Hourly Rates page and make sure atleast one hourly rate is setup with a differnt client (Flouzo).
  3. Trigger the send_invoice_approval_request function from django shell (Let me know when ready, I can run this for you)
  4. Go to the Accounting Stage Google drive location. There should one directory each for each of the clients (GmbH and SARL)
  5. Open each of the directory and verify that the invoices just generated above were uploaded under the correct directory. The location of the invoice should be <Client Directory>/2023/invoices-in/<Month>

Delete duplicate file uploads

  1. In the Accounting Stage Google drive location, go to a invoice directory <Client Directory>/2023/invoices-in/<Month>.
  2. Select an invoice and go to Menu > File Information > Activity.
  3. Note the Last activity time stamp.
  4. Login to stage.billing.opencraft.com
  5. Go to the invoices page
  6. Select the invoice and regenerate it from the Action menu
  7. Go back to the google drive location (refreshing the browser might be required).
  8. Make sure only one copy of the invoice is present even after regenerating it.
  9. Again check the activity timestamp and verify that time has changed, proving it to be the new copy of the file.

Deadline

"None" if there's no rush, or provide a specific date or event (and reason) if there is one.

Other information

BB-7861 BB-7862

Edited by Kaustav Banerjee

Merge request reports