From bd605a5d9d7d070a2fb6decf0c43f9fa1e602775 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Wed, 24 Apr 2019 11:23:24 +0200 Subject: [PATCH] update ticket line discount until invoiced #1365 --- modules/ticket/back/methods/sale/updateDiscount.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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'});