diff --git a/modules/ticket/back/methods/ticket/deliveryNoteEmail.js b/modules/ticket/back/methods/ticket/deliveryNoteEmail.js index ecb4556a0..1e7ef43b9 100644 --- a/modules/ticket/back/methods/ticket/deliveryNoteEmail.js +++ b/modules/ticket/back/methods/ticket/deliveryNoteEmail.js @@ -29,6 +29,12 @@ module.exports = Self => { description: 'The recipient id to send to the recipient preferred language', required: false }, + { + arg: 'type', + type: 'string', + description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]', + required: false + }, ], returns: { type: ['object'], @@ -55,9 +61,11 @@ module.exports = Self => { if (args.replyTo) params.replyTo = args.replyTo; - const email = new Email('delivery-note', params); - await email.send(); + if (args.type) + params.type = args.type; - return true; + const email = new Email('delivery-note', params); + + return email.send(); }; }; diff --git a/modules/ticket/back/methods/ticket/deliveryNotePdf.js b/modules/ticket/back/methods/ticket/deliveryNotePdf.js index 5b34a7265..d1e288a98 100644 --- a/modules/ticket/back/methods/ticket/deliveryNotePdf.js +++ b/modules/ticket/back/methods/ticket/deliveryNotePdf.js @@ -2,7 +2,7 @@ const {Report, Email, smtp} = require('vn-print'); module.exports = Self => { Self.remoteMethodCtx('deliveryNotePdf', { - description: '', + description: 'Returns the delivery note pdf', accepts: [ { arg: 'id', @@ -17,6 +17,12 @@ module.exports = Self => { description: 'The client id', required: false }, + { + arg: 'type', + type: 'string', + description: 'The delivery note type [ deliveryNote, proforma, withoutPrices ]', + required: false + }, ], returns: [ { @@ -51,6 +57,9 @@ module.exports = Self => { if (args.recipientId) params.recipientId = args.recipientId; + if (args.type) + params.type = args.type; + const report = new Report('delivery-note', params); const stream = await report.toPdfStream(); diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 35f9a2960..d166f3307 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -15,7 +15,7 @@
{{client.id}} | ||
---|---|---|
{{$t(type)}} | +{{$t(deliverNoteType)}} | {{ticket.id}} |