diff --git a/modules/ticket/back/methods/sale/updateDiscount.js b/modules/ticket/back/methods/sale/updateDiscount.js index e1793241b..18ad5eb33 100644 --- a/modules/ticket/back/methods/sale/updateDiscount.js +++ b/modules/ticket/back/methods/sale/updateDiscount.js @@ -26,7 +26,6 @@ module.exports = Self => { throw new UserError(`The value should be a number`); let model = Self.app.models; - let thisTicketIsEditable = await model.Ticket.isEditable(params.editLines[0].ticketFk); let ticket = await model.Ticket.find({ where: { id: params.editLines[0].ticketFk @@ -40,13 +39,9 @@ module.exports = Self => { fields: ['id', 'clientFk', 'refFk'] }); - let userId = ctx.req.accessToken.userId; - let isSalesAssistant = await Self.app.models.Account.hasRole(userId, 'salesAssistant'); - - if ((!thisTicketIsEditable && !isSalesAssistant) || (ticket.refFk && isSalesAssistant)) + if (ticket.refFk) throw new UserError(`The sales of this ticket can't be modified`); - let componentToUse; let usesMana = await model.WorkerMana.findOne({where: {workerFk: ticket[0].client().salesPersonFk}, fields: 'amount'});