Merge pull request 'hotfix_errorEliminarTicket' (!1626) from hotfix_errorEliminarTicket into master
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1626
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Vicent Llopis 2023-06-20 09:40:00 +00:00
commit a4d3e8efd0
1 changed files with 7 additions and 9 deletions

View File

@ -81,17 +81,15 @@ module.exports = Self => {
throw new UserError('You must delete all the buy requests first'); throw new UserError('You must delete all the buy requests first');
// removes item shelvings // removes item shelvings
if (hasItemShelvingSales && isSalesAssistant) { const promises = [];
const promises = []; for (let sale of sales) {
for (let sale of sales) { if (sale.itemShelvingSale()) {
if (sale.itemShelvingSale()) { const itemShelvingSale = sale.itemShelvingSale();
const itemShelvingSale = sale.itemShelvingSale(); const destroyedShelving = models.ItemShelvingSale.destroyById(itemShelvingSale.id, myOptions);
const destroyedShelving = models.ItemShelvingSale.destroyById(itemShelvingSale.id, myOptions); promises.push(destroyedShelving);
promises.push(destroyedShelving);
}
} }
await Promise.all(promises);
} }
await Promise.all(promises);
// Remove ticket greuges // Remove ticket greuges
const ticketGreuges = await models.Greuge.find({where: {ticketFk: id}}, myOptions); const ticketGreuges = await models.Greuge.find({where: {ticketFk: id}}, myOptions);