fix send notification to salesPerson #1382
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-04-25 13:32:14 +02:00
parent b6c95f262f
commit aec46bb855
1 changed files with 13 additions and 20 deletions

View File

@ -70,14 +70,16 @@ module.exports = Self => {
discount: 100 discount: 100
}, {transaction: transaction}); }, {transaction: transaction});
await sendMessage(ctx, { if (sale.ticket().client().salesPerson()) {
itemFk: sale.itemFk, await sendMessage(ctx, {
ticketFk: sale.ticketFk, itemFk: sale.itemFk,
recipientFk: sale.item().itemType().worker().userFk, ticketFk: sale.ticketFk,
quantity: sale.quantity, recipientFk: sale.ticket().client().salesPerson().userFk,
concept: sale.concept, quantity: sale.quantity,
nickname: address.nickname concept: sale.concept,
}, transaction); nickname: address.nickname
}, transaction);
}
} }
let claim = await Self.findById(params.claimFk); let claim = await Self.findById(params.claimFk);
@ -99,23 +101,14 @@ module.exports = Self => {
include: [ include: [
{ {
relation: 'ticket', relation: 'ticket',
scope: {fields: ['warehouseFk', 'companyFk']}
},
{
relation: 'item',
scope: { scope: {
fields: ['typeFk'], fields: ['clientFk', 'warehouseFk', 'companyFk'],
include: { include: {
relation: 'itemType', relation: 'client',
scope: { scope: {
fields: ['workerFk'],
include: { include: {
relation: 'worker', relation: 'salesPerson'
scope: {
fields: ['id', 'userFk'],
}
} }
} }
} }
} }