diff --git a/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js index 5b65a75653..1f27f88066 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js +++ b/modules/invoiceOut/back/methods/invoiceOut/clientsToInvoice.js @@ -95,7 +95,7 @@ module.exports = Self => { ], myOptions); } - const invoiceableClients = await getInvoiceableClients(ctx, myOptions); + const invoiceableClients = await getInvoiceableClients(ctx, minShipped, myOptions); if (!invoiceableClients) return; @@ -145,11 +145,9 @@ module.exports = Self => { ], options); } - async function getInvoiceableClients(ctx, options) { + async function getInvoiceableClients(ctx, minShipped, options) { const models = Self.app.models; const args = ctx.args; - const minShipped = new Date(); - minShipped.setFullYear(minShipped.getFullYear() - 1); const query = `SELECT c.id,