error when sending to a salesPerson pay-method changes #1338
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-04-15 08:46:20 +02:00
parent b5fe7a6fae
commit 79f9dfb515
1 changed files with 3 additions and 2 deletions

View File

@ -197,10 +197,11 @@ module.exports = Self => {
if (payMethodChanged || ibanChanged || dueDayChanged) { if (payMethodChanged || ibanChanged || dueDayChanged) {
const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`; const message = `La forma de pago del cliente con id ${instance.id} ha cambiado`;
const salesPersonFk = instance.salesPersonFk; const salesPersonFk = instance.salesPersonFk;
const salesPerson = await Self.app.models.Worker.findById(salesPersonFk);
if (salesPersonFk) { if (salesPerson) {
await Self.app.models.Message.send(ctx, { await Self.app.models.Message.send(ctx, {
recipientFk: salesPersonFk, recipientFk: salesPerson.userFk,
message: message message: message
}); });
} }