diff --git a/modules/ticket/back/methods/sale-tracking/setPicked.js b/modules/ticket/back/methods/sale-tracking/setPicked.js index 828f6eb7e..5eedcbf6c 100644 --- a/modules/ticket/back/methods/sale-tracking/setPicked.js +++ b/modules/ticket/back/methods/sale-tracking/setPicked.js @@ -89,16 +89,9 @@ module.exports = Self => { const {itemOriginalFk} = await models.Buy.findById(buyFk, {fields: ['itemOriginalFk']}, myOptions); if (itemOriginalFk) await models.SaleBuy.create({saleFk, buyFk}, myOptions); } catch (e) { - throw new UserError('The sale cannot be tracked'); + if (tx) await tx.commit(); } - - if (tx) await tx.commit(); } catch (e) { - if (e.message == 'The sale cannot be tracked') { - if (tx) tx.commit(); - throw e; - } - if (tx) await tx.rollback(); throw new UserError('The line could not be marked'); }