fix: modelo incorrecto
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-11-25 11:51:07 +01:00
parent bca79e1240
commit af87fc2d53
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
module.exports = Self => {
Self.remoteMethodCtx('getChanges', {
description: 'Check if a ticket is editable',
description: 'Get changues in the sales of a ticket',
accessType: 'READ',
accepts: [{
arg: 'id',
@ -39,8 +39,8 @@ module.exports = Self => {
const newQuantity = ticketLog.newInstance ? ticketLog.newInstance.quantity : null;
if (ticketLog.changedModel == 'Sale' && isUpdate && ticketLog.newInstance.quantity) {
const item = await models.Item.findById(ticketLog.changedModelId, null, myOptions);
changes.push(`${item.name} cambia de ${oldQuantity} a ${newQuantity}`);
const sale = await models.Sale.findById(ticketLog.changedModelId, null, myOptions);
changes.push(`${sale.concept} cambia de ${oldQuantity} a ${newQuantity}`);
}
if (ticketLog.changedModel == 'Ticket' && isUpdate && ticketLog.newInstance.quantity)