#6147 - Refactor Invoice make PDF and notify #1933
|
@ -17,6 +17,7 @@ describe('InvoiceOut transferInvoice()', () => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
spyOn(models.InvoiceOut, 'makePdfAndNotify');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the id of the created issued invoice', async() => {
|
it('should return the id of the created issued invoice', async() => {
|
||||||
|
|
|
@ -28,12 +28,8 @@ module.exports = function(Self) {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.invoiceTicketsAndPdf = async(ctx, ticketsIds, invoiceCorrection, options) => {
|
Self.invoiceTicketsAndPdf = async(ctx, ticketsIds, invoiceCorrection, options) => {
|
||||||
let invoiceIds = null;
|
const invoiceIds = await Self.invoiceTickets(ctx, ticketsIds, invoiceCorrection, options);
|
||||||
|
await Self.app.models.InvoiceOut.makePdfList(ctx, invoiceIds, null, options);
|
||||||
invoiceIds = await Self.invoiceTickets(ctx, ticketsIds, invoiceCorrection, options);
|
|
||||||
if (!invoiceIds) return [];
|
|
||||||
if (!options.transaction)
|
|
||||||
await Self.app.models.InvoiceOut.makePdfList(ctx, invoiceIds, null, options);
|
|
||||||
return invoiceIds;
|
return invoiceIds;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
jsegarra marked this conversation as resolved
Outdated
|
|||||||
|
|
Loading…
Reference in New Issue
Jo diria que no cal el if, pq si estas cridant aci es pq si o si vols el pdf. Si no cridaries al altre