diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js index d72d7fc63..8a884e211 100644 --- a/modules/invoiceIn/back/methods/invoice-in/filter.js +++ b/modules/invoiceIn/back/methods/invoice-in/filter.js @@ -119,6 +119,7 @@ module.exports = Self => { } let correctings; + let correcteds; if (args.correctedFk) { correctings = await models.InvoiceInCorrection.find({ @@ -154,6 +155,7 @@ module.exports = Self => { case 'awbCode': return {'sub.code': value}; case 'correctingFk': + if (!correcteds.length && !args.correctingFk) return; return args.correctingFk ? {'ii.id': {inq: correcteds.map(x => x.correctingFk)}} : {'ii.id': {nin: correcteds.map(x => x.correctingFk)}};