Merge pull request 'fix: refs #6861 updateAvailable' (!3018) from 6861-updateAvailable into master
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3018 Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
This commit is contained in:
commit
a32536a70b
|
@ -38,9 +38,13 @@ module.exports = Self => {
|
||||||
|
|
||||||
const itemShelving = itemShelvingSale.itemShelving();
|
const itemShelving = itemShelvingSale.itemShelving();
|
||||||
const quantity = itemShelving.visible + itemShelvingSale.quantity;
|
const quantity = itemShelving.visible + itemShelvingSale.quantity;
|
||||||
|
const available = itemShelving.available + itemShelvingSale.quantity;
|
||||||
|
|
||||||
await itemShelving.updateAttributes(
|
await itemShelving.updateAttributes(
|
||||||
{visible: quantity},
|
{
|
||||||
|
visible: quantity,
|
||||||
|
available: available
|
||||||
|
},
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
|
@ -75,7 +75,11 @@ module.exports = Self => {
|
||||||
|
|
||||||
const itemShelving = await models.ItemShelving.findById(itemShelvingFk, null, myOptions);
|
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(
|
await Self.updateAll(
|
||||||
{saleFk},
|
{saleFk},
|
||||||
|
|
Loading…
Reference in New Issue