Skip to content

Commit

Permalink
Merge pull request #289 from itenium-be/fix-update-peppol-xml-on-invo…
Browse files Browse the repository at this point in the history
…ice-update

Recreating peppol xml on invoice update
  • Loading branch information
Laoujin authored Jul 3, 2024
2 parents aa049fc + e238fee commit d00b0d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/src/controllers/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ export const updateInvoiceController = async (req: ConfacRequest, res: Response)
.findOneAndUpdate({_id: new ObjectID(_id)}, {$set: {pdf: updatedPdfBuffer}});
}

if (!invoice.isQuotation) {
const updateXmlBuffer = Buffer.from(createXml({_id, ...invoice}));
await req.db.collection<IAttachment>(CollectionNames.ATTACHMENTS)
.findOneAndUpdate({_id: new ObjectID(_id)}, {$set: {xml: updateXmlBuffer}});
}

if (!invoice.projectMonth) {
// Makes sure projectMonth is overwritten in the db if already present there
invoice.projectMonth = undefined;
Expand Down

0 comments on commit d00b0d7

Please sign in to comment.