fix: refs #6861 updateAvailable #3018
|
@ -38,9 +38,13 @@ module.exports = Self => {
|
|||
|
||||
const itemShelving = itemShelvingSale.itemShelving();
|
||||
const quantity = itemShelving.visible + itemShelvingSale.quantity;
|
||||
const available = itemShelving.available + itemShelvingSale.quantity;
|
||||
|
||||
await itemShelving.updateAttributes(
|
||||
{visible: quantity},
|
||||
{
|
||||
visible: quantity,
|
||||
available: available
|
||||
},
|
||||
myOptions
|
||||
);
|
||||
if (tx) await tx.commit();
|
||||
|
|
|
@ -75,7 +75,11 @@ module.exports = Self => {
|
|||
|
||||
const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions);
|
||||
|
||||
await itemShelving.updateAttributes({visible: itemShelving.visible - quantity}, myOptions);
|
||||
await itemShelving.updateAttributes(
|
||||
{
|
||||
visible: itemShelving.visible - quantity,
|
||||
available: itemShelving.available - quantity
|
||||
}, myOptions);
|
||||
|
||||
await Self.updateAll(
|
||||
{saleFk},
|
||||
|
|
Loading…
Reference in New Issue