This commit is contained in:
parent
3c8ef7cdba
commit
9c0af7f7c6
|
@ -2,7 +2,7 @@ const {Report, Email} = require('vn-print');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.printReport = async function(ctx, id, reportName) {
|
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()};
|
const params = {lang: ctx.req.getLocale()};
|
||||||
|
|
||||||
delete args.ctx;
|
delete args.ctx;
|
||||||
|
|
|
@ -53,8 +53,7 @@ module.exports = Self => {
|
||||||
if (hasDmsCmr.length)
|
if (hasDmsCmr.length)
|
||||||
throw new UserError('This ticket already has a cmr saved');
|
throw new UserError('This ticket already has a cmr saved');
|
||||||
|
|
||||||
Object.assign(ctx.args, {id: ticket.$cmrFk});
|
const response = await models.Cmr.print(ctx, ticket.$cmrFk, myOptions);
|
||||||
const response = await models.Cmr.print(ctx, myOptions);
|
|
||||||
const pdfStream = Readable.from(Buffer.from(response[0]));
|
const pdfStream = Readable.from(Buffer.from(response[0]));
|
||||||
const data = {
|
const data = {
|
||||||
workerFk: ctx.req.accessToken.userId,
|
workerFk: ctx.req.accessToken.userId,
|
||||||
|
|
Loading…
Reference in New Issue