From 65756f98ad579ce2908062c398836d16d3b6777e Mon Sep 17 00:00:00 2001 From: guillermo Date: Mon, 29 Jan 2024 08:25:00 +0100 Subject: [PATCH] fix: #6184 Minor changes --- modules/ticket/back/methods/ticket/saveCmr.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 30b327dee..17760bacc 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -33,6 +33,11 @@ module.exports = Self => { } try { + const dmsTypeCmr = await models.DmsType.findOne({ + where: {code: 'cmr'}, + fields: ['id'] + }, myOptions); + for (const ticketId of tickets) { const ticket = await models.Ticket.findById(ticketId, myOptions); @@ -43,10 +48,7 @@ module.exports = Self => { relation: 'dms', fields: ['dmsFk'], scope: { - relation: 'dmsType', - scope: { - where: {code: 'cmr'} - } + where: {dmsTypeFk: dmsTypeCmr.id} } } }, myOptions);