Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-04-24 11:36:43 +02:00
commit 0eabd9876d
1 changed files with 1 additions and 6 deletions

View File

@ -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'});