fix: refs #6889 rollback
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-05-29 10:22:22 +02:00
parent 9d58c67b4a
commit fc606f7e36
1 changed files with 1 additions and 11 deletions

View File

@ -68,7 +68,6 @@ module.exports = Self => {
fields: ['family', 'minQuantity'],
where: {id: itemId},
}, ctx.options);
if (item.family == 'EMB') return;
if (await models.ACL.checkAccessAcl(ctx, 'Sale', 'isInPreparing', '*')) return;
@ -89,16 +88,7 @@ module.exports = Self => {
if (await models.ACL.checkAccessAcl(ctx, 'Ticket', 'isRoleAdvanced', '*')) return;
// WIP: Check if is owner
const ticketCollection = await models.TicketCollection.findOne({
include: {relation: 'collection', fields: ['workerFk']},
where: {ticketFk: ticketId}
}, ctx.options);
// if(!res) look in SaleGroup.(ask for Sergio to make fixtures for this case)
const isOwner = res.collection.workerFk === ctx.req.accessToken.userId;
if (newQuantity < item.minQuantity && newQuantity != available && !isOwner)
if (newQuantity < item.minQuantity && newQuantity != available)
throw new UserError('The amount cannot be less than the minimum');
if (ctx.isNewInstance || isReduction) return;