Feat/add endpoint update invoice pdf link
CHANGELOG:
### Added
- [#1156](https://git.coopdevs.org/coopdevs/som-connexio/odoo-somconnexio/-/merge_requests/1156) Introduce `api/invoice/update-pdf-link` endpoint for updating invoice PDF links.
Merge Request Description: Update PDF Link Endpoint
This merge request introduces a critical enhancement to the billing process. We have implemented a new endpoint, api/invoice/update-pdf-link
, which plays a pivotal role in updating the URL for downloading the generated invoice PDF in Odoo.
Changes in this MR:
-
New Endpoint:
- Added a new endpoint,
api/invoice/update-pdf-link
, to facilitate the update of the invoice PDF link.
- Added a new endpoint,
-
Endpoint Specifications:
- Expects a JSON body with the following parameters:
-
invoice_number
: The unique identifier of the invoice. -
pdf_link
: The updated URL for downloading the invoice PDF.
-
- Expects a JSON body with the following parameters:
Purpose:
The primary purpose of this enhancement is to allow the Data Warehouse (DWH), after generating the PDF of the invoice, to seamlessly notify Odoo about the updated PDF link. This link is crucial as it will be utilized in the billing email to provide users with a convenient way to download their invoices.
How it Works:
- The DWH generates the PDF of the invoice.
- It calls the
api/invoice/update-pdf-link
endpoint in Odoo with the invoice number and the new PDF link. - Odoo locates the invoice using the provided number and updates the PDF link accordingly.
- In the previous step of the billing process (from the previous MR), Odoo notifies the Data Warehouse about the invoice number.
Example Usage:
curl -X POST \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "api-key: $APIKEY" \
-d '{
"invoice_number": "CON/2023/123456",
"pdf_link": "https://example.com/invoices/123456.pdf"
}' \
"$URL/api/invoice/update-pdf-link"
Diagram
sequenceDiagram
participant DWH
participant Odoo
Odoo ->> DWH: Notify Invoice Number (in MR !1154)
Note over DWH: Generate Invoice PDF
DWH ->> Odoo: POST /api/invoice/update-pdf-link {"invoice_number": "123456", "pdf_link": "https://example.com/invoices/123456.pdf"}
Edited by Gerard Funosas