refactor: movido codigo que imprime pdf dentro del try
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-01-11 13:04:56 +01:00
parent b801ac676c
commit f7ee6c18ca
1 changed files with 11 additions and 11 deletions

View File

@ -121,6 +121,17 @@ module.exports = Self => {
invoiceId = newInvoice.id; invoiceId = newInvoice.id;
} }
if (invoiceId && !invoiceOut.client().isToBeMailed) {
const query = `CALL vn.report_print(
'invoice',
?,
account.myUser_getId(),
JSON_OBJECT('refFk', ?),
'normal'
);`;
await models.InvoiceOut.rawSql(query, [1 /* vPrinterFk */, invoiceOut.ref], myOptions);
}
if (tx) await tx.commit(); if (tx) await tx.commit();
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();
@ -136,17 +147,6 @@ module.exports = Self => {
await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref); await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref);
} }
if (invoiceId && !invoiceOut.client().isToBeMailed) {
const query = `CALL vn.report_print(
'invoice',
?,
account.myUser_getId(),
JSON_OBJECT('refFk', ?),
'normal'
);`;
await models.InvoiceOut.rawSql(query, [1 /* vPrinterFk */, invoiceOut.ref], myOptions);
}
return invoiceId; return invoiceId;
}; };