From 0180998683ed40e951eb4a81671bcf411dc112c0 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 28 Oct 2024 13:08:27 +0100 Subject: [PATCH 1/2] fix: refs #7283 item filters --- modules/item/back/methods/item/filter.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 909b3dff8..54dd975a4 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -38,13 +38,23 @@ module.exports = Self => { type: 'integer', description: 'Type id', }, + { + arg: 'producerFk', + type: 'integer', + description: 'Producer id', + }, + { + arg: 'instrastatFk', + type: 'string', + description: 'intrastat id', + }, { arg: 'isActive', type: 'boolean', description: 'Whether the item is or not active', }, { - arg: 'buyerFk', + arg: 'workerFk', type: 'integer', description: 'The buyer of the item', }, @@ -126,14 +136,16 @@ module.exports = Self => { return {'i.stemMultiplier': value}; case 'categoryFk': return {'ic.id': value}; - case 'buyerFk': + case 'workerFk': return {'it.workerFk': value}; + case 'producerFk': + return {'pr.id': value}; case 'supplierFk': return {'s.id': value}; case 'origin': return {'ori.code': value}; - case 'intrastat': - return {'intr.description': value}; + case 'intrastatFk': + return {'i.intrastatFk': value}; case 'landed': return {'lb.landed': value}; } @@ -172,6 +184,7 @@ module.exports = Self => { u.name AS userName, ori.code AS origin, ic.name AS category, + i.intrastatFk, intr.description AS intrastat, b.grouping, b.packing, From 385279b39df4c829c99bf29913b233afa5644747 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 28 Oct 2024 13:15:40 +0100 Subject: [PATCH 2/2] fix: refs #7283 tback --- modules/item/back/methods/item/specs/filter.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/item/back/methods/item/specs/filter.spec.js b/modules/item/back/methods/item/specs/filter.spec.js index 14467d1d8..a8aaca786 100644 --- a/modules/item/back/methods/item/specs/filter.spec.js +++ b/modules/item/back/methods/item/specs/filter.spec.js @@ -86,7 +86,7 @@ describe('item filter()', () => { try { const filter = {}; - const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}}; + const ctx = {args: {filter: filter, workerFk: 16}, req: {accessToken: {userId: 1}}}; const result = await models.Item.filter(ctx, filter, options); expect(result.length).toEqual(2);