diff --git a/modules/route/back/methods/agency-term/filter.js b/modules/route/back/methods/agency-term/filter.js
index 2d48e4baa2..a605d3651d 100644
--- a/modules/route/back/methods/agency-term/filter.js
+++ b/modules/route/back/methods/agency-term/filter.js
@@ -72,7 +72,7 @@ module.exports = Self => {
             }
         });
 
-        filter = mergeFilters(filter, {where});
+        filter = mergeFilters(ctx.args.filter, {where});
 
         const supplier = await Self.app.models.Supplier.isSupplier(ctx, myOptions);
         if (supplier) {
diff --git a/modules/route/back/methods/agency-term/specs/filter.spec.js b/modules/route/back/methods/agency-term/specs/filter.spec.js
index b6729db2b2..76476534b9 100644
--- a/modules/route/back/methods/agency-term/specs/filter.spec.js
+++ b/modules/route/back/methods/agency-term/specs/filter.spec.js
@@ -1,25 +1,20 @@
 const app = require('vn-loopback/server/server');
 const models = require('vn-loopback/server/server').models;
 
-describe('AgencyTerm filter()', () => {
+fdescribe('AgencyTerm filter()', () => {
+    const authUserId = 9;
     const today = Date.vnNew();
     today.setHours(2, 0, 0, 0);
+    let tx;
     let ctx = beforeAll.getCtx();
-    beforeAll(async() => {
-        ctx = {
-            req: {
-                accessToken: {},
-                headers: {origin: 'http://localhost'},
-            }
-        };
-    });
-
+    console.log('ctx', ctx);
     it('should return all results matching the filter', async() => {
-        const tx = await models.AgencyTerm.beginTransaction({});
+        tx = await models.AgencyTerm.beginTransaction({});
 
         try {
             const options = {transaction: tx};
             const filter = {};
+            ctx = {req: {accessToken: {userId: authUserId}}};
 
             const agencyTerms = await models.AgencyTerm.filter(ctx, filter, options);
             const firstAgencyTerm = agencyTerms[0];
@@ -35,39 +30,23 @@ describe('AgencyTerm filter()', () => {
     });
 
     it('should return results matching "search" searching by integer', async() => {
-        // ctx = {
-        //     args: {
-        //         search: 1,
-        //     }
-        // };
-        const filter = {
-            order: 'isActive ASC, name',
-            search: 1
-        };
+        const ctx = {req: {args: {search: 1}}};
 
-        let result = await app.models.AgencyTerm.filter(ctx, filter);
+        let result = await app.models.AgencyTerm.filter(ctx);
 
         expect(result.length).toEqual(1);
         expect(result[0].routeFk).toEqual(1);
     });
 
     it('should return results matching "search" searching by string', async() => {
-        // ctx = {
-        //     args: {
-        //         search: 'Plants SL',
-        //     }
-        // };
-        const filter = {
-            search: 'Plants SL'
-        };
-
-        let result = await app.models.AgencyTerm.filter(ctx, filter);
+        const ctx = {req: {args: {search: 'Plants SL'}}};
+        let result = await app.models.AgencyTerm.filter(ctx);
 
         expect(result.length).toEqual(2);
     });
 
     it('should return results matching "from" and "to"', async() => {
-        const tx = await models.Buy.beginTransaction({});
+        tx = await models.Buy.beginTransaction({});
         const options = {transaction: tx};
 
         try {
@@ -77,6 +56,8 @@ describe('AgencyTerm filter()', () => {
             const to = Date.vnNew();
             to.setHours(23, 59, 59, 999);
 
+            const ctx = {req: {args: {from: from, to: to}}};
+
             const results = await models.AgencyTerm.filter(ctx, options);
 
             expect(results.length).toBe(5);
@@ -89,31 +70,17 @@ describe('AgencyTerm filter()', () => {
     });
 
     it('should return results matching "agencyModeFk"', async() => {
-        // ctx = {
-        //     args: {
-        //         agencyModeFk: 1,
-        //     }
-        // };
-        const filter = {
-            agencyModeFk: 1,
-        };
-        let result = await app.models.AgencyTerm.filter(ctx, filter);
+        const ctx = {req: {args: {agencyModeFk: 1}}};
+
+        let result = await app.models.AgencyTerm.filter(ctx);
 
         expect(result.length).toEqual(1);
         expect(result[0].routeFk).toEqual(1);
     });
 
     it('should return results matching "agencyFk"', async() => {
-        // ctx = {
-        //     args: {
-        //         agencyFk: 2,
-        //     }
-        // };
-
-        const filter = {
-            agencyFk: 2
-        };
-        let result = await app.models.AgencyTerm.filter(ctx, filter);
+        const ctx = {req: {args: {agencyFk: 1}}};
+        let result = await app.models.AgencyTerm.filter(ctx);
 
         expect(result.length).toEqual(1);
         expect(result[0].routeFk).toEqual(2);
diff --git a/modules/supplier/back/models/supplier.js b/modules/supplier/back/models/supplier.js
index 86f124d88d..0acb363411 100644
--- a/modules/supplier/back/models/supplier.js
+++ b/modules/supplier/back/models/supplier.js
@@ -164,7 +164,8 @@ module.exports = Self => {
             throw new UserError('The social name has an invalid format');
     });
 
-    Self.isSupplier = async(userId, options = {}) => {
+    Self.isSupplier = async(ctx, options = {}) => {
+        const userId = ctx.req.accessToken.userId;
         const client = await Self.app.models.Client.findById(userId, options);
         const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, options);
         return supplier;