fix: refs #6861 updateAvailable
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-09-25 12:24:00 +02:00
parent aadce7971b
commit 8f63118550
2 changed files with 10 additions and 2 deletions

View File

@ -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();

View File

@ -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},