refs #6312 no inserta el originalquantity #1803

Merged
jgallego merged 2 commits from 6312 into dev 2023-10-19 06:41:46 +00:00
1 changed files with 5 additions and 4 deletions

View File

@ -138,14 +138,15 @@ module.exports = Self => {
// Update original sale
const rest = originalSale.quantity - sale.quantity;
query = `UPDATE sale
SET quantity = ?
SET quantity = ?,
originalQuantity = ?
WHERE id = ?`;
await Self.rawSql(query, [rest, sale.id], options);
await Self.rawSql(query, [rest, rest, sale.id], options);
// Clone sale with new quantity
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed,
query = `INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, discount, priceFixed,
reserved, isPicked, isPriceFixed, isAdded)
SELECT itemFk, ?, concept, ?, originalQuantity, price, discount, priceFixed,
SELECT itemFk, ?, concept, ?, price, discount, priceFixed,
reserved, isPicked, isPriceFixed, isAdded
FROM sale
WHERE id = ?`;