diff --git a/loopback/common/methods/vn-model/printService.js b/loopback/common/methods/vn-model/printService.js index 12a6a67cc..ed784229b 100644 --- a/loopback/common/methods/vn-model/printService.js +++ b/loopback/common/methods/vn-model/printService.js @@ -2,7 +2,7 @@ const {Report, Email} = require('vn-print'); module.exports = Self => { Self.printReport = async function(ctx, id, reportName) { - const args = Object.assign({}, ctx.args); + const args = Object.assign({id}, ctx.args); const params = {lang: ctx.req.getLocale()}; delete args.ctx; diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index a96bb6a27..5ac748751 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -53,8 +53,7 @@ module.exports = Self => { if (hasDmsCmr.length) throw new UserError('This ticket already has a cmr saved'); - Object.assign(ctx.args, {id: ticket.$cmrFk}); - const response = await models.Cmr.print(ctx, myOptions); + const response = await models.Cmr.print(ctx, ticket.$cmrFk, myOptions); const pdfStream = Readable.from(Buffer.from(response[0])); const data = { workerFk: ctx.req.accessToken.userId,