From 91210c3a0dbd66deba6fb3ad5b39fc5e61f5beac Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Tue, 11 Feb 2020 08:19:03 +0100 Subject: [PATCH] 1684 - Log old quantity value --- .../back/methods/ticket/transferSales.js | 8 +++---- modules/ticket/front/sale/index.html | 24 ++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/modules/ticket/back/methods/ticket/transferSales.js b/modules/ticket/back/methods/ticket/transferSales.js index 7aeb4bf56..c2257bf09 100644 --- a/modules/ticket/back/methods/ticket/transferSales.js +++ b/modules/ticket/back/methods/ticket/transferSales.js @@ -157,9 +157,9 @@ module.exports = Self => { // Update original sale const rest = originalSale.quantity - sale.quantity; - const updatedSale = await models.Sale.updateAll({ - id: sale.id - }, {quantity: rest}, options); + const originalInstance = await models.Sale.findById(sale.id, options); + await originalInstance.updateAttribute('quantity', rest, options); + // Clone sale with new quantity const newSale = originalSale; newSale.id = undefined; @@ -180,6 +180,6 @@ module.exports = Self => { await models.SaleComponent.create(newComponents, options); - return updatedSale; + return originalInstance; } }; diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 89f3218b1..224392deb 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -323,17 +323,19 @@ - - - - - - +
+ + + + + + +